PDA

View Full Version : PWMPAL help



davidss
02-09-2005, 07:59 AM
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, ["!PMWGS"]
SERIN 0, 6, [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

Jon Williams
02-09-2005, 08:34 PM
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, ["!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, ["!PWMGS"]


... and will work with any BS2 module.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas, TX· USA

davidss
02-09-2005, 11:31 PM
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 Williams
02-09-2005, 11:48 PM
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