Have you considered doing this in assembly??
Have you considered doing this in assembly??
Dwight
These PIC's are like intricate puzzles just waiting for one to discover their secrets and MASTER their capabilities.
It's same thing in ASM.
ASM
tavukaASM:
BSF PORTA,2
BCF PORTAM2
BSF PORTA,4
BCF PORTA,4
GOTO tavukaASM
ENDASM
That is ASM code equivalent of his PBP code.
Still same situation....
Last edited by pedja089; - 3rd February 2015 at 21:09.
Would it be easier to do this with PWM module? With 32MHz you can reach 4MHz output frequency and accurate duty cycle.
I think these PIC's have just one PWM module. If that is not enough, then select other which have more PWM outputs.
At least, trials can be run with your current PIC's.
Last edited by Gusse; - 3rd February 2015 at 21:50.
Well, I asked that before...
I use 2 channels as you can see from scope, and I need to have adjustable dead time between outputs, to avoid short circuit. Is it possible to synchronise 2 PWM generators in that way?
I think that you will not be able to do phase shift (delay) between 2 PWM outputs in same PIC. With 2 PIC's this might bee possible.
If your system is so time critical that GOTO-command will generate problems then how you will monitor and adjust outputs?
Therefore I don't see any other options than using HW modules (PWM) and PIC code just monitor and control HW module(s).
With another pic, it can be done easy.
PIC18F14K22 have everything what you need:
Enhanced Capture/Compare/PWM (ECCP)
module:
- One, two or four PWM outputs
- Selectable polarity
- Programmable dead time
- Auto-shutdown and Auto-restart
- PWM output steering control
And all that controlled from comparators outputs.
If comparator output is low or high(selectable) pwm outpu can go to some state, high or low.
You can turn on/off hysteresis on comparators, etc...
Just read this 404 pages and you will know everything you need![]()
Another guess is that PIC18F14K22 won't be available in SOIC-8....![]()
Bookmarks