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.
This is in my 89C51RE2
/*------------------ T W I (I2C) registers ------------------------------*/ Sfr ( SSCON , 0x93);
Sbit (SSCR2 , 0x93, 7); Sbit (SSIEN , 0x93, 6); Sbit (SSSTA , 0x93, 5); Sbit (SSST0 , 0x93, 4); Sbit (SSSI , 0x93, 3); Sbit (SSAA , 0x93, 2); Sbit (SSCR1 , 0x93, 1); Sbit (SSCR0 , 0x93, 0);
This is the error I got while compiling 17 18 /* @section I N C L U D E S */ 19 //#include "reg_C51.h" 20 #include "89C51RE2.h" *** ERROR C142 IN LINE 227 OF 89C51RE2.H: 'SFR': invalid base address *** ERROR C142 IN LINE 228 OF 89C51RE2.H: 'SFR': invalid base address *** ERROR C142 IN LINE 229 OF 89C51RE2.H: 'SFR': invalid base address *** ERROR C142 IN LINE 230 OF 89C51RE2.H: 'SFR': invalid base address *** ERROR C142 IN LINE 231 OF 89C51RE2.H: 'SFR': invalid base address *** ERROR C142 IN LINE 232 OF 89C51RE2.H: 'SFR': invalid base address *** ERROR C142 IN LINE 233 OF 89C51RE2.H: 'SFR': invalid base address *** ERROR C142 IN LINE 234 OF 89C51RE2.H: 'SFR': invalid base address 21 char TWI_data; 22 char rw=0; /* 0=write, 1=read */ 23 char slave_adr; 24 bit b_TWI_busy=0;
Need help to fix this.
Thanks
The messages tell you clearly what the problem is:
*** ERROR C142 IN LINE 227 OF 89C51RE2.H: 'SFR': invalid base address
You need to check the Manual to see what constitutes a valid base address for an sbit - then ask yourself, do the values that you supplied meet those criteria...?
See also: http://www.keil.com/support/man/docs/c51/c51_c142.htm
Perhaps these would also help:
Chapter 1 - 80C51 Family Architecture: www.nxp.com/.../80C51_FAM_ARCH_1.pdf
Chapter 2 - 80C51 Family Programmer's Guide and Instruction Set: www.nxp.com/.../80C51_FAM_PROG_GUIDE_1.pdf
Chapter 3 - 80C51 Family Hardware Description: www.nxp.com/.../80C51_FAM_HARDWARE_1.pdf
8051 Tutorials: www.8052.com/tutorial.phtml
Books about the 8051: http://www.keil.com/books/8051books.asp www.8052.com/books.phtml
Thanks Andrew,
I will look into these docs and links.
Phillip