I am asking to start how i would assign the pin to read the voltage every second saved then read and saved again for as long as needed.
so here is what i got to start:
#define VSS PORTAbits.RA0 //this will be pin reading the voltage
#define ONN LATDbits.RD0 // this will be the pin to send the Hi
#define B1 PORTAbits.RA1
#define B2 PORTAbits.RA2 // these pins will monitor the buttons
so first i want to sent a hi from RD0 when button B1 is pressed and continue that Hi until the reading on RA0 is less than XXmvolts. So here is my very amateur shot in the dark i know very little and just trying to learn online please feel free to point out EVERYTHING that is stupid or wrong.
void main ( void )
{
for (B1=0) // I just need it to keep sending the HI after b1 is pressesd
{
While ( VSS < 23mV)
{
ONN = 1; // when i do this does it make the pin send a HI?
"what do i put here to take the reading from VSS?"
Delay10KTCYx ( 200 ) // Delay 1 second before next reading
}
}
}
So i know this must look very bad but i had to start somewhere, I realize i need somone other loop to monitor the buttons( no clue how to do that) i have no idea how to save the data on the pic so i am just starting small
I am using online tutorials if you have any awsome one please post, C only please.
so here is what i got to start:
#define VSS PORTAbits.RA0 //this will be pin reading the voltage
#define ONN LATDbits.RD0 // this will be the pin to send the Hi
#define B1 PORTAbits.RA1
#define B2 PORTAbits.RA2 // these pins will monitor the buttons
so first i want to sent a hi from RD0 when button B1 is pressed and continue that Hi until the reading on RA0 is less than XXmvolts. So here is my very amateur shot in the dark i know very little and just trying to learn online please feel free to point out EVERYTHING that is stupid or wrong.
void main ( void )
{
for (B1=0) // I just need it to keep sending the HI after b1 is pressesd
{
While ( VSS < 23mV)
{
ONN = 1; // when i do this does it make the pin send a HI?
"what do i put here to take the reading from VSS?"
Delay10KTCYx ( 200 ) // Delay 1 second before next reading
}
}
}
So i know this must look very bad but i had to start somewhere, I realize i need somone other loop to monitor the buttons( no clue how to do that) i have no idea how to save the data on the pic so i am just starting small
I am using online tutorials if you have any awsome one please post, C only please.
Last edited: