Thanks!!! BTW, I am trying to execute the code supplied in the PICBasic manual, but it doesn't seem to work.
This is the code in the manual.
B0 Var Byte
scale Var Byte
For scale = 1 To 255
POT 0, scale, B0
If (B0 > 253) Then calibrated
Next scale
Serout 2,0,[" Increase R or C.", 10,13]
Stop
calibrated:
Serout 2,0,[" Scale= ",# scale, 10,13]
This is my modified code:
B0 var byte
scale var byte
LED var PORTB.1
Potpin var PORTB.2
for scale = 1 to 255
LCDout $FE, 1, "calibrating", $FE, $C0, "Scale=", DEC scale, "B0=", DEC B0
pot Potpin, scale, B0
If (B0 > 253) then calibrated
next scale
Lcdout $FE, 1, "Increase R or C"
stop
calibrated:
lcdout $FE, 1, "Scale=", scale
As you can see, I have the pot connected to PORTB2.
When I run the code, I can see the scale and B0 incrementing on the LCD, however, before B0 or scale reaches 255 it starts over from scale=0 & B0=0.
Anyone have experience with this???
I know it's possible to do this manually but I would like to do it with automation because I will need to calibrate the scale for several different pots in the future. Thanks!!!




Bookmarks