Shop OBEX P1 Docs P2 Docs Learn Events
Pulsin command — Parallax Forums

Pulsin command

curtiscurtis Posts: 19
edited 2006-05-14 16:07 in General Discussion
Hello,
I put together an infrared detector circuit and a rs232 circuit in order to receive a value for each pulse sent by a pocket pc through its ir port. I used a logic probe to test the output·of the letter "A" from the PPC using serial code, I get the 8 bit binary representation of a "A". I tried to write some code to measure the pulses using the SXB and a sxtech board. All I get are zeros. I am using a VB6 program to aquire the data. Could someone help me with code below?

DEVICE········· SX28, OSCXT2, TURBO, STACKX, OPTIONX
FREQ··········· 4_000_000
' =========================================================================
' Vaiables
' =========================================================================
serByte········ VAR···· Byte(10)··················· ' serial IO byte
' =========================================================================
· PROGRAM Start
' =========================================================================
Start:
· ' initialization code here
goto main
Main:
pulsin RA.0,1,serByte(0)
pulsin RA.0,1,serByte(1)
pulsin RA.0,1,serByte(2)
pulsin RA.0,1,serByte(3)
pulsin RA.0,1,serByte(4)
pulsin RA.0,1,serByte(5)
pulsin RA.0,1,serByte(6)
pulsin RA.0,1,serByte(7)
pulsin RA.0,1,serByte(8)
pulsin RA.0,1,serByte(9)
serout RA.1,T9600,serByte
Pause 1000
GOTO Main

Thanks,
Curtis
·

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-05-14 16:07
    The problem is you're stuffing the bit length into eight bytes and then shipping eight bytes to the PC that is expecting eight bits.· I've attached a little Sony IR demo I wrote for someone else -- it should be enough to get you started.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
Sign In or Register to comment.