8 output PWM

Discuss PIC and electronic related things

Moderators: David Barker, Jerry Messina

Jerry Messina
Swordfish Developer
Posts: 1471
Joined: Fri Jan 30, 2009 6:27 pm
Location: US

Post by Jerry Messina » Wed May 12, 2010 10:37 am

Richard,

I don't know what the problem is with not being able to compile it at home...it's pretty simple, and doesn't need any addt'l files.
What version of SF are you using, and can you compile anything? Do you get any error messages?
I've not tried SF on win7, so I don't know if there's any issues there or not.

If your device and config settings work on other projects with the milennium board, two things come to mind...

Make sure the watchdog is disabled (add WDT = OFF to the config),
and you must set the output port #option BEFORE you include the file...

Code: Select all

#option   _PWM_OUTPUT_PORT = PORTD
  Include "spwm.bas"

See if that helps any.

Jerry

richardb
Posts: 309
Joined: Tue Oct 03, 2006 8:54 pm

Post by richardb » Wed May 12, 2010 11:25 am

I'll try again on my home pc, and post the exact error message.


:oops:
" you must set the output port #option BEFORE you include the file... "
oddly i first tried without the option and it didnt work either, so i thought i'd try a different port just incase.

it gets stranger..

i hadn't checked in the code but i thought hey won't hurt and i trissed all the port to 255 and it seemed to start working a bit.

although only 50% on b.7 and a short pulse(13.8us) on port b.0 all the other ports are 0

withought setting a value was i right to expect the op to be50% on all 8pins??
Hmmm..

Jerry Messina
Swordfish Developer
Posts: 1471
Joined: Fri Jan 30, 2009 6:27 pm
Location: US

Post by Jerry Messina » Wed May 12, 2010 11:34 am

What you were seeing is correct (output on b.0 and b.7) if the ENABLE_PWM_DEBUG flag is true. In addition to setting a bit for monitoring purposes, this flag changes the default settings in the init() sub. For 'normal' operation set it false, or comment out the code in init().

Code: Select all

// select or deselect ISR Timing Debugging
#define ENABLE_PWM_DEBUG = false

richardb
Posts: 309
Joined: Tue Oct 03, 2006 8:54 pm

Post by richardb » Wed May 12, 2010 11:59 am

OK i didn't notice that it was set to debug by default thanks again :)

It seems to work fine, i will have a play around with this further, to see how other isr routins play along with it.

Rich
Hmmm..

Post Reply