For the (volatile unsigned char *) 0x20 Let us analyze, which is composed of two parts:
1) (unsigned char *) 0x20, 0x20 is just a value, preceded (unsigned char *) indicates 0x20 is an address, but this address type is unsigned char, meaning that read and write to this address, unsigned char values to be written into and read out is unsigned char.
2) volatile, volatile keyword to ensure that this directive will not be optimized C compiler have been omitted, and require each direct reading. For example while ((unsigned char *) 0x20), sometimes the system might not actually read the value of 0x20, but with the first read-out value, if so, then the loop may be an endless loop. With a volatile read is required every time the actual value of 0x20. Then (volatile unsigned char *) 0x20 is a fixed pointer is immutable, not a variable. The char * u is a pointer variable. And then in the front plus "*": * (volatile unsigned char *) 0x20 becomes a variable (unsigned char variables common and not a pointer variable), if # define i (* (volatile unsigned char *) 0x20), then with unsigned char i is the same, but in front of the address of i is fixed. So your question can be answered, (* (volatile unsigned char *) 0x20) can be regarded as a normal variable, this variable has a fixed address, pointing to 0x20. The 0x20 is just a constant, not a pointer but not variable.
No comments:
Post a Comment