lake_of_fire
Newbie level 5
Hi,
I have been using a PIC16F87, I have analogue to digital conversion working correctly, i am currently using it to check for a 0-5v range on the input
getVIN() is just a function that reads the A2D input, this works fine however when the program leaves this function (A2D) the LED is switched off RA1 goes low, until this function is called again. How can I get the RA1 to remain on once the function has been left? (I assumed maybe wrongly that RA1 should stay high)
I thought the LED on RA1 should be staying on
Thanks
I have been using a PIC16F87, I have analogue to digital conversion working correctly, i am currently using it to check for a 0-5v range on the input
Code:
void A2D(void)
{
float VLVL = 1.5; //sets A2D alarm level
if(getVIN()>VLVL)
{
RA1 = 1; //turn LED on
}
else
{
RA1 = 0; //turn LED off
}
__delay_ms(200);
}
getVIN() is just a function that reads the A2D input, this works fine however when the program leaves this function (A2D) the LED is switched off RA1 goes low, until this function is called again. How can I get the RA1 to remain on once the function has been left? (I assumed maybe wrongly that RA1 should stay high)
I thought the LED on RA1 should be staying on
Thanks