Hello.
I need to generate a series (5000 pulses for example, but it might be 1000 pulses) with shortest duration possible. The code like this:
do works, but it has an issue - GOTO statement takes more time to execute, then simple port enable-disable, so pause between pulses is longer than pulse itself, which is not welcomed.Code:HEAD: PORTB.6=1 PORTB.6=0 GOTO HEAD
Of course, I can write
PORTB.6=1
PORTB.6=0
PORTB.6=1
PORTB.6=0
multiple times, but 5000 times?
Tried it on various MCU's on all of them, GOTO or DO-LOOP or FOR-NEXT or any other looping instruction takes more time. Any ideas how to solve this?
I come to partial solution like this:
In this code, @NOP statement lengthens the pulse itself, so it is equal to width of pause, but of course, overal frequency is reduced.Code:PIKO: PORTB.6=1 @NOP PORTB.6=0 GOTO PIKO
Currently using 16F1829 @ 32mhz, and I want to avoid usage of 18F or 24F family at all costs.





Bookmarks