2005-10-31 02:51 PM
2005-10-28 12:58 AM
Hi,
Im connecting a voltage detector to the MCU's GPIO pin using open drain configuration. when it falls below a threshold voltage, the output pin of the voltage detected will be ground, else if above the treshold voltage will be in high impedance. The GPIO is defined as GPIO_Config(GPIO1, 0x0100, GPIO_IPUPD_WP); GPIO_BitWrite(GPIO1, 8, 0x01); while(1) { low_battery_current_status = GPIO_BitRead (GPIO1, 0x08); if((low_battery_latch_status == RESET) && (low_battery_current_status == 0x00)) { low_battery_latch_status == SET; .... .... } else { if((low_battery_latch_status == SET) && (low_battery_current_status == 0x01)) { low_battery_latch_status = RESET; ... ... } } My problem is once I've detected the pin to low, i cant detect it to be high.If I stopped after excuting the statement GPIO_BitWrite(GPIO1, 8, 0x01); and manipulate the treshold voltage, the voltage at the pin shows exactly what it should be; 3.3V when above treshold voltage and 0V when below treshold voltage whereas if I run the program, once it goes from 3.3V to 0V, it cant go up to 3.3V...I m suspecting the that mayb the function GPIO_BitRead (GPIO1, 0x08) might have someting to do with it. Pls advise. Rgds, ongth602005-10-31 02:51 PM
Hi,
Im using P0.8 as U0.Rx. Does that affect P1.8? Rgrds, ongth60