We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello ALL I need to access some of the bit positions of the SFR. But each time i tried to declare a variable of the type sbit , i get error C141: syntax error near sbit. I have read the manual and i even tried the statement :
sbit EA = 0xAF
You are obviously not familiar with the '51'. Trying to program this chip as "any chip" is the sure road to disaster. Before writing one more line of code read "the bible" Please, take note of the address of MMCON2. here are the links to "the bible" Chapter 1 http://www.semiconductors.philips.com/acrobat/various/80C51_FAM_ARCH_1.pdf chapter 2 http://www.semiconductors.philips.com/acrobat/various/80C51_FAM_PROG_GUIDE_1.pdf chapter 3 http://www.semiconductors.philips.com/acrobat/various/80C51_FAM_HARDWARE_1.pdf Erik
Thanks Erik, I appreciate it. I will read the Bible as suggested. Amos
Only SFRs with addresses that end in 0 or 8 are bit-addressable. Note that there are eight bits in a byte, and the bit addresses for SFR X0 range from X + 0 to X + 7, whereupon you reach SFR X8 with bits X8 + 0 to X8 + 7. There's method in the madness. For registers that are not bit addressable, you can set bits the good old fashioned way, with AND and OR operations. AND / OR also works on the SFRs with addressable bits.