Getting parallel data on BS2... newbie
Archiver
Posts: 46,084
Hi... I have a Clare 8870-01 DTMF decoder that I want to interface
with my BS2 for a application that does stuff based on dial-tones.
The 8870 takes a touch-tone tone in, and outputs a corresponding
binary code on 4 outputs (Q0-Q3). Also, a Valid-Tone pin (ESt) goes
High when a valid DTMF tone is detected. Eg, I press a 7 and I get a
0111 parallel output on Q0-3 and a 1 on ESt until I release the 7
button.
The 8870 part of the circuit is working great and I'm pleased. But
now I want my BS2 to make some use of this. I'm trying to write some
code that watches ESt, and when ESt is HIGH the stamp looks at Q0-Q3
and says, "Ok, I see a 0111... I will set key=7".
Can anyone offer a code sample, or maybe point me to a good resource
(I did RTFM, and I'm sure I can hack my way through it, but I'd like
to hear what the pros think).
Thanks a bunch!
with my BS2 for a application that does stuff based on dial-tones.
The 8870 takes a touch-tone tone in, and outputs a corresponding
binary code on 4 outputs (Q0-Q3). Also, a Valid-Tone pin (ESt) goes
High when a valid DTMF tone is detected. Eg, I press a 7 and I get a
0111 parallel output on Q0-3 and a 1 on ESt until I release the 7
button.
The 8870 part of the circuit is working great and I'm pleased. But
now I want my BS2 to make some use of this. I'm trying to write some
code that watches ESt, and when ESt is HIGH the stamp looks at Q0-Q3
and says, "Ok, I see a 0111... I will set key=7".
Can anyone offer a code sample, or maybe point me to a good resource
(I did RTFM, and I'm sure I can hack my way through it, but I'd like
to hear what the pros think).
Thanks a bunch!
Comments
the BS2, that shouldn't be too difficult at all.
'
key var byte 'define variable "key"
'Q0-Q3 to pin0-pin3
'ESt to pin4
loop:
if in4=0 then loop 'do nothing until ESt goes high
key=in3*8+in2*4+in1*2+in0*1 'convert to base 10 (pin3 is MSb)
if key=0 then...
if key=1 then...
if key=2 then... (etc.)
'
Hope that helps! - John
--- In basicstamps@yahoogroups.com, "iamlevis2" <iamlevis2@y...>
wrote:
> Hi... I have a Clare 8870-01 DTMF decoder that I want to
interface
> with my BS2 for a application that does stuff based on dial-tones.
>
> The 8870 takes a touch-tone tone in, and outputs a corresponding
> binary code on 4 outputs (Q0-Q3). Also, a Valid-Tone pin (ESt)
goes
> High when a valid DTMF tone is detected. Eg, I press a 7 and I get
a
> 0111 parallel output on Q0-3 and a 1 on ESt until I release the 7
> button.
>
> The 8870 part of the circuit is working great and I'm pleased.
But
> now I want my BS2 to make some use of this. I'm trying to write
some
> code that watches ESt, and when ESt is HIGH the stamp looks at Q0-
Q3
> and says, "Ok, I see a 0111... I will set key=7".
>
> Can anyone offer a code sample, or maybe point me to a good
resource
> (I did RTFM, and I'm sure I can hack my way through it, but I'd
like
> to hear what the pros think).
>
> Thanks a bunch!
can't wait to get home and give it a try!
Thanks... I'm sure I'll be back
--- In basicstamps@yahoogroups.com, "max2451234" <jjghost@t...> wrote:
> Presuming you've got all five data lines you mentioned running to
> the BS2, that shouldn't be too difficult at all.
>
> '
> key var byte 'define variable "key"
> 'Q0-Q3 to pin0-pin3
> 'ESt to pin4
>
> loop:
> if in4=0 then loop 'do nothing until ESt goes high
>
> key=in3*8+in2*4+in1*2+in0*1 'convert to base 10 (pin3 is MSb)
>
> if key=0 then...
> if key=1 then...
> if key=2 then... (etc.)
> '
>
> Hope that helps! - John
>
> --- In basicstamps@yahoogroups.com, "iamlevis2" <iamlevis2@y...>
> wrote:
> > Hi... I have a Clare 8870-01 DTMF decoder that I want to
> interface
> > with my BS2 for a application that does stuff based on dial-tones.
> >
> > The 8870 takes a touch-tone tone in, and outputs a corresponding
> > binary code on 4 outputs (Q0-Q3). Also, a Valid-Tone pin (ESt)
> goes
> > High when a valid DTMF tone is detected. Eg, I press a 7 and I
get
> a
> > 0111 parallel output on Q0-3 and a 1 on ESt until I release the 7
> > button.
> >
> > The 8870 part of the circuit is working great and I'm pleased.
> But
> > now I want my BS2 to make some use of this. I'm trying to write
> some
> > code that watches ESt, and when ESt is HIGH the stamp looks at Q0-
> Q3
> > and says, "Ok, I see a 0111... I will set key=7".
> >
> > Can anyone offer a code sample, or maybe point me to a good
> resource
> > (I did RTFM, and I'm sure I can hack my way through it, but I'd
> like
> > to hear what the pros think).
> >
> > Thanks a bunch!
using some of the Stamp's built-in variables. Like this:
key = InA
Ta da.... Done. No math required. InA is a nibble sized variable that is
affected by the input pins 0 - 3.
-- Jon Williams
-- Parallax
In a message dated 5/12/2003 1:35:07 PM Central Standard Time,
jjghost@t... writes:
> key=in3*8+in2*4+in1*2+in0*1 'convert to base 10 (pin3 is MSb)
[noparse][[/noparse]Non-text portions of this message have been removed]
to an epiphany that I'm sure will help me in my stamping.
--- In basicstamps@yahoogroups.com, "max2451234" <jjghost@t...> wrote:
> Presuming you've got all five data lines you mentioned running to
> the BS2, that shouldn't be too difficult at all.
>
> '
> key var byte 'define variable "key"
> 'Q0-Q3 to pin0-pin3
> 'ESt to pin4
>
> loop:
> if in4=0 then loop 'do nothing until ESt goes high
>
> key=in3*8+in2*4+in1*2+in0*1 'convert to base 10 (pin3 is MSb)
>
> if key=0 then...
> if key=1 then...
> if key=2 then... (etc.)
> '
>
> Hope that helps! - John
>
> --- In basicstamps@yahoogroups.com, "iamlevis2" <iamlevis2@y...>
> wrote:
> > Hi... I have a Clare 8870-01 DTMF decoder that I want to
> interface
> > with my BS2 for a application that does stuff based on dial-tones.
> >
> > The 8870 takes a touch-tone tone in, and outputs a corresponding
> > binary code on 4 outputs (Q0-Q3). Also, a Valid-Tone pin (ESt)
> goes
> > High when a valid DTMF tone is detected. Eg, I press a 7 and I
get
> a
> > 0111 parallel output on Q0-3 and a 1 on ESt until I release the 7
> > button.
> >
> > The 8870 part of the circuit is working great and I'm pleased.
> But
> > now I want my BS2 to make some use of this. I'm trying to write
> some
> > code that watches ESt, and when ESt is HIGH the stamp looks at Q0-
> Q3
> > and says, "Ok, I see a 0111... I will set key=7".
> >
> > Can anyone offer a code sample, or maybe point me to a good
> resource
> > (I did RTFM, and I'm sure I can hack my way through it, but I'd
> like
> > to hear what the pros think).
> >
> > Thanks a bunch!