1 of 1 people found this helpful
Not exactly. When you set ControlReg_Write(0), all 7 lines go Low. When you set ControlReg_Write(value), the output of each of 7 lines correspond to bits 6 to 0 of that value. Reading ControlReg_Read() has no effect on the lines state. For example, setting ControlReg_Write(129) produce line states: 6-0, 5-0, 4-0, 3-0, 2-0, 1-0, 0-1.
Sometimes it is necessary to modify existing ControlReg state just for some lines. In such case you have to read/modify like that:
ControlReg_Write(value | 0x02); // set bit_1 to Hi, leave other as-is.
To give you more insight on what I am doing.... when program first boots up, it is doing this...
uint8_t mytemp = I_Control_Reg_Read();
I_Control_Reg_Write (mytemp & 0x0f);
Then when turning the registers off I am doing this...
g_RegValue = I_Control_Reg_Read();
To turn it on,
Which the code chunks above work if I turn off the register for 3 seconds, and turn in on for 1 second... But once I leave it off for more than 3 seconds, I can't seem to turn it back on....
I just had to call ADC_Stop, ADC_Start... thanks!