Measure Pulse Width
Humanoido
Posts: 5,770
I have the Parallax Demo Board toggling pin 0 and want to measure the pulse width to determine the execution speed of a program (instructions per second). How to do this without an oscilloscope? Thanks in advance.
Comments
One cog can "watch" the I/O pins used by another cog because the INA register reflects the state of the I/O pin itself. Probably the easiest way would be to use one of the cog's counters to give you the number of system clocks while the specified input pin is high. The program in the cog would set up the counter and wait for the input pin to go from high to low. It would then read and reset the counter's PHS register and use that as the pulse width.
http://obex.parallax.com/objects/479/
I used frequency_counter for timing ZiCog execution once, worked well.
if you use the schmitt, make sure you put a .01 mfd cap across the power and ground pins of the chip. tie all unused inputs to ground. measure as you will, but external frequency meter is a good idea. 1/frequency gives you the time period.
if you are using leds for binary value outputs, use the windows accessory calculator for conversion, scientific mode.