Question

In Infineon C509 there is a register called S1CON which is a special function register which looks like this. enter image description here

Is is possible to define bit 0 on S1CON as RI1 so it can be access and refereed to in the main program. I wanted to checked in my main program if receive flag interrupt for serial interface 1 is high or low. Its not defined in the header file but S1CON is

sfr   S1CON  = 0x9B;

Thank you

Or is it just possible to just check the status on Bit 0 on S1CON???

Was it helpful?

Solution

You can define masks for the individual bits (they may already be defined for you in an appropriate header file), e.g.

#define RI1  0x01 // RI1 = bit 0
#define TI1  0x02 // TI1 = bit 1
#define RB81 0x04 // RB81 = bit 2
...

and then to test RI1:

if (SC1CON & RI1)
    ...

To set RI1:

SCICON |= RI1;

To clear RI1:

SCICON &= ~RI1;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top