a Word about Bytes ...
[QUOTE=Eriswerks]I'm trying to get down the basics of PIC servo control, and not having much luck. I'm using a 16F690 and trying to get some kind of meaningful movement out of my servo. However, the only thing my servo will do is move to one extreme of its range and sit there, perhaps scornfully.
The offending code is:
@ DEVICE MCLR_OFF,WDT_OFF,PROTECT_OFF
DEFINE OSC 8
servo var PORTC.5
i var byte
loop:
for i = 200 to 400
low servo
pulsout servo,i
pause 18
next i
goto loop
hi,Eris
@ 8 Mhz, pulsout resolution is 5µS ( 10µS *4 / F.Mhz)
so, correct for that.
for i = 200 to 400 means i should not be a byte ( i max = 255 !!! )
so, what's happening ??? i value goes from 200 to 255 then ... back to 0 , out of the for - next loop !!! program ends.
just change i for a WORD !!!
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Bookmarks