Shop OBEX P1 Docs P2 Docs Learn Events
MIDI, BS2P40, Professional Dev Board — Parallax Forums

MIDI, BS2P40, Professional Dev Board

Piper984Piper984 Posts: 74
edited 2005-06-19 03:49 in BASIC Stamp
Hello Forum,

I just bought a BS2P40 and the new Pro. Dev. board with hopes·of extending a MIDI application I have prototyped using a standard BS2 + a BOE.

I am having an issue w/ the BS2P40, although I am not sure how to troubleshoot.

A·SEROUT command for the BS2 like:
·· SEROUT 10, $8000+12,[noparse][[/noparse]$91,$3C,$7F]
··· ' ($8000 is for open, 12 is (1000000/31250) - 20 )
should look like this on a BS2P40:
·· SEROUT 10, $8000+60,[noparse][[/noparse]$91,$3C,$7F]
·· ' ($8000 for open, and 60 is (2500000/31250) - 20)

but· I get nothing out of my MIDI·modules when I run·code·on the BS2P40.··I have been·doing MIDI w/ a standard BS2 for about·5 months with no issues, so I am sure it is related to BS2P40 issue.

My question is to anyone who has a MIDI app working w/ a BS2P24 or BS2P40: Is my Serout command correct, and if so how·could I troubleshoot to figure out what else is going on?· As·I stated,··the same code with the exception of the SEROUT changes runs fine on·my BOE + BS2.· Oh yeah, I did insert the MAINIO statement for the BS2P code to make sure I wasn't sending the serout to Aux10.

I have also had trouble getting the BS2P40 working w/ a serial LCD, so I am either doing something wrong or the BS2P40 isn't working as expected.

Thanks for any help or ideas!!

Chris McLennan
chris@pitchpipetuner.com


·

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-06-19 02:13
    Chris,

    ·· Please attach your code.· The whole thing...if possible (As an attachment).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Piper984Piper984 Posts: 74
    edited 2005-06-19 02:53
    Ok Chris, here is some sample code that works on the BS2 on both the BOE and the new Pro Dev board:

    ' {$PBASIC 2.5}
    DO
    · SEROUT 10, $8000+12,[noparse][[/noparse]$90,$3C,$7F]
    · PAUSE 1000
    · SEROUT 10, $8000+12,[noparse][[/noparse]$80,$3C,$7F]
    · PAUSE 1000
    LOOP

    This code will send a·'note on' command·to a MIDI instrument for 1000ms,· then a 'note off' for 1000ms.

    Now what would think should work for·my BS2P40:

    ' {$PBASIC 2.5}
    DO
    · SEROUT 10, $8000+60,[noparse][[/noparse]$90,$3C,$7F]
    · PAUSE 1000
    · SEROUT 10, $8000+60,[noparse][[/noparse]$80,$3C,$7F]
    · PAUSE 1000
    LOOP

    But no dice.... I add 60 to $8000 since (2500000/31250) - 20 is 60. For the BS2, (1000000/31250) - 20 = 12 and works great.

    I am not sure how to troubleshoot non-standard baud rates since I am not able to configure a PC for 31250 baud to check.

    Any advise would be great.· I was hoping to port my BS2 application to BS2P40 this evening, but haven't gotten·very far yet. blush.gif

    Regards,

    Chris
    ·
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-06-19 02:59
    Chris,

    ·· That was the entire code?· Well, the baud rate parameter is correct for the BS2P40.· I would double-check your wiring...The PDB can handle any Stamp.· It would be helpful to have you try the BS2 in the socket and the BS2 code you have, and see if that works with your existing wiring.· That would narrow things down considerably.· Just pop the BS2P40 out, plug in the BS2, and change the baud rate parameter back, and then see if it works.· If not, it's a wiring issue.· Oh, and to save typing, you should define a constant for the baud rate parameter, something like, "Baud."· That way, wherever you need the baud rate, you just replace it with the word Baud, instead of $8000+60 each time.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Piper984Piper984 Posts: 74
    edited 2005-06-19 03:13
    Ok Chris. I did pop the BS2 into the PDB and it works fine + $8000+12. My entire program is very large and has tons of code for rotary encoders, a few ADC, etc., an LCD, etc. so I am just working w/ this sample now to figure out the SEROUT issue.

    So, any idea why BS2 works in PDB w/ $8000+12 but BS2P40 doesn't work with $8000+60 ? Could the 'clock' of my BS2P40 not be accurate, thus this 60 is the wrong # of the chip I have? I have another p40 somewhere... I'll pop it in and see if there is any difference.

    Regards,
    Chris
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-06-19 03:18
    Chris,

    ·· So, just to confirm, that was the entire code you're running on the BS2P40?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Piper984Piper984 Posts: 74
    edited 2005-06-19 03:27
    The code I am running on BS2P40 / PDB:
    ' {$STAMP BS2p}
    ' {$PBASIC 2.5}
    DO
    SEROUT 10, $8000+60,[noparse][[/noparse]$90,$3C,$7F]
    PAUSE 1000
    SEROUT 10, $8000+60,[noparse][[/noparse]$80,$3C,$7F]
    PAUSE 1000
    LOOP

    The code that works on BS2 / PDB:
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    DO
    SEROUT 10, $8000+12,[noparse][[/noparse]$90,$3C,$7F]
    PAUSE 1000
    SEROUT 10, $8000+12,[noparse][[/noparse]$80,$3C,$7F]
    PAUSE 1000
    LOOP

    I did find my other BS2p40 and it is also not working w/ the $8000+60 serout, so something is up.

    Thanks Chris!!
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-06-19 03:30
    Chris,

    ·· I will try to test your code out on both a BS2 and a BS2P40 by tomorrow at some point.· I only just today got my home bench back together, and I still have to get all the parts back to where I can find them.· Hang in there!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Piper984Piper984 Posts: 74
    edited 2005-06-19 03:48
    Hi Chris, I have solved my issue.

    The problem was indeed wiring. I should have read the PDB manual closer. OUT10 is P10 for BS2, but M10 on BS2P40 is RB2. So BS2 worked, but not BS2p40.

    Good grief. Oh well. Thanks for the help. I'm sure my issue w/ the LCD will also now be resolved.

    I hope I'm not the first to have mixed this up on the new board??

    Regards,

    Chris
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-06-19 03:49
    Chris,

    ·· Glad you got it firgured out.· You just saved me digging out my extra MIDI Cables with adapters on them...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
Sign In or Register to comment.