Need help sending serial data
Matthew H
Posts: 23
Hello,
I need some help programing my Propeller chip to send a serial command to a Pololu Micro Dual Serial Motor Controller. According to the manual, it expects eight bits at a time at a constant baud rate between 1200 to 19200 baud. The command must also be at logic levels and non-inverted. I have used this motor controller with my BS2 and in BS2 the command looks like this:
I am trying to send this string of data ($80,0,5,127) on pin 14 of of my Propeller, the code I am currently using is the following:
Tx refers to the FullDuplexSerial object that comes with the Propeller Tool. When I try to load it to RAM or EEPROM it says that I can't have a 0 in a string. The manual for the motor controller can be found here.
Thanks for any help you can offer,
Matthew
I need some help programing my Propeller chip to send a serial command to a Pololu Micro Dual Serial Motor Controller. According to the manual, it expects eight bits at a time at a constant baud rate between 1200 to 19200 baud. The command must also be at logic levels and non-inverted. I have used this motor controller with my BS2 and in BS2 the command looks like this:
SEROUT 5, 84, [noparse][[/noparse]$80,0,5,127]
I am trying to send this string of data ($80,0,5,127) on pin 14 of of my Propeller, the code I am currently using is the following:
Tx.Start(0,14,0,9600) 'Start serial driver Tx.str(string($80,0,9,127)) 'Send command: Motor 4 on at full speed
Tx refers to the FullDuplexSerial object that comes with the Propeller Tool. When I try to load it to RAM or EEPROM it says that I can't have a 0 in a string. The manual for the motor controller can be found here.
Thanks for any help you can offer,
Matthew
Comments
Best thing to do is to send one byte at a time by using the .tx() method in FullDuplexSerial. In your case, you'd have
Your suggestion will prevent the error message, but it won't do the job. It will send the characters "8", "0", "0", "9", "1", "2", "7", then it will send whatever stuff follows the "7" until it stumbles across a zero byte in memory which will stop the transmission.
I have a spin program which receive data with fulld.getdec and seems to give some strange results.
This data are strings which may enclose zeros (for exemple : 105) . And as for sending strings with zeros , is receiving strings with zeros a source of errors? and how to avoid it?
Cats92
Do you have specific examples of data that doesn't convert properly? Exactly what are the characters and what do you get as a result?
Remember that there are two different values discussed here with the name "zeros". One is the digit zero as a character ("0" or $31).
The other is the byte with the value zero which is used internally in Spin as a marker for the end of a character string.
FullDuplexSerial can transmit and receive the zero byte except in the "string" receive and transmit routines where it is used as the
string terminator.
Thanks for the help, Matthew