TRIS is taken care of in the HIGH/LOW commands.
The vars will need defined. The OP had that.
DEFINE the OSC and set the configs someplace. Figured the OP had those too. Seemed the code was running, just not running as expected.
TRIS is taken care of in the HIGH/LOW commands.
The vars will need defined. The OP had that.
DEFINE the OSC and set the configs someplace. Figured the OP had those too. Seemed the code was running, just not running as expected.
Dave
Always wear safety glasses while programming.
DOH!!
That chip has an ADC I think.
Add
ANSEL=%00000000
http://www.picbasic.co.uk/forum/showthread.php?t=561
Dave
Always wear safety glasses while programming.
Is If_then a goto or gosub? I am used to it being a goto unless gosub is called out. But I clearly haven't read my PBP book yet. - sorry
If goto then return will break the code - yes?
-Bert
The glass is not half full or half empty, Its twice as big as needed for the job!
http://foamcasualty.com/ - Warbird R/C scratch building with foam!
Bert,
You are correct. Thanks for catching that.
Dave
Always wear safety glasses while programming.
so please confirm:
test should have "goto check" instead of "return"?
-Bert
The glass is not half full or half empty, Its twice as big as needed for the job!
http://foamcasualty.com/ - Warbird R/C scratch building with foam!
Yes
that pretty much does it for me today. Too many DOHS.
Dave
Always wear safety glasses while programming.
-Bert
The glass is not half full or half empty, Its twice as big as needed for the job!
http://foamcasualty.com/ - Warbird R/C scratch building with foam!
hi guys,
thanks all for your help, but no luck so far, before the last suggested changes, the code will just stay on forever.
Now, with the ANSEL part, just wont compile, it says "syntax error".
Removing the ansel part, it compiles, i run it and after the boton is pressed it jumps direct to the last part of the code (off_led/off_mosfet)
This is my actual code:
Any sugestions?Code:cnt VAR BYTE boton VAR GPIO.2 mosfet VAR GPIO.1 CMCON = 7 'Ports Output mosfet Input boton cnt=0 CHECK: high mosfet IF boton = 0 THEN TEST GOTO CHECK TEST: cnt = cnt + 1 IF cnt = 3 THEN OFF_MOSFET GOTO CHECK OFF_MOSFET: cnt = 0 low mosfet pause 1000 GOTO CHECK end
Much appreciated, and thanks again.
Nope, I made one of my many mistakes. I was planning to give the OP a basic working code like I just did for something to "start" with. Then if needed try to do a little "teaching".
Seems like a simple operation, but to make it work well some sort of de-bouncing and maybe an interrupt will be needed.
Dave
Always wear safety glasses while programming.
Bookmarks