Shop OBEX P1 Docs P2 Docs Learn Events
Shiftout question — Parallax Forums

Shiftout question

musictechmusictech Posts: 54
edited 2005-05-11 00:09 in BASIC Stamp
I am not very familiar with the shiftout command and it appears that I am going to have to use it for this small project.· Could anyone lend me a hand on how the line of code should look to accomplish the following directions.

Timing based on 1/1200 second clock (~.833ms)
Signal is normally high (idle, no IR).
Start: signal goes low for 8/1200 sec.
Data bits: for each of 8 data bits, space encoded signal depending on bit value
··· Sends the most significant data bit first
··· If the data bit is 0: signal goes high for 1/1200 sec, and low for 1/1200 sec.
··· If the data bit is 1: signal goes high for 4/1200 sec, and low for 1/1200 sec.
··· BTW: The first bit (msb) is always 1 (valid codes are from $80 to $FF)
When completed, signal goes high again.
No explicit stop bit. Minimal between signals is not known.





Comments

  • NewzedNewzed Posts: 2,503
    edited 2005-05-10 18:54
    What is the device you are using?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Need a bezel for your LCD?

    Newzed@aol.com
    ·
  • musictechmusictech Posts: 54
    edited 2005-05-10 19:13
    I am connected to the Infrared port of a robosapien
  • allanlane5allanlane5 Posts: 3,815
    edited 2005-05-10 19:31
    It's not SHIFTOUT you'll need to use.

    You need to 'send' by using the FREQOUT command.
    Note the BS2 only allows you '1 mS' signals, where you need
    800 uSec signals.· The BS2sx will send in '400 uS' ticks, so
    that's the one you need.

    FREQOUT IR_Pin, 16, 38500· ' Send 16 * 400 uS is 6.4 mSec 'start' signal

    FREQOUT IR_Pin, 2, 0· ' Send 800 uSec of 'Silence' (IR Detector goes 'high')

    FREQOUT IR_Pin, 2, 38000· ' Send 800 uSec of 'Signal'

    '*** The above does a start, and sends a 'zero'

    FREQOUT IR_Pin, 8, 0· ' Send 8*400 uS == 3.2 mS of 'Silence'

    FREQOUT IR_Pin, 2, 38000 ' Send 800 uSec of 'signal'

    '**** The above sends a 'one' bit.

    Now, to recieve from your RoboSapien, you'll need an IR-Detector module
    from Radio Shack.· 3-pins, requires +5, GND, and produces a signal.· The
    signal 'floats' high, and is pulled low when the IR-Detector detects the
    38500 hz modulated IR-Signal.

    You can use 'PULSIN' to read this signal.

    ·
  • musictechmusictech Posts: 54
    edited 2005-05-10 19:36
    I am directly connected to the infrared port. I have a wire lead going to my stamp. I am hoping I can pass it hexidecimal commands directly using the pin the infrared is hooked to.
  • musictechmusictech Posts: 54
    edited 2005-05-10 19:47
    not following you allan

    If I wanted to send $81 to the robosapien following the above instructions, how would I do it. Keep in mind, I am not using infrared to communicate. I am attached to the point on the board where the infrared data comes in.
  • allanlane5allanlane5 Posts: 3,815
    edited 2005-05-11 00:09
    Ahh. I assumed you were flashing an IR-LED at a 38 Khz rate. If you are wired directly you probably want to use 'pulsout' to time the pulse widths.
Sign In or Register to comment.