MrDEB
Well-Known Member
I want to add a battery monitor to the bike project but how to configure only one ADC pin instead of all the ADC pins?
using a 18F25K20 in final project but using a 18f2420 for testing
For the battery monitor just two 50k resistors in series then connect the porta.0 to the resistor junction w/ ground and battery connections as requited.
Am using portA.1 and PortA.2 as digital inputs.
Reading the data sheet I assume all I need to do is set TRISA=%00000001
but the data sheet mentions a ANSX bit?
am assuming I leave the setalldigital as is?
using a 18F25K20 in final project but using a 18f2420 for testing
For the battery monitor just two 50k resistors in series then connect the porta.0 to the resistor junction w/ ground and battery connections as requited.
Am using portA.1 and PortA.2 as digital inputs.
Code:
// start of main
SetAllDigital
Shift.SetOutput(DataPin)
Shift.SetClock(ClockPin)
High(ResetPin_R) // make output and set high
High(ResetPin_G) // make output and set high
Low(LE) // make output and set low
High(D_code) // reset the Decoder to enable
PORTB = 0
TRISB = %00000000 // make PORTB outputs
// make S1 and S2 switch inputs (assumes there are external pullups on the pins)
Input(s1)
Input(s2)
While true // durring RIDE the code jumps to here if switch = 1
but the data sheet mentions a ANSX bit?
am assuming I leave the setalldigital as is?