I don't know if this is the right pace to ask, if not, I apologize, please point me on the right place, thanks.
I'm using a Winbond W925E240 and I found it in the supported chips: http://www.keil.com/dd/chip/3523.htm I have a question on the header file for this chip. The chip has some internal register byte addressable and some other bit addressable.
One of the bit addressable registers is the register EIP. In the data sheet that register is described like this:
Bit: 7 6 5 4 3 2 1 0 - - PWDI PCOMP PDIV PCID PX3 PX2
But in the header file I see only one bit defined:
/* EIP */ sbit PWDI = EIP^4;
I found two problem in this: first, I have no idea on why there is only the PWDI bit and not the other bits defind; second, it seems to me that the bit is not in the correct position.
I was expecting to see something like this:
sbit PX2 = EIP^0; sbit PX3 = EIP^1; sbit PCID = EIP^2; sbit PDIV = EIP^3; sbit PCOMP = EIP^4; sbit PWDI = EIP^5;
Am I wrong or what? Thanks in advance.
I never use the provided header files, I always make my own.
I much prefer a format where a search (properly defined) can give all accesses to a SFR or a bit
a small extract from one of my header files will give you the idea
sfr SF_TCON = 0x88; //SF_TCON = 0 + SM_TCON_TF1 + SM_TCON_TR1 + SM_TCON_TF0 + SM_TCON_TR0 + SM_TCON_IE1 + SM_TCON_IT1 + SM_TCON_IE0 + SM_TCON_IT0; sbit SB_TCON_IT0 = 0x88; sbit SB_TCON_IE0 = 0x89; sbit SB_TCON_IT1 = 0x8A; sbit SB_TCON_IE1 = 0x8B; sbit SB_TCON_TR0 = 0x8C; sbit SB_TCON_TF0 = 0x8D; sbit SB_TCON_TR1 = 0x8E; sbit SB_TCON_TF1 = 0x8F; #define SM_TCON_TF1 0x80 #define SM_TCON_TR1 0x40 #define SM_TCON_TF0 0x20 #define SM_TCON_TR0 0x10 #define SM_TCON_IE1 0x08 #define SM_TCON_IT1 0x04 #define SM_TCON_IE0 0x02 #define SM_TCON_IT0 0x01
any search on TCON will give every access to that SFR, any search on TR0 will give every access to that bit whether it is used as a bit or in an AND or an OR.
Erik
Erik, your example is very inspiring, I'll follow it. Can you please explain what SF SB and SM prefixes means? Thanks.
I'd guess at: SF = SFR; SB = sbit; SM = bit-mask?
-