PDA

View Full Version : question of the day



scorpion
- 24th November 2004, 17:14
a bit of history...
I built a small board with two push buttons, two pots, and two hall effect switches, 4 leds and 4 pwm - analog converters.
it also has a icd port and icp port that connects the the epic programmer. I am making this to try out programs before i make any boards.

now for the problem...
i would like to have.......8... yes 8 pwm outputs. the chances are that I will never use all 8. typically 4 max, but I would like to have the option if possible.

and what I need to know...
could anyone suggest some type of flow chart that will allow me to use the interrupts from tmr1 and tmr2 to create all 8 channels of pwm.

the frequencies will be: Digital output: 33Hz, 100Hz, or 200Hz
Analog output:3kHz

the frequencies will be set in the program.

mister_e
- 24th November 2004, 17:53
will not be so easy to do... do you want to set them with different frequency working at the same time and also be able to play with all frequency duty cycles???

scorpion
- 24th November 2004, 17:55
the analog will always be 3k and the digital will be one of the three. so there will be a max of 2 freqs at any time.
thanks for any help you can provide

mister_e
- 24th November 2004, 18:58
o.k so

2 frequency, 1 switchable, 1 fix
8 outputs max


i figure you want to be able to vary each output duty cycle???

let me know

scorpion
- 24th November 2004, 19:15
thats right
i have made 2 functions. the first is a direct maped output from one of the pots or hall effect push buttons. there is also a function to sum the two pots or two halls.
... lets go 4 pwm outs max... should make things easier and i dont think i will need more in the foreseeable future.
thanks again
-Garett

mister_e
- 24th November 2004, 19:20
which PIC are you planning to use for this ???

scorpion
- 24th November 2004, 19:45
sorry i thought i posted that
16f873a

scorpion
- 26th November 2004, 16:16
here is my plan.
i would apreciate any input.
I will use one timer for the 3khz pwm. this will interupt at 300khz as 1% adjust will be enough resolution for me. then I will count the interupts and set the bits as necessary.
this means that I will have a interrupt every 3.33 us.

one question that I have is: at a clock freq of 20Mhz will this interupt every 3us bog down the rest of my program.

I will use the same strategy for the other pwm freqs.

another question: with two sources of interupts is it possible that if one interrupt comes while im processing another will it throw off my count.

or.... can(should) I use the 3.33us for all of my pwm channels?

thanks
-Garett