Shop OBEX P1 Docs P2 Docs Learn Events
MIDI input with the BS2 — Parallax Forums

MIDI input with the BS2

Kevin HarrisKevin Harris Posts: 15
edited 2006-12-21 15:44 in BASIC Stamp
Hi, I'm working a receiving MIDI signals from a MIDI keyboard.· I realize that the unbuffered inputs of the Stamp are not very reliable, but for now I'm plugging the keyboard directly to power, I/O, and ground as specified in Jon Williams'· "Gettin' MIDI with it" article.· I'm trying to simply receive the typical "note on" 3-byte message, but I can't seem to get more than the first byte of any message.· It appears that the other 2 bytes were never even sent, but I tried this with two different keyboards and get identical results.· Is this the result of the unbuffered I/O?· My code is as follows:

serData VAR Byte

DO
· SERIN 1, 12, [noparse][[/noparse]serData]
· DEBUG HEX serData, " "
LOOP

Every time I push a key I get a 90 note on and nothing following, and an 80 note off when the key released (also with nothing following).· Anyone have any ideas?

Thanks,
Kevin Harris

Comments

  • BeanBean Posts: 8,129
    edited 2006-12-21 15:44
    Kevin,
    You need to receive all the bytes at one time. You are losing the incoming data because the stamp is processing the DEBUG line while the rest of the data is coming in. By the time the stamp gets back to the SERIN instruction, there is no data to receive.

    Use something like: SERIN 1,12,[noparse][[/noparse]serData1, serData2, serData3]


    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap used 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com
    SX-Video Display Modules www.sxvm.com
    Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1

    "USA Today has come out with a new survey - apparently, three out of every four people make up 75% of the population." - David Letterman
Sign In or Register to comment.