cancel
Showing results for 
Search instead for 
Did you mean: 

GPIO detection.

ongth60
Associate II
Posted on October 31, 2005 at 23:51

GPIO detection.

2 REPLIES 2
ongth60
Associate II
Posted on October 28, 2005 at 09:58

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,

ongth60

ongth60
Associate II
Posted on October 31, 2005 at 23:51

Hi,

Im using P0.8 as U0.Rx. Does that affect P1.8?

Rgrds,

ongth60