is this LED flickering happen only with channel2 ? what about if you change the frequency?
is this LED flickering happen only with channel2 ? what about if you change the frequency?
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
hiya lads...
hmmmmm ch3 ie the one i couldnt get to work in the firsr place works 100% nice smooth dimming etc.. ch2 flickers like mad !! the code is the exact same for all 3 ch's with the exception of register names etc.
me thinks this is not possible...................... i have gone through everything here 10 times over.!!!
What happens if you enable only 1 channel at a time?
I.E. CCP1CON=0 : CCP3CON=0
Does channel 2 still flicker?
Are you sure it's not the circuit channel 2 is connected
to that's causing the flicker?
yet again tis me thats at fault.... many thanx to bruce for his code example. the mistake i was making was that i was calling the hpwm routine which seemed to be causing a conflict. instead i just wrote the duty val directly to the port ie portb.5=duty5 ... simple! lol this took many hours of hair loss and alcohol !!!!!!. only 1 teeny weeny prob left lol... i cant get the ch's to go to full off . they get to say 9% and stay there. so a faint glow is visible but apart from that everything is aok. dimming is as smooth as a babys ass and im a happy bunny.( irish saying).. many many thanks to bruce n the rest of u guys.. slainte...
thanx
oscar.
Im refloating this thread because I have a question:
I tried the example provided by Bruce succesfully, but now I want to use ON Interrupt on portb changes.
The problem I encounter is that CCP3 uses RB5 and the interrupt is triggered by changes in the portb.4 to portb.7
What can be done?
Thanks
Help us a litle bitPic model?
How bad/good it is if in the INT routine you test the PORTB and if it's just related to the HPWM, it goes out of there ?
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
SorryIm using the same pic as Bruce example: 16F767
but Im having more basic problems, when I wasnt able to run the program as desired I started to remove parts of it, and now I see it does not work at all, so I may be missing some register configuration.
Here is the header of my program:
As you can see very basic, and I dont even started with the pwm/interrupts stuff.Code:@ device pic16F767, wdt_on, intrc_osc_noclkout, mclr_off, protect_off trisb =%11000000 trisa =%00000001 cmcon =%00000111 'Comparators Off intcon =%10001000 'interrupts enable ; Set CCP modules to PWM mode CCP1CON = %00001100 ' Mode select = PWM CCP2CON = %00001100 ' Mode select = PWM CCP3CON = %00001100 ' Mode select = PWM PR2 = $20 ; Set period pie2.1=0 ;disable interrupts on CCP3 (I think this should work) ; Set TMR2 up for 1:1 prescale & turn it on T2CON = %00000100 ' TMR2 ON 1:1 prescale porta=0:portb=0:portc=0 pause 100 high porta.1 pause 200 low porta.1 pause 200 high porta.1 pause 200 low porta.1 end
I program the pic via ICSP and power it, it seems to run at turtle speed, the 200ms pause takes 28seconds...
What I am missing? Thanks
Bookmarks