How about if you toggle pin in loop?
Code:HEAD: TOGGLE PORTA.2 GOTO HEAD
How about if you toggle pin in loop?
Code:HEAD: TOGGLE PORTA.2 GOTO HEAD
I don't want to "lengthen" time, because it significantly lowers the frequency, from about 1mhz to 200khz, which is bad. I've found a partial workaround - I've inserted
16 times, so now having about 90% duty cycle, which is ok.Code:PORTA.2=1 PORTA.2=0 PORTA.4=1 PORTA.4=0
But, is there a way to fix this otherwise?
Try 18 series PIC, or 24 series?
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).
Bookmarks