PDA

View Full Version : Multiple Pot Commands



Forkosh
- 15th October 2007, 01:05
The micro I use is the PIC16F685
Using the pot command in PIC BASIC I was able to get an 8 bit reading of the resistance of two sensors. When I tried to do this with 3 sensors I was only able to get readings from two of them.

IN MY PROGRAM V3 WILL NEVER GIVE A READING TO MY LCD!


Why is it that I can get readings from only two lines and then the third one gives me 0 all the time. I tried separately and they all worked but whenever I did three together, one was always not working. Any idea why? I'm thinking its something to do with the capacitor


Here is my program:

v1 var byte
v2 var byte
v3 var byte
pause 1000 'Allow time for LCD display
main:
pot portb.6,255,v1 'Read resistance of CdS #1 photocell
pot portb.5,255,v2 'Read resistance of CdS #2 photocell

pot portb.7,255,v3 'Read resistance of CdS #2 photocell
'Display information
serout portb.4,6,[$fe,$01] 'lear the screen
Serout portb.4,6, [27, 42, 128] ' set screen to half brightness
pause 25
serout portb.4, 6, ["S.1 S.2 S.3 "]' Display this on LCD

serout portb.4,6,[$fe,$C0] 'Move to line 2
pause 5

serout portb.4,6,[#v1, 6]
serout portb.4,6,[" ",#v2, 6]
serout portb.4,6,[" ",#v3, 6] ' Display reading in decimal format

pause 100
goto main