Shop OBEX P1 Docs P2 Docs Learn Events
SoundPAL for SX chips (SX-28) — Parallax Forums

SoundPAL for SX chips (SX-28)

T&E EngineerT&E Engineer Posts: 1,396
edited 2007-11-18 05:59 in General Discussion
While I await for my SoundPAL to arrive next week, I decided to get a headstart and convert the (2) BS2 programs over to SX. Although they have not been tested yet I think they·are be ready. They do compile fine and anyone is welcome to modify them if I am doing anything wrong in the conversion. I have also attached the 2 BS2 program for comparison.

Thanks.


NEW UPDATE: Attached SX/B programs now work fine - identical to BS2 equivalents.

Post Edited (T&E Engineer) : 11/18/2007 12:48:45 AM GMT

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-11-12 07:09
    Excellent effort! Please let us know how your conversions work out!

    Thanks,
    Phil
  • Fe2o3FishFe2o3Fish Posts: 170
    edited 2007-11-15 06:52
    T&E -- While I've gotten my SoundPAL to work just fine with the BS2 on my old BOE,
    I've had no luck getting your program to run on my Prop-SX.

    Phil, wow! That puppy's pretty LOUD! I wuz serprized! smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Rusty-
    --
    Rusty Haddock = AE5AE = rusty@fe2o3.lonestar.org
    **Out yonder in the Van Alstyne (TX) Metropolitan Area**
    Microsoft is to software what McDonalds is to gourmet cooking
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2007-11-15 11:03
    I got home later last night and saw that my SoundPAL arrived. I will try to fine tune the SX program tonight or tomorrow. I just can't believe how small this thing is. Wow. I'm also glad to hear that it is loud too.

    BTW: What is an Prop-SX ? (Propeller? If so, it will not work as this is for SX chips only like the SX-28)

    More to come....
  • BeanBean Posts: 8,129
    edited 2007-11-15 12:45
    The Prop-SX has a SX-28. It is meant to be programmed in SX/B or assembly.
    It has a 32K eeprom and a serial interface(PC) and 16 high current outputs.

    http://www.efx-tek.com/topics/prop-sx.html

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    www.iElectronicDesigns.com

    ·
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2007-11-17 17:21
    I think the first problem when converting the BS2 program to SX is to make sure that the initial Baud setting is correct.

    For the working BS2 program:

    baud····· CON· $8000 + 84·· 'Communication baudrate is 9600 for BS2
    reset····· CON· $8000 + 813· 'Reset baudrate is 1200 for BS2

    However, when I try something like·this for the SX it has a syntax·error:

    baud·CON··$8000 + "N9600"·· 'Communication baudrate is 9600

    reset1·CON··$8000 + "N1200"·· 'Reset baudrate is 1200



    I then tried to then convert the HEX $8000 to decimal and add it which does compile but does not start the SoundPAL like I·might think. See below:

    baud·CON· ·"N42368"··· ' $8000 (=32768) + N9600·· 'Communication baudrate is 9600

    reset1·CON· ·"N33968"··' $8000 + N1200·· 'Reset baudrate is 1200



    Any Help here?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-11-17 17:44
    Try this:

    baud  CON "N9600"
    reset CON "N1200"
    
    
    


    As I understand it (but I've never used SX/B, so take with a grain of salt), the "N" in SX/B does the equivalent of adding $8000 in PBASIC, so you never need to do it explicitly. Also, I've not read enough of the manual to know whether putting the baudmode in quotes in a CON statement is actually supposed to work. The only examples I've seen so far put the N9600, for example, directly into the SEROUT.

    -Phil
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2007-11-17 19:36
    I tried N9600, T9600 and OT9600 (along with the N1200, T1200 and OT1200) and 10K resistors both tied high on RA.0 and / or tied low on RA.0.

    I still hear nothing. I also tried the N9600 and N1200 with not using quotes and I got an error because the CON statement see's the N with no quotes probably.

    Is there anyway I can verify that it is even at the same equivalent baud as the BS2 version?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-11-17 20:08
    Oops! My mistake. I had confused polarity with open-collector. So, instead of N9600 and N1200, OT9600 and OT1200 should be the correct forms. Have you tried putting them directly into the SEROUT statements, rather than using "baud"? Also, a simpler program than SoundPAL_Repertoire might be a better place to start. Here's a minimal program for the BS2 that plays "Charge!" Try modifying it for SX/B and move on from there.

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    
    iopin PIN 15
    
    DO : LOOP UNTIL iopin
    SEROUT iopin, $8000 + 84, [noparse][[/noparse]"=", 1, 64, 0, "!"]
    
    
    



    -Phil
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-11-17 20:53
    Again, set the more complicated stuff aside for awhile, and see if you can get the simple program above working. In PBASIC, symbols defined by the PIN definition are treated both as constants and as variables, depending on the context of their usage. Since I've never used SX/B, I don't know if this same dual personality exists there, but it may be worth investigating. Specifically, does the statement DO UNTIL iopin = 1 use the pin state or pin number in the comparison?

    -Phil

    Note: This post was in response to a post that got deleted before this one could be submitted.
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2007-11-17 21:03
    OK. Success. I deleted my last post because I read too quickly and missed your simple program. I have attached a WORKING SX/B example. Since this works, I need to go back through the other converted programs and see what is wrong.

    Thanks for your help!

    BTW: Added in the DO UNTIL routine...

    More to come this weekend.


    Post Edited (T&E Engineer) : 11/17/2007 9:08:35 PM GMT
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-11-17 21:14
    Great! Now you've got a foundation to build from.

    -Phil
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2007-11-18 00:50
    I·now have the SX/B equivalent programs to the BS2 SoundPAL working fine. Identical to BS2 programs in functionality.

    I updated the original posting with the working SX/B equivalent programs.

    Thanks again to Phil for a very cool project!
  • Fe2o3FishFe2o3Fish Posts: 170
    edited 2007-11-18 05:31
    T&E Engineer said...
    OK. Success. I deleted my last post because I read too quickly and missed your simple program. I have attached a WORKING SX/B example. Since this works, I need to go back through the other converted programs and see what is wrong.

    Thanks for your help!

    BTW: Added in the DO UNTIL routine...

    More to come this weekend.
    I changed 'iopin' to RB.0 for the Prop-SX board but to no avail.
    I still can't seem to get the SoundPAL working off the Servo pins
    yet my 'candles' program works just fine.

    After some 'sperimentation it looks like the program is hanging
    on waiting for 'iopin' to come up to 1. I shouldn't need to pull
    out the ULN chip for port B, do I? I wouldn't think so... cry.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Rusty-
    --
    Rusty Haddock = AE5AE = rusty@fe2o3.lonestar.org
    **Out yonder in the Van Alstyne (TX) Metropolitan Area**
    Microsoft is to software what McDonalds is to gourmet cooking

    Post Edited (Fe2o3Fish) : 11/18/2007 5:45:55 AM GMT
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-11-18 05:57
    Rusty,

    The SoundPAL uses a weak internal pullup to provide a "high" level for serial communications. If the port pin you're using is loaded toward ground by another device, the SoundPAL's pullup current may be inadequate. You can either remove the additional load or augment the pullup current. A 4.7K resistor to Vdd may well do the trick.

    -Phil
  • Fe2o3FishFe2o3Fish Posts: 170
    edited 2007-11-18 05:59
    Me, MYself, & I said...
    After some 'sperimentation it looks like the program is hanging
    on waiting for 'iopin' to come up to 1. I shouldn't need to pull
    out the ULN chip for port B, do I? I wouldn't think so... cry.gif
    Guess I wuz wrong. I took out the ULN chip, powered up the beast,
    and the bugger starts playing 'CHARGE!' at me. <hrumph!>

    Guess I need to hit the books (PDF files) and see why that wuz
    gittin' in my way. <heavy sigh> Nevermind me. I'm just an OF
    that someone put a match to...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Rusty-
    --
    Rusty Haddock = AE5AE = rusty@fe2o3.lonestar.org
    **Out yonder in the Van Alstyne (TX) Metropolitan Area**
    Microsoft is to software what McDonalds is to gourmet cooking

    Post Edited (Fe2o3Fish) : 11/18/2007 6:04:16 AM GMT
Sign In or Register to comment.