How is the LED connected to the PIC?
Robert
EDIT: And what did you use as CONFIG and TRIS settings?
How is the LED connected to the PIC?
Robert
EDIT: And what did you use as CONFIG and TRIS settings?
positive end is connected to the pin, negative end is grounded
Code:@ __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_OFF & _MCLRE_OFF & _BODEN_OFF & _LVP_OFF Define OSC 4 LED4 VAR PortA.1 button VAR PortA.2 CMCON = 7 VRCON = 0 PortA=0 PortB = 000100 T1CON = 000011 TRISA = 000100 TRISB = 000000
and this code works though, which is really confusing me
Code:new: if button=0 then led4=1 pause 500 led4=0 endif goto new
Totally wild guess, confirm your programmer is setting the low voltage programming fuse properly:
http://www.picbasic.co.uk/forum/show...ht=#post113491
(still looking at datasheet)
Robert
EDIT: Darn, I remember reading another thread that was missing one more config to disable analog, can't find it now.
It must be something with the PWM, either config or syntax.
What if you use variables like this?
http://www.picbasic.co.uk/forum/show...ht=16f628a+pwm
Robert
Try this code insted
If you read the PBP Manual you will see that the PWM command after execution turn the pin input.Code:STARTMAIN: if button=0 then For Duty=0 to 255 PWM LED4,Duty,Cycle Next high led4 pause 1000 For Duty=255 to 0 Step -1 PWM LED4,Duty,Cycle Next endif low led4 GOTO STARTMAIN
Last edited by gadelhas; - 3rd May 2012 at 04:24.
Thanks and Regards;
Gadelhas
Did you declare the variable CYCLE? Did you give a value to such a variable?
If not then PWM command will not work.
Cheers
Al.
All progress began with an idea
not interesting, it is explained in the manual...
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks