PDA

View Full Version : DT Multiple Software PWM and 18F2321 issue



microuser
- 19th December 2012, 21:36
Hello, I'm trying to let SPWM_INT.bas work with a pic18F2321. Before ask here I tested it on a 18F1320 and it work perfectly. OSC HS 20MHz
take this as example:


for i=0 to 250
LED=i 'dimm led by use pwm
PAUSE 10
high portb.0 'switch on a led
for i=250 to 0 step -1
LED=i
PAUSE 10
next i
low portb.0

The problem I encountered is that with 18F2321 LED on portb.0 don't switch on/off while pwm dimming works fine. To be more precise it switch on for very few ms then switch off. Another strange thing is that it seems I can't set SPWM_FREQ > 100 because I receive all these errors:
error Current SPWM configuration is INVALID - NO time left between interrupts
messg 1 - Try using a "SPWM_FREQ" lower than SPWM_FREQ Hz
messg 2 - OR, Try using a "SPWM_RES" lower than SPWM_RES
messg 3 - OR, Use a faster "OSC" than OSC Mhz
messg 4 - OR, Use fewer SPWM channels
Probably there are some changes to do, maybe in DT_INTS-18.bas.
can someone help me?
Regards

microuser
- 20th December 2012, 08:23
Solved!
I just rececked it and I missed to add ADCON1=$0F :D
thx