Nice subject !
I use a similar code for reading the over-current of one DC motor :
Code:
check:
vt =0
vs =0
grup=0
cnt =0
pause 50
for cnt = 1 to 10
adcin 3, adval
vt=adval * 5000
vt=div32 1023
grup=vt+grup
pause 5
next cnt
vs=grup / 10
if (vs > checkin) or (T1Count > 50) then
gpio.0=0
gpio.5=0
endif
If the averge of 10 readings it's bigger than checkin value (or time exceed 5 seconds) then gpio.0 and gpio.5 goes low.
It's one good ideea to use ADCON instead ADCIN ? How to do this and keeping average of 10 readings ?
Bookmarks