hi there
can you tell me from where you got the syntax " PAUSE ..." in your pgm !
I am using C language and dont know such a syntax
hi there
can you tell me from where you got the syntax " PAUSE ..." in your pgm !
I am using C language and dont know such a syntax
Loop is one of those reserved words in PBP3 and I'm pretty sure in earlier versions. It really fouls things up.
If your inputs and outputs are either high or low you want to set all your pins to digital with analog select register. i.e ansel=0. Otherwise the pins get sensed in the middle and often never toggle.
if you want gpio.0 to be low then I think you need low gpio.0 not just low 0.
I've never used PULSOUT before but I'm certain you need to spell out gpio.0 and not just 0
Most people recommend a CLEAR at beginning and a END at end.
I'd also recommend you turn on capitalization of commands in PBP. It helps me recognize some of the reserved words and commands.
If you'll post schematic I'll run it on simulator if you like.
Code:clear Define OSCCAL_1K 1 CMCON=7 ' disable analog comparator ansel=0 TRISIO=111110 ' set GPIO as output ' others as input i VAR BYTE ' commented out low 0 low gpio.0 pause 100 ' commented outloop: main: if GPIO.1=1 then turn1 if GPIO.2=1 then turn2 ' commented out goto loop goto main turn1: for i=0 to 5 ' comment out pulsout 0, 147 pulsout gpio.0, 147 pause 20 next i ' commented out goto loop goto main turn2: for i=0 to 5 ' comment out pulsout 0, 152 pulsout gpio.0, 152 pause 20 next i 'commented out goto loop goto main end
This one should work ... ( ISIS tells so ...)
AlainCode:'**************************************************************** '* Name : SERVOTEST0 * '* Author : [select VIEW...EDITOR OPTIONS] * '* Notice : Copyright (c) 2013 [select VIEW...EDITOR OPTIONS] * '* : All Rights Reserved * '* Date : 10/02/2013 * '* Version : 1.0 * '* Notes : 12F629 @4 Mhz internal * '* : * '**************************************************************** #CONFIG __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _CP_OFF & _MCLRE_OFF #ENDCONFIG Servo var GPIO.0 Right var GPIO.1 Left var GPIO.2 Define OSCCAL_1K 1 CMCON =7 ' disable analog comparator ' ansel=0 NO ANSEL with the '629 !!!... TRISIO = %11111110 ' set GPIO as output ' others as input i VAR BYTE clear low Servo pause 100 ' commented outloop: main: while 1 IF Right THEN pulsout Servo, 147 ELSEIF Left THEN PULSOUT Servo, 152 ELSE PULSOUT Servo, 150 ' Center/stop ( ? ) if no button pushed ... ENDIF Pause 19 WEND end
Last edited by Acetronics2; - 10th February 2013 at 15:12.
************************************************** ***********************
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