ok, I can use 18F6220, so this is the new code:Originally Posted by rhino
adcon0=1
lectura var byte
trisa=%00000111
lectura=0
mainloop:
Adcin 0, lectura
serout porta.3,6,[#lectura,"."]
Adcin 1, lectura
serout porta.3,6,[#lectura,"."]
Adcin 2, lectura
serout porta.3,6,[#lectura,"."]
serout porta.3,6,[10,13]
Goto mainloop
End
Im trying to read 3 potentiometers on ra0/1/2
I use serouts to know if I read something
[edit] this code is working I missed the # in the serout
now I want to use the read value to set HPWM
so I added this
DEFINE OSC 4
adcon0=1
Rval var byte
Gval var byte
Bval var byte
trisa=%00000111
mainloop:
Adcin 0, Rval
serout porta.3,2,[#Rval,"."]
Adcin 1, Gval
serout porta.3,2,[#Gval,"."]
Adcin 2, Bval
serout porta.3,2,[#Bval,"."]
serout porta.3,2,[10,13]
hpwm 3,Rval,300
hpwm 4,Gval,300
hpwm 5,Bval,300
Goto mainloop
End
no luck again![]()
Bookmarks