Why do I get a Syntax Error for the ELSE row?
loop2:
ADCIN 0, involt 'Read channel 0 to involt
PAUSE 100 'Wait 100 ms
IF involt >= 128 THEN GPIO.5 = 0
ELSE GPIO.5 = 1 ENDIF
GOTO loop2
END
PIC12F683 & PBP2.60
Why do I get a Syntax Error for the ELSE row?
loop2:
ADCIN 0, involt 'Read channel 0 to involt
PAUSE 100 'Wait 100 ms
IF involt >= 128 THEN GPIO.5 = 0
ELSE GPIO.5 = 1 ENDIF
GOTO loop2
END
PIC12F683 & PBP2.60
ELSE likes to be on a line of it's own.
Try
Code:loop2: ADCIN 0, involt 'Read channel 0 to involt PAUSE 100 'Wait 100 ms IF involt >= 128 THEN GPIO.5 = 0 ELSE GPIO.5 = 1 ENDIF GOTO loop2 END
Dave
Always wear safety glasses while programming.
************************************************** ***********************
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 " !!!
*****************************************
IF xxx THEN label
can be on one line because it act as a GOTO.
If not a label the THEN needs to be on a second line.
YUP, I messed up on my first post. Was not paying attention...
Dave
Always wear safety glasses while programming.
************************************************** ***********************
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 " !!!
*****************************************
There is a lot to think of......
But my very first program works just fine now!
One LED blinks every second and goes on continously after 9 minutes.
Another LED goes on when the voltage drops below 2.5 Volts....
B.t.w. I understand that there is a calibration factor inside each PIC that shall/could be used to get better clock accuracy.
Is the PBP using this automatically?
My 9 minute timer is accurate within 1 second (two different PICs) just as it is.
The calibration on the chip seems to be pretty good from the factory, normally.
PBP does not use it nor control the speed of the chip with the exception of OSCON. PBP code can be used to change the factory setting if needed.
Dave
Always wear safety glasses while programming.
No ... PBP doesn't use it automatically ...
the 683 has a factory calibration value you can't access to. you just have the OSCTUNE register to modify somewhat the osc speed, if you need it.
in INTOSC_HF mode only ....
factory cal is supposed to be good ... but you can trim to your needs ( I did it with a 16F88, to get exact R/C timings with internal OSC . trimming was less than 10 units ... )
@ contrario, The 629 and 675 ( i.e. ) need to fetch the cal data and store it @ poweron ... achieved through DEFINE OSCCAL_1K 1
just read relevant µChip datasheets , OSC Chapter , to see how it works, then PBP manual firsts pages ...
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