View Full Version : Serial Plug in
Mark F
October 13th, 2002, 12:55 PM
Welcome to Girder!
This sounds like a handshaking problem. What handshaking have you set up for the device in the serial plugin? Also, do the baud rate, word size, stop bits and parity match the output of the stamp processor? Sorry, but I need to make sure of the basics first. :)
There is only one requirement for the data that the serial plugin can send to Girder. The data must not contain a binary byte of 0 until the final character. (it is a null terminated character string) If you are sending binary data, there is a checkbox on the receive message dialog of the serial plugin that allows you to translate all incomming data to hex strings (bin->hex).
To aid in debugging, I would suggest you download the logger plugin. This will show all the events passed through Girder. The serial device may be generating events that don't match your expectations. Or it may not be generating events at all.
We should be able to figure this out. :)
Mark F
October 13th, 2002, 12:55 PM
The problem I run into most often is a serial cable without all the wires. I don't know why the serial plugin reacts differently than serial watcher to the same connection wire, but it does. I need to look at this some more; but, in the mean time, this (http://www.airborn.com.au/rs232.html) page has some good pictures of serial cabling.
Mark F
October 13th, 2002, 12:55 PM
Another thought ... how does your stamp get power? Is it from the serial cable? If so, have you tried the RTS/DTR Power setting? If not, ignore me. :)
Mark F
October 13th, 2002, 12:55 PM
GREAT! I'm glad you got this working. :D
I don't know the limiting factors of your design (memory, speed, etc.) so ....
Assuming unlimited space, I'd make the messages (events) from the stamp Carriage return (0x0d) terminated ASCII strings. Things like "Right\n", "Menu\n" or "WinDVD\n". In the serial plugin, I'd set the receive message definition to variable length, 0d, strip terminator. Enable receive timeout, 40. No modem events, no prefix, no translate. Buffer = 201 (default).
With limited space, and assuming less than 256 unique events, I'd choose a two digit hex code (1 byte) for each command and send the code followed by the code XORed with -1. Assuming 0xA5 means WinAMP, I'd send 0xA55A. If 0x21 is Menu, I'd send 0x21DE. In the serial plugin, I'd set the receive message definition to fixed length, 2. Enable receive timeout, 40. No modem events, no prefix. Translate (bin->hex). Buffer = 201 (default).
Remember that the serial plugin makes the incoming data available in the payload data string [pld1]. This means it can be parsed using a Girder Variable Manipulation Script. If you need to send more complicated messages, separate the different parts with a specific character (comma, semi-colon, period, whatever) and you'll be able to parse these values into Girder registers very easily.
I hope this makes sense. :)
DavidS
October 13th, 2002, 12:55 PM
Question from a newbie. I would like to control the PC from a microcontroller (Stamp BS2) which will send out RS 232 codes to the COM port on the PC. I guessed that the serial plugin for Girder would let me do this, since it works on RS 232 bit I cannot get Girder to recognise anything coming in on the COM port. I have tried the ‘learn’ mode and telling the program what strings to expect, but no response. I have checked the COM port with a couple of terminal programs and they say that the data is coming in OK. Has anyone else tried this? Are there special codes I need to head the messages with – or do I have to emulate an IR receiver code?
Any help would be good!
DavidS
October 13th, 2002, 12:55 PM
Thanks, Mark. Confirmed protocol at both ends – 9600 baud, 8N1, no flow control. All matches out. Tried logger, and that does not see any events at all. Tried serial watcher, downloaded from a link on the Girder site, and that sees the serial events coming in without any problem.
I have set up the event string in using the serial plug in to be “AAA”. The Stamp sends this, and serial watcher reads it OK, logger does not. As you say, there must be a handshaking arrangement – but what is it? I have tried preceding the text string with various ASCII codes such as start of header, start of text but although serial watcher happily translates and displays these, logger does not respond at all.
Any further views appreciated! :-?
DavidS
October 13th, 2002, 12:55 PM
Aha! The problem was handshake. I have made the connections suggested by the site you referred me to which effectively make the pc give itself the return handshake - and it works! The links are (on a DB9) 1,6,4 joined together and 7 & 8 joined together. 2,3,5 are as before. Only problem is that the Stamp editor wants a different pin layout and so I'm developing at the moment using 2 sockets as needed. I'll sort that out later. I'm now puzzling over what the message should look like: should the girder EventString have a header, say, start of text, and/or an 'end of message' code?
Thanks for your help.
Powered by vBulletin® Version 4.1.8 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.