Hi Laurent,
Welcome to the forum.
See if this previous series of posts from Melanie, mister_e and others, helps.
http://www.picbasic.co.uk/forum/showthread.php?p=14264
-Adam-
Hi Laurent,
Welcome to the forum.
See if this previous series of posts from Melanie, mister_e and others, helps.
http://www.picbasic.co.uk/forum/showthread.php?p=14264
-Adam-
Ohm it's not just a good idea... it's the LAW !
Thanks I've commented the Picbasic fuses in the include...
Fuses is ok but on compiling this code:
i receive many errors :Code:ASM CONFIG FOSC=HS ; Use HS oscillator (20MHZ here) CONFIG BOR=OFF ; Brown out reset ON CONFIG WDT=ON ; Watch dog timer ON CONFIG LVP=OFF ; Low Voltage programming OFF CONFIG DEBUG=OFF ; Background debugger OFF ENDASM led VAR PORTB.5 steps VAR WORD cycles CON 2 ' Change limits for steps to play around 0 or 100% brightness ' Change steps for different duration of ramps ' Works good even with high brightness LEDs, harder to control linearly fade: up: For steps=0 TO 255 PWM led,steps,cycles Next High led Pause 2500 down: For steps=255 TO 1 STEP -1 PWM led,steps,cycles Next Low led Pause 2500 GoTo fade End
maybe it's the code that is faulty or it's something else ?
Could you show me a code that will ABSOLUTELY compile (and tested to work), ex: blink a led so i can start to debug the previous code , to see if its my compile that freaks out or it just a simple issue....
Many thanks!
Have a nice week!
Best Regards,
Laurent
I just went through the same problems. See the thread below post#6 regarding editing the .inc file
http://www.picbasic.co.uk/forum/show...ighlight=fuses
Best Regards,
Kurt A. Kroh
KrohTech
“Goodbye and thanks for all the fish”
I never did get this method to work. I use this method of setting the fuses on my 18F2410:Code:ASM CONFIG FOSC=HS ; Use HS oscillator (20MHZ here) CONFIG BOR=OFF ; Brown out reset ON CONFIG WDT=ON ; Watch dog timer ON CONFIG LVP=OFF ; Low Voltage programming OFF CONFIG DEBUG=OFF ; Background debugger OFF ENDASM
Code:@ __CONFIG _CONFIG1H, _OSC_INTIO67_1H @ __CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H @ __CONFIG _CONFIG3H, _MCLRE_OFF_3H & _PBADEN_OFF_3H @ __CONFIG _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
Last edited by krohtech; - 8th February 2008 at 21:27.
Best Regards,
Kurt A. Kroh
KrohTech
“Goodbye and thanks for all the fish”
Refer to post #20 in the above thread link. PBP still does not support the new style config directive without the double underscore.
You need to do it the old fashioned way as indicated in the above post by krohtech.
Thanks ! You fix all my problems !
However i have another question about this code and the function PWM...
How to have multiple pwms output ?
take a look to the following code
What i want is to fade ON all led each by each while keeping them ONCode:@ __CONFIG _CONFIG1L, _PLLDIV_3_1L & _CPUDIV_OSC1_PLL2_1L @ __CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H @ __CONFIG _CONFIG2L, _VREGEN_OFF_2L @ __CONFIG _CONFIG2H, _WDT_OFF_2H @ __CONFIG _CONFIG3H, _MCLRE_OFF_3H & _PBADEN_OFF_3H @ __CONFIG _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L & _DEBUG_OFF_4L DEFINE OSC 48 led VAR PORTD 'changed WORD for BYTE ... using 32bit int for 8bit value is taking more cycle to do operation to it step0 VAR byte step1 VAR byte step2 VAR byte step3 VAR byte step4 VAR byte step5 VAR byte step6 VAR byte step7 VAR byte cycles CON 2 ' Change limits for steps to play around 0 or 100% brightness ' Change steps for different duration of ramps ' Works good even with high brightness LEDs, harder to control linearly fade: For step0=0 TO 100 PWM led.0,step0,cycles Next For step1=0 TO 100 PWM led.1,step1,cycles Next For step2=0 TO 100 PWM led.2,step2,cycles Next For step3=0 TO 100 PWM led.3,step3,cycles Next For step4=0 TO 100 PWM led.4,step4,cycles Next For step5=0 TO 100 PWM led.5,step5,cycles Next For step6=0 TO 100 PWM led.6,step6,cycles Next For step7=0 TO 100 PWM led.7,step7,cycles Next For step0=100 TO 1 STEP -1 PWM led.0,step0,cycles Next For step1=100 TO 1 STEP -1 PWM led.1,step1,cycles Next For step2=100 TO 1 STEP -1 PWM led.2,step2,cycles Next For step3=100 TO 1 STEP -1 PWM led.3,step3,cycles Next For step4=100 TO 1 STEP -1 PWM led.4,step4,cycles Next For step5=100 TO 1 STEP -1 PWM led.5,step5,cycles Next For step6=100 TO 1 STEP -1 PWM led.6,step6,cycles Next For step7=100 TO 1 STEP -1 PWM led.7,step7,cycles Next GoTo fade End
then after Turn them OFF (while fading) one by one
The code only do pwm on 1 led at time only :S
Any clues ?
oh btw, searching through the forum is PITA ... it doesn't take words like PWM , because it's too short ... hence rendering the search practically useless for "Multiple PWM"
Cheers,
Best Regards,
Laurent
PWM is a blocking command. You can only do one PWM at any one time, PBP only has one 'hand' available to do PWM. You have to write good interrupt driven software to do multiple channels. Well, you don't HAVE to do anything. There are many ways to do multiple channel PWM, software based PWM...
Look in the FAQ's...oh btw, searching through the forum is PITA ... it doesn't take words like PWM , because it's too short ... hence rendering the search practically useless for "Multiple PWM"
I use Darrel’s Multi SPWM code to get 8 ch of PWM at 100 Hz. Works GREAT (((thanks Darrel)))
See:
http://www.pbpgroup.com/modules/wfse...p?articleid=12
Best Regards,
Kurt A. Kroh
KrohTech
“Goodbye and thanks for all the fish”
Bookmarks