PulseOut Vs High Low Command

crazynight

Senior Member
Which would be better quicker to process

High Starttimer
Low Starttimer

Or

PulseOut Starttimer,10

Probably no right or wrong answer; although I guess the pulseout allows the picaxe to move on to the next line quicker and it also takes up less memory.
 

hippy

Technical Support
Staff member
The PULSOUT has fewer tokens to process so should be quicker to parse and process and take less memory but how long the PULSOUT pulse generated is would affect things.
 

crazynight

Senior Member
the pulseout is currently 10 but as I am currently running at 32MHz thats only 1.25us (the external timer seems happy with that). The pulseout will be they way I go, looks neater; says what I want the program needs to do and less chance of me leaving the pin high by mistake. Low Starttimer implies stop timer but thats just my daft brain I guess.
 

westaust55

Moderator
The actual pulse will be approx 12.5 usec however there is also the time to fetch and interpret then complete the command which will add of the order of 30 usec to the total execution time at 32 MHz.

The HiGH and then LOW commands may take of the order of 60 usec Total time to execute at 32 MHz.
 
Last edited:

Goeytex

Senior Member
If you have a scope you can see and measure the effects of execution time by putting several pulsout commands back to back in code. The gap between the pulses will represent the overhead.

Code:
setfreq M32

do
     pulsout c.2,10
     pulsout c.2,10
     pulsout c.2,10
     pulsout c.2,10
     pulsout c.2,10
     pulsout c.2,10
loop
My scope shows the pulse width to be 14.5 us and the space between pulses to be 73.6 us
 
Last edited:

hippy

Technical Support
Staff member
My scope shows the pulse width to be 14.5 us and the space between pulses to be 73.6 us
Testing the same code with an 08M2 I get 13us pulses and spaces between pulses of 57us to 61us which is probably a result of memory placement. A total execution time of 70us to 74us.

The longer gap in the image is the hidden GOTO of the DO:LOOP jump.

For HIGH and LOW I measure around 40us for each, a total execution time of around 80us.
 

Attachments

PieM

Senior Member
On a 14M2 Ver 6.A, on my logic analyser I get a 15 µs pulse width after 79 µs and 104 µs for High + Low @ 32MHz
 

hippy

Technical Support
Staff member
@PieM : Virtually the same here on 14M2 6.A. That is probably down to the non 08M2's having to do more work to update the I/O pins which are spread across multiple PIC I/O ports.
 
Top