Hello,
I'm trying to index the digits to set a clock. I have a variable called Parm, which increments with each press of a button (parm++), and is intended to set the corresponding digit on an LCD.
My clock structure looks like this...
Code:
/* --- RTCC Union --- */ typedef union _uRTCC
{
struct
{
uint8 Sec0: 4; // Unit value in decimal
uint8 Sec1: 4; // Tens value in decimal
uint8 Min0: 4;
uint8 Min1: 4;
uint8 Hrs0: 4;
uint8 Hrs1: 4;
uint8 Wdy0: 4;
uint8 Wdy1: 4;
uint8 Day0: 4;
uint8 Day1: 4;
uint8 Mth0: 4;
uint8 Mth1: 4;
uint8 Yrs0: 4;
uint8 Yrs1: 4;
};
uint8 Reg[8]; // 8 byte access
uint16 RTC[4]; // 4 word access
} rtcc;
enum Parm {Sec0, Sec1, Min0, Min1, Hrs0, Hrs1, None};
rtcc *pTD;
uint8 Parm = 0;
//I want to index the nibbles in turn as parm increments - bit like this...
pTD->Reg[Parm] = xx;
I would like to index each nibble in turn, but realize the above indexes the byte, not the nibble. Can someone provide an elegant way to go about this?
Thank you.