Hi lokanand,
I don't think there are any specific values for SCALE - it's sort of a try it and see kind of thing. There is a bit of code in the PBP manual for calibrating the SCALE value - give it a try.
Arch
Hi lokanand,
I don't think there are any specific values for SCALE - it's sort of a try it and see kind of thing. There is a bit of code in the PBP manual for calibrating the SCALE value - give it a try.
Arch
Also, 200k pot with 100n is not a good combination.
As Archilochus said, check the manual.
Play with 50k, 5k and 10n, 100n.
-----------------------------------
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
I favour 100n for the POT Capacitor (same one's I use for decoupling sprinkled around the PCB - saves loading another component reel onto the board stuffing machine). With a 10K variable, the scale value is about 95.
yes
100 nF = 0.1 uF
Paul Borgmeier
Salt Lake City, UT
USA
__________________
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!!!
At first glance, before other possibilities, "then calibrated" will work like GOTO; not like GOSUB.
I would suggest that you use "calibrated" as a subroutine with a "return" and change all "then calibrated" to "then GOSUB calibrated".
Then we can talk about the rest of the code.
------------------------
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
Bookmarks