In a message dated 7/7/00 12:15:50 AM Central Daylight Time, baker_bai@c... writes:
> I am wandering how BS2 handle external interrupt ? polling ?
Yes, you must use polling and if your interrupt event is short, you should
probably use a one-shot to stretch it out so that the polling cycle has an
opportunity to pick it up.
As Jon pointed out, you usually poll for external events. However, I have
heard of some people using an external event to reset the Stamp. They also
have the external event present on an input pin. So your code might look
something like this:
if in1=0 then handle_interrupt
main:
' do normal stuff
end
handle_interrupt:
' interrupt code here
goto ret_from_interrupt
There are a few problems with this:
1) You have to know the interrupt will not be active on a real reset (this
could be done with external circuitry allowing you to keep the "interrupt"
disabled.
2) The pulse must be long enough to trigger a reset and stay low long enough
to sense (or you could use say a flip flop and a differentiator to trigger
the reset).
3) You have to have some place you can always return to since the reset
leaves no trace of where you were.
Some programs can work like this and others can't.
Another idea is to use a PAK-VII pulse input coprocessor to count pulses
that arrive and then poll them at your discretion. The PAK also measures the
pulse widths, but that isn't as important in this case.
Comments
>I am wandering how BS2 handle external interrupt ?
They don't - sorry.
> poll ing ?
That works, but make sure you don't overrun the input frequency/time frame.
>Thank u for your help
You're welcome
>Baker
Regards,
Bruce Bates
baker_bai@c... writes:
> I am wandering how BS2 handle external interrupt ? polling ?
Yes, you must use polling and if your interrupt event is short, you should
probably use a one-shot to stretch it out so that the polling cycle has an
opportunity to pick it up.
heard of some people using an external event to reset the Stamp. They also
have the external event present on an input pin. So your code might look
something like this:
if in1=0 then handle_interrupt
main:
' do normal stuff
end
handle_interrupt:
' interrupt code here
goto ret_from_interrupt
There are a few problems with this:
1) You have to know the interrupt will not be active on a real reset (this
could be done with external circuitry allowing you to keep the "interrupt"
disabled.
2) The pulse must be long enough to trigger a reset and stay low long enough
to sense (or you could use say a flip flop and a differentiator to trigger
the reset).
3) You have to have some place you can always return to since the reset
leaves no trace of where you were.
Some programs can work like this and others can't.
Another idea is to use a PAK-VII pulse input coprocessor to count pulses
that arrive and then poll them at your discretion. The PAK also measures the
pulse widths, but that isn't as important in this case.
Regards,
Al Williams
AWC
*Pulse input and output with the PAK-VII and PAK-VIII coprocessors:
http://www.al-williams.com/awce
>
Original Message
> From: baker_bai@c... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=nF3-2VzPkjXJVwnqjzEzYPxpZtMVvoDpA-u_qaUr86C3kxUIbh8slFG7m6PMCkaGGa8_Tqqo-kguUpo]baker_bai@c...[/urlOn Behalf Of
> baker_bai@c...
> Sent: Wednesday, July 05, 2000 11:53 PM
> To: basicstamps@egroups.com
> Subject: [noparse][[/noparse]basicstamps] BS2 handle interrupt ?
>
>
> I am wandering how BS2 handle external interrupt ? poll ing ?
>
> Thank u for your help
>
> Baker
>
>
>
>