I am currently in the process of porting my C program from SDCC to Keil because of several reasons. (bugs, lack of support, limitations)
What I would like to know is how some of the syntax changes look like.
So far I have figured out that __xdata becomes xdata and I cannot enter binary values.
I am having a lot of issues with the keil compiler at the moment so I will keep it short.
The special functions registers look like: __sfr __at 0xE0 ACC ;
I believe this must look like: sfr ACC = 0xE0; correct?
And is the same true for sbit?
__sbit __at 0x88 IT0 ; --> sbit IT0 = 0x88; ???
Than I'd like to know how the interrupt syntax looks like. It currently looks like this: void ISR_ex0(void) __interrupt 0
A huge problem we're having is that this interrupt 0 in SDCC is linked to a certain stack address (0x03). In SDCC I have no control over the link between address and interrupt numbers. This is baked in the compiler. I am programming an emulated 80c51 chip. The 'chip' is emulated on an FPGA and it comes with a lot of extras such as extra timers, 4 more I/O ports and 8 I/O interrupts rather than two. Now I can only use 2/8 interrupts.
Please read the manual: http://www.keil.com/support/man/docs/c51/c51_le_interruptfuncs.htm
http://www.keil.com/support/man_c51.htm
http://www.keil.com/appnotes/list/c51.htm
http://www.keil.com/download/list/c51.htm
Tnx. The manuals are quite usefull. With SDCC I never used a manual because I didn't had to. From the library files as well as an example program I could get what I needed with ease. I will take a look in Keil's as well.
I only don't onderstand the "using" keywoard yet, I never did. I've read the manual about it but I am not getting the purpose of the register banks and in partically what "using" does when used in combination with the interrupts. I only know that if you call a function from within a function, they should be in the same register bank to prevent strange behaviour
For my serial interrupt I use "using 2" because it was there in an example program. But I don't understand why or what.
Well, if SDCC doesn't have the feature then, presumably, none of your existing code uses it - so you don't need to worry about it at this point!
Start a separate, specific thread once you've got the basic port done.
you are wrong because it isn't just the hardware, it never is "just the hardware".
When one compiles a program in SDCC , he has to add a parameter which tells SDCC for what hardware SDCC is compiling. Than SDCC links the interrupts to the hardware addresses. But it is SDCC which does this for you. And I need to be able to it myself because of our FPGA chips. And this shouldn't be impossible.</i?
it is the interrupt addrsses are fixed in hardware.
www.danlhenry.com/.../80C51_FAM_ARCH_1.pdf www.danlhenry.com/.../80C51_FAM_HARDWARE_1.pdf www.danlhenry.com/.../80C51_FAM_PROG_GUIDE_1.pdf
the above will also educate you re register banks
There is a good tutorial on the four distinct register banks of an 8051 (in the "Register Banks" section)
www.8052.com/tutmemor.phtml
Unless you say otherwise, we use register bank 0, but you could reserve another of the register banks for a function, so you can always have its registers ready to go.
The compiler can even take advantage of this when you turn on "Global register coloring"
http://www.keil.com/support/man/docs/c51/c51_ap_opt_grc.htm
See the other function declaration extensions at:
http://www.keil.com/support/man/docs/c51/c51_le_funcdecls.htm
the most useful use of register banking is ISRs