Multiple serial controlled devices?
joe from NY
Posts: 22
Hi, Is it possible to control multiple serial devices?
(such as a LCD mod and Text to speech mod)
If so, how is this accomplished?
Thanks Joe
(such as a LCD mod and Text to speech mod)
If so, how is this accomplished?
Thanks Joe
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Not the SIN an SOUT pins. Are the SIN/SOUT pins just for Programming and communication with the STAMP?
Lastly can you link me to·more information on the APPMOD protocol?
Thanks a bunch Joe
The AppMod protocol is very "loose" (we have no official documentation) and has just a couple important points:
1) The baud mode most be set to Open True so that multiple devices can exist on the same buss without collision (the device must work in Open True mode as well)
2) Each command is prefixed with a text header that always starts with "!" -- this is used for auto-baud calculation in some devices.· The Parallax Servo Controller, for example, starts its packets with "!SC" (for servo controller); the RC-4 relay board uses "!RC4".
You can actually use a BASIC Stamp to create an AppMod protocol-compatible device.· Let's say you were going to use the header MSD (for My Special Device); your SERIN line would look like this:
· SERIN Sio, Baud, [noparse][[/noparse]WAIT("!MSD"), address, command, dataByte]
Everything after the WAIT section is dependent on your device.· Have a look at the PSC, RC-4, and AP-8 documentation to see how we've implemented various commands in our products.· If you want to do something commercial, you can also use the SX controller and write the code in SX/B (very close to PBASIC).· In fact, all of the EFX products (RC-4, AP-8, DC-16) use the SX and are programmed in high-level SX/B.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
·· Then I started checking serout to LCD·from all BS2 pins; it worked only with pin2 and pin4!!! I suspected pins were damaged and tested all pins with output-low-high-low instructions to turn off-turn on leds. All BS2 pins work great with the leds!
What is the matter with the serout command?·
Thanks,
Inanes
Post Edited (Inanes) : 8/8/2006 7:58:29 AM GMT
You did wire a ground to the LCD panel, right?
And you did create a "CON" for the LCD_Pin, right?
And you didn't inadvertently change the baud rate, or anything like that, right?
·· Without seeing your code there isn't much we can offer.· Please post the code that does not work.· Thanks.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
allanlane5:
- I did ground the LCD
- I used a pin definition for the LCDpin rather than a con
- I did change the baud rate but again, pins 2 and 4 worked perfect for baud 2400, all other pins failed.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
4th robot law: A robot may not substitute a human to satisfy another human, as long as such satisfaction does not conflict with the 1st, 2nd, and 3rd law.
Inanes Pastas
Still sounds like a wiring error, though. Or, you've burned all pins except 2 and 4. This really shouldn't happen.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
4th robot law: A robot may not substitute a human to satisfy another human, as long as such satisfaction does not conflict with the 1st, 2nd, and 3rd law.
Inanes Pastas
[noparse][[/noparse]Edit - You aren't sending a CLS command, just the text, so you don't need the pause at all]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
(Later on...) Serout runs smooth in all pins now! The only thing I had to do was to remove the open mode from Baud definition. What a strange thing for pins 2 and four to work also for the open mode!!! Chris, why was that?
Shall I put a resistor to transmit line for the true baud for protecting my LCDpin, and·is the HIGH LCDpin really necessary, since my code works without it as well (and SEROUT command defines by itself the transmit pin as an output)?
These are·almost rhetorical questions·the main thing is my BS2 has left place for more serial devices now! Thanks to you pals!
You have set a fantastic support site here!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
4th robot law: A robot may not substitute a human to satisfy another human, as long as such satisfaction does not conflict with the 1st, 2nd, and 3rd law.
Inanes Pastas
Post Edited (Inanes) : 8/10/2006 4:34:28 PM GMT
Then I wanted to run an RCtime command (to read photoresistors) on pin 4 but it returned zero and occasionaly some unstable values not related to the sensor. I tried also pin2 and neither it could read RC. The same was with pins 0 and 6. The odd pins (1, 3, 5, 7) worked ok. No wiring, and no grounding problems found, I just placed the sensor wire to different pins and programmed BS2. I LED tested the pins output and worked ok for all pins. I am afraid the pins input has been damaged. I attached the code I did the tests:
' {$STAMP BS2}
' {$PBASIC 2.5}
sensor_left CON 3 'I/O control for the light sensor
sensor_right CON 4 'I/O control for the light sensor
left VAR Word 'Here is stored the time constant of the left photoresistor/RC-circuit
right VAR Word 'Here is stored the time constant of the right photoresistor/RC-circuit
HIGH sensor_left
HIGH sensor_right
PAUSE 3
RCcommand:
RCTIME sensor_left,1,left 'measure the light intensity on the left sensor
HIGH sensor_left
PAUSE 20
RCTIME sensor_right,1,right 'measure the light intensity on the left sensor
HIGH sensor_right
PAUSE 20
DEBUG ? left, ? right, CR
PAUSE 1000
GOTO RCcommand
Is this a problem with the even pins input???
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
4th robot law: A robot may not substitute a human to satisfy another human, as long as such satisfaction does not conflict with the 1st, 2nd, and 3rd law.
Inanes Pastas
Post Edited (Inanes) : 8/14/2006 8:15:35 PM GMT