using serial object
Siri
Posts: 220
I am very new to spin programing.I have worked with BS2 for some time.
What I am trying to do is to read 3 Bytes of data sent via a serial device to the propeller.
I know the easy way is to use a serial object - using the methods.
I am not exactly sure how to do this using spin code.
I also know you have reference the object.The problem I have is how write that code and how I can put the 3 Bytes in 3 different variables so I can then manupulate each Byte individuallyand also to display the values of each.. Byte as they are recived.
serial data (3 Bytes) -->LCD display ---> put the data in 3 variable --> manupulate data for calculations etc.
I know this is very easy for most of you - but I I do need the help untill I learn spin.
Thank you,
Siri
What I am trying to do is to read 3 Bytes of data sent via a serial device to the propeller.
I know the easy way is to use a serial object - using the methods.
I am not exactly sure how to do this using spin code.
I also know you have reference the object.The problem I have is how write that code and how I can put the 3 Bytes in 3 different variables so I can then manupulate each Byte individuallyand also to display the values of each.. Byte as they are recived.
serial data (3 Bytes) -->LCD display ---> put the data in 3 variable --> manupulate data for calculations etc.
I know this is very easy for most of you - but I I do need the help untill I learn spin.
Thank you,
Siri
Comments
Please do not "hijack" someone else's topic. Start your own
Siri,
Do you understand anything about the FullDuplexSerial object?
It is helpful for you to tell us what you do understand, not just what you want to do.
Have you looked at the comments in the source file for FullDuplexSerial?
In most of the objects in the library, the source code includes comments that partially explain how to use it.
Most objects that come with the Propeller Tool also have a sample or demonstration program included.
You'll need to use the "start" method and probably the "rx" method. "rx" is a function that returns the
next received character as an 8-bit value. It will wait if there are no characters in the receive buffer.
You didn't say what kind of LCD you have. If it's a serial LCD, you could use the Debug_LCD object from the
Propeller Object Exchange. This includes a Simple_Serial object and provides some methods for cursor positioning.
The Simple_Serial object is similar to the FullDuplexSerial object, but it is unbuffered, is written in Spin with no
assembly language, and is half duplex only (either sends or receives, but not both at the same time).
It's very useful for you to look at the existing code like that of the Debug_LCD object.