Shop OBEX P1 Docs P2 Docs Learn Events
PWMPAL help — Parallax Forums

PWMPAL help

davidssdavidss Posts: 5
edited 2005-02-09 16:48 in BASIC Stamp
I have tried everything I can think of to get this PWMpal to work with my BS2p24 and it just won't respond. I send it the following program:

SEROUT 0, 6, [noparse][[/noparse]"!PMWGS"]
SERIN 0, 6, [noparse][[/noparse]status]
DEBUG status

and it never gets past the SERIN. Should I be setting all the pins to input mode before this? Does anyone have any clues not mentioned in the manual? I searched this forum and on google and I couldn't find any new ideas.

Thanks for your help.

-DAvid

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-02-09 13:34
    The trouble is you need to change the baudrate parameter for the BS2p -- the documentation shows syntax for the BS2.· The correct baud parameter for 38.4K on a BS2p is 45.· Change your serial lines like this:

    SEROUT 0, 45, [noparse][[/noparse]"!PWMGS"]
    


    Better yet, add this to the top of your programs that require serial routines:

    #SELECT $STAMP
      #CASE BS2, BS2E, BS2PE
        T1200       CON     813
        T2400       CON     396
        T4800       CON     188
        T9600       CON     84
        T19K2       CON     32
        TMidi       CON     12
        T38K4       CON     6
      #CASE BS2SX, BS2P
        T1200       CON     2063
        T2400       CON     1021
        T4800       CON     500
        T9600       CON     240
        T19K2       CON     110
        TMidi       CON     60
        T38K4       CON     45
    #ENDSELECT
     
    SevenBit        CON     $2000
    Inverted        CON     $4000
    Open            CON     $8000
     
    Baud            CON     T38K4
    


    Then your code becomes...

    SEROUT 0, Baud, [noparse][[/noparse]"!PWMGS"]
    


    ... and will work with any BS2 module.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • davidssdavidss Posts: 5
    edited 2005-02-09 16:31
    OMG THANKYOU SO MUCH!

    I have to go try that right now! I just wish I had keys to the lab.

    I'll post back my progress later.

    Thanks again.

    -David
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-02-09 16:48
    You're welcome -- and thank you for the post. I just went through the PWMPAL docs to clarify the baudmode values and make sure that the conditional compilation definitions were embedded in the examples.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
Sign In or Register to comment.