Shop OBEX P1 Docs P2 Docs Learn Events
Decode Infrared codes — Parallax Forums

Decode Infrared codes

ArchiverArchiver Posts: 46,084
edited 2001-03-20 18:17 in General Discussion
I'm using a radioshack infrared detector module (model GP1U52X). I
have the output of the module hooked up to an input pin of a bs2.
I'm wondering what the best way is to see the code from a remote
control that I point towards the module.(What basic stamp command
would I use to count the pulses). All I really want to do is debug
the code to my pc screen in the form of 1's and 0's.

Thanks,

Charlie

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2001-03-18 05:26
    Thats a good question. I would like to know too...
  • ArchiverArchiver Posts: 46,084
    edited 2001-03-19 06:44
    I'm using a radioshack infrared detector module (model GP1U52X). I
    have the output of the module hooked up to an input pin of a bs2.
    I'm wondering what the best way is to see the code from a remote
    control that I point towards the module.(What basic stamp command
    would I use to count the pulses). All I really want to do is debug
    the code to my pc screen in the form of 1's and 0's.

    Thanks,

    Charlie
  • ArchiverArchiver Posts: 46,084
    edited 2001-03-19 14:28
    I did an article for this in Elektor a while back. The problem is the
    Stamp's interinstruction time is just fast enough to catch the remote. Since
    most remotes use a pulse width, you can read the data with PULSIN. However,
    you have no processing time until the packet is done. So:

    pulsin 0,firstbit
    pulsin 0,secondbit
    . . .

    ' now do stuff


    You can't write:

    first:
    pulsin 0, firstbit
    if firstbit<1000 goto first
    ' too late!

    The problem is, how do you know when the remote sends a start bit. My code
    did NOT know. It simply read an entire packet, checked it, and if it was
    wrong it would read it again. That works over time because there is a large
    gap between packets. Eventually you will sink up. The remotes know they may
    not be reliable, so most of them send "repeats" as long as you hold the key.

    This leads to other problems you can work around. My remote drove a little
    robot (the BoeBot). If you program it to move forward, for example, while
    pressing the 2 key. That was OK. But if you said, press 2 to go forward and
    then it will continue going forward until you press, say, 5 that worked
    poorly. Why? Because the IR read routine had to "time out" reading the 8 or
    9 bits before you could do anything. So sending it a steady stream of IR was
    fine, but not sending it IR gave you a few 100 milliseconds where nothing
    else could happen.

    Regards,

    Al Williams
    AWC
    * Floating point math for the Stamp, PIC, SX, or any microcontroller:
    http://www.al-williams.com/awce/pak1.htm


    >
    Original Message
    > From: charlieb83@h... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=lbCOPW331sNVn0EbH5306d-B3Bl_pYb1LrCir7-Wt9nkV0LLh5QmyYsXmEUzm0HuGWaF7bWkMZCcxuwe9g]charlieb83@h...[/url
    > Sent: Monday, March 19, 2001 12:44 AM
    > To: basicstamps@yahoogroups.com
    > Subject: [noparse][[/noparse]basicstamps] Decode Infrared codes
    >
    >
    > I'm using a radioshack infrared detector module (model GP1U52X). I
    > have the output of the module hooked up to an input pin of a bs2.
    > I'm wondering what the best way is to see the code from a remote
    > control that I point towards the module.(What basic stamp command
    > would I use to count the pulses). All I really want to do is debug
    > the code to my pc screen in the form of 1's and 0's.
    >
    > Thanks,
    >
    > Charlie
    >
    >
    >
    >
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
  • ArchiverArchiver Posts: 46,084
    edited 2001-03-19 18:06
    Hi Al !

    You've got Elektor too ? I've seen this article (in Belgium) about different
    coding systems by constructors, it looks pretty interesting !
    You may find information at this address as well :
    http://www.ustr.net/infrared/infrared1.shtml

    Best regards,

    Phil.

    Original Message
    From: "Al Williams" <alw@a...>
    To: <basicstamps@yahoogroups.com>
    Sent: Monday, March 19, 2001 3:28 PM
    Subject: RE: [noparse][[/noparse]basicstamps] Decode Infrared codes


    > I did an article for this in Elektor a while back. The problem is the
    > Stamp's interinstruction time is just fast enough to catch the remote.
    Since
    > most remotes use a pulse width, you can read the data with PULSIN.
    However,
    > you have no processing time until the packet is done. So:
    >
    > pulsin 0,firstbit
    > pulsin 0,secondbit
    > . . .
    >
    > ' now do stuff
    >
    >
    > You can't write:
    >
    > first:
    > pulsin 0, firstbit
    > if firstbit<1000 goto first
    > ' too late!
    >
    > The problem is, how do you know when the remote sends a start bit. My code
    > did NOT know. It simply read an entire packet, checked it, and if it was
    > wrong it would read it again. That works over time because there is a
    large
    > gap between packets. Eventually you will sink up. The remotes know they
    may
    > not be reliable, so most of them send "repeats" as long as you hold the
    key.
    >
    > This leads to other problems you can work around. My remote drove a little
    > robot (the BoeBot). If you program it to move forward, for example, while
    > pressing the 2 key. That was OK. But if you said, press 2 to go forward
    and
    > then it will continue going forward until you press, say, 5 that worked
    > poorly. Why? Because the IR read routine had to "time out" reading the 8
    or
    > 9 bits before you could do anything. So sending it a steady stream of IR
    was
    > fine, but not sending it IR gave you a few 100 milliseconds where nothing
    > else could happen.
    >
    > Regards,
    >
    > Al Williams
    > AWC
    > * Floating point math for the Stamp, PIC, SX, or any microcontroller:
    > http://www.al-williams.com/awce/pak1.htm
    >
    >
    > >
    Original Message
    > > From: charlieb83@h... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=ErlTmY7aIum-7bgWdJpVL2_M0Tu4hv38tzwWO_458nBjPaktMxbKLBKI7JyFilqmRqC37j9ArY6Lfw]charlieb83@h...[/url
    > > Sent: Monday, March 19, 2001 12:44 AM
    > > To: basicstamps@yahoogroups.com
    > > Subject: [noparse][[/noparse]basicstamps] Decode Infrared codes
    > >
    > >
    > > I'm using a radioshack infrared detector module (model GP1U52X). I
    > > have the output of the module hooked up to an input pin of a bs2.
    > > I'm wondering what the best way is to see the code from a remote
    > > control that I point towards the module.(What basic stamp command
    > > would I use to count the pulses). All I really want to do is debug
    > > the code to my pc screen in the form of 1's and 0's.
    > >
    > > Thanks,
    > >
    > > Charlie
    > >
    > >
    > >
    > >
    > >
    > >
    > > Your use of Yahoo! Groups is subject to
    http://docs.yahoo.com/info/terms/
    > >
    >
    >
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2001-03-20 03:41
    As far as speed goes,

    Is the SX stamp marginal on speed for this application?


    thanks


    Original Message
    From: "Philippe Derenne" <derennep@s...>
    To: <basicstamps@yahoogroups.com>
    Sent: Monday, March 19, 2001 12:06
    Subject: Re: [noparse][[/noparse]basicstamps] Decode Infrared codes


    > Hi Al !
    >
    > You've got Elektor too ? I've seen this article (in Belgium) about
    different
    > coding systems by constructors, it looks pretty interesting !
    > You may find information at this address as well :
    > http://www.ustr.net/infrared/infrared1.shtml
    >
    > Best regards,
    >
    > Phil.
    >
    >
    Original Message
    > From: "Al Williams" <alw@a...>
    > To: <basicstamps@yahoogroups.com>
    > Sent: Monday, March 19, 2001 3:28 PM
    > Subject: RE: [noparse][[/noparse]basicstamps] Decode Infrared codes
    >
    >
    > > I did an article for this in Elektor a while back. The problem is the
    > > Stamp's interinstruction time is just fast enough to catch the remote.
    > Since
    > > most remotes use a pulse width, you can read the data with PULSIN.
    > However,
    > > you have no processing time until the packet is done. So:
    > >
    > > pulsin 0,firstbit
    > > pulsin 0,secondbit
    > > . . .
    > >
    > > ' now do stuff
    > >
    > >
    > > You can't write:
    > >
    > > first:
    > > pulsin 0, firstbit
    > > if firstbit<1000 goto first
    > > ' too late!
    > >
    > > The problem is, how do you know when the remote sends a start bit. My
    code
    > > did NOT know. It simply read an entire packet, checked it, and if it was
    > > wrong it would read it again. That works over time because there is a
    > large
    > > gap between packets. Eventually you will sink up. The remotes know they
    > may
    > > not be reliable, so most of them send "repeats" as long as you hold the
    > key.
    > >
    > > This leads to other problems you can work around. My remote drove a
    little
    > > robot (the BoeBot). If you program it to move forward, for example,
    while
    > > pressing the 2 key. That was OK. But if you said, press 2 to go forward
    > and
    > > then it will continue going forward until you press, say, 5 that worked
    > > poorly. Why? Because the IR read routine had to "time out" reading the 8
    > or
    > > 9 bits before you could do anything. So sending it a steady stream of IR
    > was
    > > fine, but not sending it IR gave you a few 100 milliseconds where
    nothing
    > > else could happen.
    > >
    > > Regards,
    > >
    > > Al Williams
    > > AWC
    > > * Floating point math for the Stamp, PIC, SX, or any microcontroller:
    > > http://www.al-williams.com/awce/pak1.htm
    > >
    > >
    > > >
    Original Message
    > > > From: charlieb83@h... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=o6s81RMm0l5KWZvKbDTjntZxZ4YEp-Ep-GG-2xNsXh-UnFcoOmYhXuXmeEGAktZdC72JCl44pLdYsw]charlieb83@h...[/url
    > > > Sent: Monday, March 19, 2001 12:44 AM
    > > > To: basicstamps@yahoogroups.com
    > > > Subject: [noparse][[/noparse]basicstamps] Decode Infrared codes
    > > >
    > > >
    > > > I'm using a radioshack infrared detector module (model GP1U52X). I
    > > > have the output of the module hooked up to an input pin of a bs2.
    > > > I'm wondering what the best way is to see the code from a remote
    > > > control that I point towards the module.(What basic stamp command
    > > > would I use to count the pulses). All I really want to do is debug
    > > > the code to my pc screen in the form of 1's and 0's.
    > > >
    > > > Thanks,
    > > >
    > > > Charlie
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >
    > > > Your use of Yahoo! Groups is subject to
    > http://docs.yahoo.com/info/terms/
    > > >
    > >
    > >
    > >
    > >
    > > Your use of Yahoo! Groups is subject to
    http://docs.yahoo.com/info/terms/
    > >
    > >
    > >
    >
    >
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2001-03-20 04:11
    Thanks for you're help Al. When you say:

    pulsin 0,firstbit
    pulsin 0,secondbit
    . . .
    How many bits do I want to read? Also, how can I check (as you said)
    this stream of bits to see if its the right one?

    Again, you're help is greatly appreciated.

    Thank you,
    Charlie
  • ArchiverArchiver Posts: 46,084
    edited 2001-03-20 04:19
    Hi Charlie,

    Well, that depends on the remote in question. Different ones use different
    formats, word lengths, etc. My code used a Sony remote. You can read just
    some of the bits if you only want to decode some keys (the code at
    stampsinclass.com does this).

    The trick is to look at the length of the firstbit and compare it to how
    long the AGC or start pulse is supposed to be (with some error margin, of
    course).

    Have a look at the code at www.stampsinclass.com -- The Elektor code was
    written for Parallax, so I don't know if they can release it or if Elektor
    owns the rights outright. Andy can you shed some light on this? From my
    point of view, Parallax owns that code, but I don't know what rights they
    may have given away for it?

    Al Williams
    AWC
    * Control 8 servos: http://www.al-williams.com/awce/pak8.htm


    >
    Original Message
    > From: charlieb83@h... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=rmnVpCirvuB7DgPoyMi755e7SaPK31cgDfa0NEuwnDRJaoGlxjUkdi_KqKLqdjcdA70DniA4cazSSSv8syw]charlieb83@h...[/url
    > Sent: Monday, March 19, 2001 10:11 PM
    > To: basicstamps@yahoogroups.com
    > Subject: [noparse][[/noparse]basicstamps] Re: Decode Infrared codes
    >
    >
    > Thanks for you're help Al. When you say:
    >
    > pulsin 0,firstbit
    > pulsin 0,secondbit
    > . . .
    > How many bits do I want to read? Also, how can I check (as you said)
    > this stream of bits to see if its the right one?
    >
    > Again, you're help is greatly appreciated.
    >
    > Thank you,
    > Charlie
    >
    >
    >
    >
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
  • ArchiverArchiver Posts: 46,084
    edited 2001-03-20 16:37
    Here is some testing I did using PBP and a 16f84-10. If someone has an sx
    or one of the newer stamps maybe they can test it, the values for the
    leader 310, 320 and the values for the var (A) will need to be changed, The
    value of pulsin changes per the speed of processor. I have made changes to
    this program but Im not sure if the stamp supports some of the changes, In
    the value1 subprogram I have a loop to place all bit values into a word
    rather than use 12 lines but this may be easier to start with.

    good luck
    If someone gets it working let me know

    larry gaminde



    ' IR CODE READER SONY TYPE
    ' LARRY GAMINDE LGAMINDE@T...
    '
    ' PIC16F84-10 USED IN THIS EXAMPLE AND TIMING IS DEPENDENT
    ' ON PROCESSOR SPEED 10MHZ
    ' I USED A SERIAL BACKPACK ON PORTB.3 FOR DISPLAY AND DEBUGGING
    ' INPUT FROM RADIO SHACK 40KHZ RECEIVER TO PORTB.1
    '


    DEFINE OSC 10
    TRISB= %01000000

    A VAR BYTE(16)
    I VAR BYTE
    LEADER VAR WORD
    VALUE VAR WORD

    PAUSE 500
    SEROUT2 PORTB.3, $4054,[noparse][[/noparse]254,1]
    PAUSE 100
    SEROUT2 PORTB.3, $4054,[noparse][[/noparse]" IR CODE READER"]
    PAUSE 2000

    MAIN: LEADER = 0 'LOOK FOR LEADER OR START BIT
    PULSIN PORTB.1, 0, LEADER
    IF (LEADER < 310) THEN MAIN
    IF (LEADER > 320) THEN MAIN

    FOR I = 0 TO 11 'I USED 8 OF THE 12 BITS FOR DISPLAY
    PULSIN PORTB.1, 0, A(I)
    NEXT

    FOR I = 0 TO 11
    IF A(I) > 150 THEN ONE
    IF A(I) < 130 THEN ZERO
    'NEXT THREE LINES USED FOR DEBUGGING
    SEROUT2 PORTB.3,$4054,[noparse][[/noparse]254,1]
    SEROUT2 PORTB.3,$4054,[noparse][[/noparse]"A",DEC I,DEC A(I)]
    PAUSE 2000

    ONE:
    A(I) = 1
    GOTO ENDD
    ZERO:
    A(I) = 0
    ENDD:
    NEXT

    VALUE1:

    VALUE.BIT0 = A(0)
    VALUE.BIT1 = A(1)
    VALUE.BIT2 = A(2)
    VALUE.BIT3 = A(3)
    VALUE.BIT4 = A(4)
    VALUE.BIT5 = A(5)
    VALUE.BIT6 = A(6)
    VALUE.BIT7 = A(7)
    VALUE.BIT8 = A(8)
    VALUE.BIT9 = A(9)
    VALUE.BIT10 = A(10)
    VALUE.BIT11 = A(11)
    VALUE.BIT12 = 0
    VALUE.BIT13 = 0
    VALUE.BIT14 = 0
    VALUE.BIT15 = 0

    SEROUT2 PORTB.3,$4054,[noparse][[/noparse]254,1]
    SEROUT2 PORTB.3,$4054,[noparse][[/noparse]" ",DEC VALUE]
    SEROUT2 PORTB.3,$4054,[noparse][[/noparse]254,192]
    SEROUT2 PORTB.3,$4054,[noparse][[/noparse]BIN VALUE]
    PAUSE 2000


    IF VALUE = 4074 THEN VALUE = 1
    IF VALUE = 4042 THEN VALUE = 2
    IF VALUE = 4010 THEN VALUE = 3
    IF VALUE = 3978 THEN VALUE = 4
    IF VALUE = 3946 THEN VALUE = 5
    IF VALUE = 3914 THEN VALUE = 6
    IF VALUE = 3882 THEN VALUE = 7
    IF VALUE = 3850 THEN VALUE = 8
    IF VALUE = 3818 THEN VALUE = 9
    IF VALUE = 3786 THEN VALUE = 0
    SEROUT2 PORTB.3,$4054,[noparse][[/noparse]254,1]
    SEROUT2 PORTB.3,$4054,[noparse][[/noparse]" BUTTON # ",DEC VALUE]
    LEADER = 0
    VALUE = 0
    PAUSE 500
    GOTO MAIN





    charlieb83@h... wrote:
    >
    > Thanks for you're help Al. When you say:
    >
    > pulsin 0,firstbit
    > pulsin 0,secondbit
    > . . .
    > How many bits do I want to read? Also, how can I check (as you said)
    > this stream of bits to see if its the right one?
    >
    > Again, you're help is greatly appreciated.
    >
    > Thank you,
    > Charlie
    >
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2001-03-20 18:17
    Here is another version that may show what is going on better with the
    pulsin statements the portb.? need to be the pin numbers your using for
    input and output


    DEFINE OSC 10
    TRISB= %01000000


    TOTAL VAR BYTE
    LEADER VAR WORD
    VALUE VAR WORD
    A VAR BYTE(16)


    PAUSE 500
    SEROUT2 PORTB.3, $4054,[noparse][[/noparse]254,1]
    PAUSE 100
    SEROUT2 PORTB.3, $4054,[noparse][[/noparse]" IR CODE READER"]
    PAUSE 2000

    MAIN:
    PULSIN PORTB.1, 0, LEADER
    IF (LEADER < 310) THEN MAIN
    IF (LEADER > 320) THEN MAIN

    PULSIN PORTB.1, 0, A(0)
    PULSIN PORTB.1, 0, A(1)
    PULSIN PORTB.1, 0, A(2)
    PULSIN PORTB.1, 0, A(3)
    PULSIN PORTB.1, 0, A(4)
    PULSIN PORTB.1, 0, A(5)
    PULSIN PORTB.1, 0, A(6)
    PULSIN PORTB.1, 0, A(7)
    PULSIN PORTB.1, 0, A(8)
    PULSIN PORTB.1, 0, A(9)
    PULSIN PORTB.1, 0, A(10)
    PULSIN PORTB.1, 0, A(11)

    'PULSIN PORTB.1, 0, A(12)
    'PULSIN PORTB.1, 0, A(13)
    'PULSIN PORTB.1, 0, A(14)
    'PULSIN PORTB.1, 0, A(15)

    FOR TOTAL = 0 TO 11
    IF A(TOTAL) > 150 THEN ONE
    IF A(TOTAL) < 130 THEN ZERO

    SEROUT2 PORTB.3,$4054,[noparse][[/noparse]254,1]
    SEROUT2 PORTB.3,$4054,[noparse][[/noparse]"A",DEC TOTAL,DEC A(TOTAL)]
    PAUSE 2000

    ONE:
    A(TOTAL) = 1
    GOTO ENDD
    ZERO:
    A(TOTAL) = 0
    ENDD:
    NEXT

    VALUE1:
    VALUE.BIT0 = A(0)
    VALUE.BIT1 = A(1)
    VALUE.BIT2 = A(2)
    VALUE.BIT3 = A(3)
    VALUE.BIT4 = A(4)
    VALUE.BIT5 = A(5)
    VALUE.BIT6 = A(6)
    VALUE.BIT7 = A(7)
    VALUE.BIT8 = A(8)
    VALUE.BIT9 = A(9)
    VALUE.BIT10 = A(10)
    VALUE.BIT11 = A(11)
    VALUE.BIT12 = 0 'A(12)
    VALUE.BIT13 = 0 'A(13)
    VALUE.BIT14 = 0 'A(14)
    VALUE.BIT15 = 0 'A(15)

    DISPLAY:
    SEROUT2 PORTB.3,$4054,[noparse][[/noparse]254,1]
    SEROUT2 PORTB.3,$4054,[noparse][[/noparse]" ",DEC VALUE]
    SEROUT2 PORTB.3,$4054,[noparse][[/noparse]254,192]
    SEROUT2 PORTB.3,$4054,[noparse][[/noparse]BIN VALUE]
    PAUSE 2000


    IF VALUE = 4074 THEN VALUE = 1
    IF VALUE = 4042 THEN VALUE = 2
    IF VALUE = 4010 THEN VALUE = 3
    IF VALUE = 3978 THEN VALUE = 4
    IF VALUE = 3946 THEN VALUE = 5
    IF VALUE = 3914 THEN VALUE = 6
    IF VALUE = 3882 THEN VALUE = 7
    IF VALUE = 3850 THEN VALUE = 8
    IF VALUE = 3818 THEN VALUE = 9
    IF VALUE = 3786 THEN VALUE = 0
    SEROUT2 PORTB.3,$4054,[noparse][[/noparse]254,1]
    SEROUT2 PORTB.3,$4054,[noparse][[/noparse]" BUTTON # ",DEC VALUE]
    LEADER = 0
    VALUE = 0
    PAUSE 500

    DONE: GOTO MAIN




    "L .Gaminde" wrote:
    >
    > Here is some testing I did using PBP and a 16f84-10. If someone has an sx
    > or one of the newer stamps maybe they can test it, the values for the
    > leader 310, 320 and the values for the var (A) will need to be changed, The
    > value of pulsin changes per the speed of processor. I have made changes to
    > this program but Im not sure if the stamp supports some of the changes, In
    > the value1 subprogram I have a loop to place all bit values into a word
    > rather than use 12 lines but this may be easier to start with.
    >
    > good luck
    > If someone gets it working let me know
    >
    > larry gaminde
    >
    > ' IR CODE READER SONY TYPE
    > ' LARRY GAMINDE LGAMINDE@T...
    > '
    > ' PIC16F84-10 USED IN THIS EXAMPLE AND TIMING IS DEPENDENT
    > ' ON PROCESSOR SPEED 10MHZ
    > ' I USED A SERIAL BACKPACK ON PORTB.3 FOR DISPLAY AND DEBUGGING
    > ' INPUT FROM RADIO SHACK 40KHZ RECEIVER TO PORTB.1
    > '
    >
    > DEFINE OSC 10
    > TRISB= %01000000
    >
    > A VAR BYTE(16)
    > I VAR BYTE
    > LEADER VAR WORD
    > VALUE VAR WORD
    >
    > PAUSE 500
    > SEROUT2 PORTB.3, $4054,[noparse][[/noparse]254,1]
    > PAUSE 100
    > SEROUT2 PORTB.3, $4054,[noparse][[/noparse]" IR CODE READER"]
    > PAUSE 2000
    >
    > MAIN: LEADER = 0 'LOOK FOR LEADER OR START BIT
    > PULSIN PORTB.1, 0, LEADER
    > IF (LEADER < 310) THEN MAIN
    > IF (LEADER > 320) THEN MAIN
    >
    > FOR I = 0 TO 11 'I USED 8 OF THE 12 BITS FOR DISPLAY
    > PULSIN PORTB.1, 0, A(I)
    > NEXT
    >
    > FOR I = 0 TO 11
    > IF A(I) > 150 THEN ONE
    > IF A(I) < 130 THEN ZERO
    > 'NEXT THREE LINES USED FOR DEBUGGING
    > SEROUT2 PORTB.3,$4054,[noparse][[/noparse]254,1]
    > SEROUT2 PORTB.3,$4054,[noparse][[/noparse]"A",DEC I,DEC A(I)]
    > PAUSE 2000
    >
    > ONE:
    > A(I) = 1
    > GOTO ENDD
    > ZERO:
    > A(I) = 0
    > ENDD:
    > NEXT
    >
    > VALUE1:
    >
    > VALUE.BIT0 = A(0)
    > VALUE.BIT1 = A(1)
    > VALUE.BIT2 = A(2)
    > VALUE.BIT3 = A(3)
    > VALUE.BIT4 = A(4)
    > VALUE.BIT5 = A(5)
    > VALUE.BIT6 = A(6)
    > VALUE.BIT7 = A(7)
    > VALUE.BIT8 = A(8)
    > VALUE.BIT9 = A(9)
    > VALUE.BIT10 = A(10)
    > VALUE.BIT11 = A(11)
    > VALUE.BIT12 = 0
    > VALUE.BIT13 = 0
    > VALUE.BIT14 = 0
    > VALUE.BIT15 = 0
    >
    > SEROUT2 PORTB.3,$4054,[noparse][[/noparse]254,1]
    > SEROUT2 PORTB.3,$4054,[noparse][[/noparse]" ",DEC VALUE]
    > SEROUT2 PORTB.3,$4054,[noparse][[/noparse]254,192]
    > SEROUT2 PORTB.3,$4054,[noparse][[/noparse]BIN VALUE]
    > PAUSE 2000
    >
    >
    > IF VALUE = 4074 THEN VALUE = 1
    > IF VALUE = 4042 THEN VALUE = 2
    > IF VALUE = 4010 THEN VALUE = 3
    > IF VALUE = 3978 THEN VALUE = 4
    > IF VALUE = 3946 THEN VALUE = 5
    > IF VALUE = 3914 THEN VALUE = 6
    > IF VALUE = 3882 THEN VALUE = 7
    > IF VALUE = 3850 THEN VALUE = 8
    > IF VALUE = 3818 THEN VALUE = 9
    > IF VALUE = 3786 THEN VALUE = 0
    > SEROUT2 PORTB.3,$4054,[noparse][[/noparse]254,1]
    > SEROUT2 PORTB.3,$4054,[noparse][[/noparse]" BUTTON # ",DEC VALUE]
    > LEADER = 0
    > VALUE = 0
    > PAUSE 500
    > GOTO MAIN
    >
    >
    > charlieb83@h... wrote:
    > >
    > > Thanks for you're help Al. When you say:
    > >
    > > pulsin 0,firstbit
    > > pulsin 0,secondbit
    > > . . .
    > > How many bits do I want to read? Also, how can I check (as you said)
    > > this stream of bits to see if its the right one?
    > >
    > > Again, you're help is greatly appreciated.
    > >
    > > Thank you,
    > > Charlie
    > >
    > >
    > >
    > > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Sign In or Register to comment.