Instruction execution times
Archiver
Posts: 46,084
Can anyone please tell me how I can calculate how long before the
stamp is ready to "see" the next pulse transition of 0-1-0 ?
I'm timing the acceleration of a drum and have a 50% duty cycle.
I.e.
pulse on for half a revolution and off for half a revolution. The
program times the first 0-1-0 transition and stores the value in the
variable "Accel". Then it immediately (I wish) waits to time
the next
0-1-0 transition. It stores this second value in the
variable "Accel1". These variables are then transmitted via
RS-232 to
a PC.
I know the "average" instruction execution time is 4ms but
are
these "average" instructions? I need to know how long it
takes the
BS2 to be ready for the next pulse transition so I can calculate the
maximum speed of the drum to guarantee that the second value comes
from the very next revolution. At the moment I've allowed 6ms
which
gives me a maximum speed of 5000 rpm @ 1 pulse per revolution (12ms
per rev, 6ms per half rev). Can I go faster?
The delay for transmission of the data and returning to the start of
the loop is not so important. What is important is the delay between
the two sample instructions.
Extract from program.
Some constants have been declared at the start of the program.
DrumIn = pin used for drum pulses
Drum_HiLo = 0-1-0 or 1-0-1 pulse transitions
Drum_Only:
pulsin DrumIn,Drum_HiLo,Accel 'Drum Pulse on Pin
DrumIn
pulsin DrumIn,Drum_HiLo,Accel1 'Drum Pulse on Pin
DrumIn
serout Tx,comm,[noparse][[/noparse]dec Accel,",",dec Accel1,",0000",cr]
If Accel < Accel1 then Ending_Run
goto Drum_only
Thank you,
Stephen Muller
Electricalmanger@c...
stamp is ready to "see" the next pulse transition of 0-1-0 ?
I'm timing the acceleration of a drum and have a 50% duty cycle.
I.e.
pulse on for half a revolution and off for half a revolution. The
program times the first 0-1-0 transition and stores the value in the
variable "Accel". Then it immediately (I wish) waits to time
the next
0-1-0 transition. It stores this second value in the
variable "Accel1". These variables are then transmitted via
RS-232 to
a PC.
I know the "average" instruction execution time is 4ms but
are
these "average" instructions? I need to know how long it
takes the
BS2 to be ready for the next pulse transition so I can calculate the
maximum speed of the drum to guarantee that the second value comes
from the very next revolution. At the moment I've allowed 6ms
which
gives me a maximum speed of 5000 rpm @ 1 pulse per revolution (12ms
per rev, 6ms per half rev). Can I go faster?
The delay for transmission of the data and returning to the start of
the loop is not so important. What is important is the delay between
the two sample instructions.
Extract from program.
Some constants have been declared at the start of the program.
DrumIn = pin used for drum pulses
Drum_HiLo = 0-1-0 or 1-0-1 pulse transitions
Drum_Only:
pulsin DrumIn,Drum_HiLo,Accel 'Drum Pulse on Pin
DrumIn
pulsin DrumIn,Drum_HiLo,Accel1 'Drum Pulse on Pin
DrumIn
serout Tx,comm,[noparse][[/noparse]dec Accel,",",dec Accel1,",0000",cr]
If Accel < Accel1 then Ending_Run
goto Drum_only
Thank you,
Stephen Muller
Electricalmanger@c...
Comments
>
> I know the "average" instruction execution time is 4ms but
> are
> these "average" instructions? I need to know how long it
> takes the
> BS2 to be ready for the next pulse transition so I can calculate
the
> maximum speed of the drum to guarantee that the second value comes
> from the very next revolution.
You never said which stamp you are using, but both the BS2 and BS2SX
are much faster than you stated. Not sure about the Stamp I, but
the BS2 is "rated" at about 4000 instr./sec which is not 4 ms, it
is .25 ms/instruction, the 2SX is about .1 ms/instruction.
Based on these values, you should be OK. But it would be easy enough
to write a test program to determine the exact value; in fact, I
think one of the list members has done this already - perhaps they
will give you a more precise answer.
Chuck
>
> You never said which stamp you are using, but both the BS2 and
BS2SX
> are much faster than you stated. Not sure about the Stamp I, but
> the BS2 is "rated" at about 4000 instr./sec which is not 4 ms, it
> is .25 ms/instruction, the 2SX is about .1 ms/instruction.
Well DUH - After reading my own note, I realized you did say BS2 in
there at one point. So my answer was right even if my eyes are bad.
Chuck
> Can anyone please tell me how I can calculate how long before the
> stamp is ready to "see" the next pulse transition of 0-1-0 ?
>
> I'm timing the acceleration of a drum and have a 50% duty cycle.
>...
Hi Stephen,
I have some BS2 timings posted at
<http://www.emesystems.com/BS2misc.htm#timing>
Specifically, the time to set up a pulsin command is near 240 microseconds.
Your program used the sequence,
> pulsin DrumIn,Drum_HiLo,Accel 'Drum Pulse on Pin DrumIn
> pulsin DrumIn,Drum_HiLo,Accel1 'Drum Pulse on Pin DrumIn
The 240 microseconds is the minimum time that must elapse between the end
of the pulse detected by the first pulsin, to the point where the second
pulsin is ready to detect the next transition.
-- Tracy Allen
Electronically Monitored Ecosystems
http://www.emesystems.com