Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add stc example #15

Merged
merged 22 commits into from
Oct 12, 2018
Merged

Add stc example #15

merged 22 commits into from
Oct 12, 2018

Conversation

znhocn
Copy link
Contributor

@znhocn znhocn commented Sep 4, 2018

No description provided.

@zerog2k
Copy link
Contributor

zerog2k commented Sep 7, 2018

@znhocn
regarding the stc specific headers, I wonder if using a different declaration format would make it easier for editors like vscode to manage c intellisense better. I think this worked better for me
https://github.com/zerog2k/stc_diyclock/blob/master/src/stc15.h

e.g.
using

__sfr __at 0x12 REG_FOO;

instead of

SFR(REG_FOO, 0x12);

Not sure which is the preferred way, but I think for some reason vscode doesnt like these SFR/SBIT/etc macro style for discovering declarations of sfrs, etc.

@zerog2k
Copy link
Contributor

zerog2k commented Sep 7, 2018

well disregard last comment, I am not sure that vscode understands __sfr/__sbit syntax either...

@znhocn
Copy link
Contributor Author

znhocn commented Sep 8, 2018

@zerog2k
I think VSCode understands the __sfr/__sbit syntax. I tried it and there is no error.

There are two syntaxes __sfr/__sbit and SFR()/SBIT() in the header file provided by SDCC.

C:\Users\<name>\.platformio\packages\toolchain-sdcc\include\mcs51\

I am not sure which syntax is better.

Why do I use SFR()/SBIT() syntax ?
Because it's easier to modify from the STC original header.

STC Original Header:

sfr ACC         =   0xE0;
sfr B           =   0xF0;
sfr PSW         =   0xD0;
sbit CY         =   PSW^7;
sbit AC         =   PSW^6;
sbit F0         =   PSW^5;

sfr P4          =   0xC0;
sbit P40        =   P4^0;
sbit P41        =   P4^1;
sbit P42        =   P4^2;
sbit P43        =   P4^3;

The STC original header is used in the keil compiler and cannot be used in SDCC.

@ivankravets ivankravets merged commit 23727d4 into platformio:develop Oct 12, 2018
@ivankravets
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants