Page 227 - Programming Microcontrollers in C
P. 227

212    Chapter 5  Programming Large 8-Bit Systems

                          unsigned  char bit4 : 1;
                          unsigned  char bit5 : 1;
                          unsigned  char bit6 : 1;
                          unsigned  char bit7 : 1;
                   } Register;


                   #define PORTA (*(volatile Register*)(Register_Set+0))

                   typedef struct {
                       unsigned char STAF :1;
                       unsigned char STAI :1;
                       unsigned char CWOM :1;
                       unsigned char HNDS :1;
                       unsigned char OIN  :1;
                       unsigned char PLS  :1;
                       unsigned char EGA  :1;
                       unsigned char INVB :1;
                   }Pioc;

                   #define PIOC  (*(volatile Pioc*)(Register_Set+2))


                   #define PORTC (*(volatile Register*)(Register_Set+3))
                   #define PORTB (*(volatile Register*)(Register_Set+4))
                       .
                       .
                       .
                   #define TCNT  (*(unsigned int *)(Register_Set+0xE))
                   #define TIC1  (*(unsigned int *)(Register_Set+0x10))
                       .
                       .
                       .
                   /* To clear bits in the flag registers use the form

                       TFLG1 = OC1


                      to clear OC1F in TFLG1.  Use this form only in the
                       two flag registers TFLG1 and TFLG2 below.
                   */
   222   223   224   225   226   227   228   229   230   231   232