Quick question about serial connection...
Joms
Posts: 279
I am just starting to·write code that will send serial data to a stamp.· I am taking this little steps at a time.
When I utilize the program from the labs called 'EnterAndDisplayValues', I can make it display on the terminal.
I hooked a serial cable from pins 2/3 on the computer to pins 26/27 on the prop.· Also hooked pin 5 from the computer to ground from the prop.· I tried to modify that program so it uses pins 26/27 (baud 9600) and send data to the Parallax Serial Terminal looking at com1 using baud 9600.
I can not make it output anything, even though I would expect it to work as normal.· I have changed mode settings on the FullDuplexSerialPlus object and·if I choose mode 1, it will output 'junk', other then that, nothing...
It must be something pretty simple I am overlooking, does anyone have any ideas?
Thanks...
Post Edited (Joms) : 3/18/2009 2:14:29 AM GMT
When I utilize the program from the labs called 'EnterAndDisplayValues', I can make it display on the terminal.
I hooked a serial cable from pins 2/3 on the computer to pins 26/27 on the prop.· Also hooked pin 5 from the computer to ground from the prop.· I tried to modify that program so it uses pins 26/27 (baud 9600) and send data to the Parallax Serial Terminal looking at com1 using baud 9600.
I can not make it output anything, even though I would expect it to work as normal.· I have changed mode settings on the FullDuplexSerialPlus object and·if I choose mode 1, it will output 'junk', other then that, nothing...
It must be something pretty simple I am overlooking, does anyone have any ideas?
Thanks...
Post Edited (Joms) : 3/18/2009 2:14:29 AM GMT
Comments
Also ... with the 33k resistor method (but a MAX3232 type chip is recommended) keep the baud rate down, 9600 will work for sure though.
-tellurian
Post Edited (tellurian) : 3/14/2009 3:14:53 AM GMT
I think I smoked it... Any program appears to load fine, even to the EEPROM, but I can't seem to make it do any more then that. I am going to go back and get a quick program just to make some LED's flash and see if I did it in. After all it is Friday the 13th [noparse]:([/noparse]
On a good note, they are cheeper then the BS2!
Is there any documention that discribes how to use the FullDuplexSerialPlus? I am having problems making it output the text I want it do...
PUB start(rxpin, txpin, mode, baudrate) : okay
PUB stop
PUB tx(txbyte)
PUB rx : rxbyte
PUB rxflush
PUB rxcheck : rxbyte
PUB rxtime(ms) : rxbyte
PUB str(stringptr)
PUB getstr(stringptr)
PUB dec(value)
PUB GetDec : value
PUB StrToDec(stringptr) : value
PUB bin(value, digits)
PUB GetBin : value
PUB StrToBin(stringptr) : value
PUB hex(value, digits)
PUB GetHex : value
PUB StrToHex(stringptr) : value
I know what most of them do, but I am trying to make the decimal "1" show up in hex as "30, 30, 30, 31".· In this case 1 is actually a charactor, but in is a variable from somewhere else in the program.
Attached are two files to give you a better idea of what I am doing, instead of trying to explain all of it.· One is something I made for the stamp and works great, I will want to do the same thing as that, only on the propeller.· The second is a PDF that explains what I am trying to calculate and send out of the propeller.
Basically I am taking two variable, source (src), and destination (dest); calculate a checksum and send the data out as serial.· I figured I would post the whole thing now because I know I will have problems when it ends up time to calculate the checksum.
After I get this part figured out I am pretty sure I can figure out the next steps, which will basically changing the request command and variables.
Main Questions:
Do I need another object to do the conversions or is it just a few lines of code in my current object?
Second, do I actually use the FullDuplexSerialPlus.hex to output the data in the form I need?
Third, should I look deeper into the strtohex command for this application?
Thanks in advance for all your help!· It took me a while to program in the stamp, now I am just done with all the information about the propeller and just starting my own coding...
will do what you want (I think) for example if you do
ser.hex( 1, 4)
it will send 0001 to the serial port
or do you literally want 30, 30, 30, 31
in which case you can write a simple function to do that.
-tellurian