PPDB: SerialTtransfer of 2 ServoValues from LinuxBox to the Board
nomad
Posts: 276
hi
i am working with Extended_FDSerial and Servo32
i want transfer 2 different ServoValues from my linuxBox to the Board via RS232.
values: 11_500, 21_150
1n_nnn = servoPort 0
2n_nnn = servoPort 1
with the linuxBox i can transfer the values
a) as: send :11500:21500:
acknowledge from Board "5"
b) or: repeat
send 11500
send 21500
acknowledge from board "5"
My questions:
is this possible with the Spin-Prog to receive 2 different Values
in one call
or must i do this with 2 calls
please give me some help or hints for this problem.
excuse my bad english
regards nomad
i am working with Extended_FDSerial and Servo32
i want transfer 2 different ServoValues from my linuxBox to the Board via RS232.
values: 11_500, 21_150
1n_nnn = servoPort 0
2n_nnn = servoPort 1
with the linuxBox i can transfer the values
a) as: send :11500:21500:
acknowledge from Board "5"
b) or: repeat
send 11500
send 21500
acknowledge from board "5"
My questions:
is this possible with the Spin-Prog to receive 2 different Values
in one call
or must i do this with 2 calls
please give me some help or hints for this problem.
excuse my bad english
regards nomad
Comments
Im not really sure if I understand right what you want to do.
For checking my understanding I write how I understand you
You have a RS232-serial device called "Linuxbox"
You can configure the Linuxbox to send the following string: ":11500:21500:"
all in all 13 characters (the double-points included)
Your questions is:
a) Can I send the string ":11500:21500:" to the propeller ?
b) Can the propeller acknowledge the receiving of such a string by sending the character "5" ?
answer to both questions is YES.
If you can make the Linuxbox send a different delimiter at the end example ":11500:21500#"
you can use the method RxStr from the Extended_FDSerial-object (ExtFDS) to receive that string
Sending single characters and sending complete strings is one main purpose of ExtFDS.
If you use the following mouseclicks: Mainmenu of Propellertool
file - archive - project ...
You can easily create a zipfile with all your code that is needed to compile your project.
We can take a look into your code and make detailed suggestions.
thanks for your answer
b) yes i can make different delimetesr in the linuxBox as: $11500:21500#
this is no problem.
the problem is in the propeller:
1) propeller receive the string: $11500:21500#
2) now the problem:
how can i assign the string into 2 variables:
as: long variable nickservo = 11_500
long variable turnsservo = 21_500
now the propeller works with this 2 variables.
if ok, propeller send the acknowledge "5"
i hope its now clear.
i attached the spin-source for this project
the linux-source is about 10_000 lines, in C++ and for my linux 64bit with a IntelQuad
t
thanks for help
regards nomad
l
please create an archive of your project by using
propeller-tool main-menu file - archive - project ...
to create a ZIP-file that contains ALL files that are nescessary to compile your project.
For you this is two clicks away and makes it comfortable for the people that are helping you
that they are not forced to download objects from the obex or comment them out to make
the project compile
anyway:
can you reconfige your linuxbox to send two SEPERATE strings which both start with the port without the "$" or the ":" ?
or leave out the "$" and change the ":" and the "#" to a carriage-return
so the string looks like that "11500<13>21500<13>"
where <13> means ASCII_code decimal 13 which is the carriage return
the method rxDec uses the carriagereturn as the delimiter
see code of
then your construction with using
will work this way
If you cant change the linuxboxstring this way:
Every string is stored in a bytearray
Your string has always the SAME structure.
Let's assume you string contains "$11500:21500#"
this means:
Now you can take each single byte and convert to an integer value and do with it whatever you want.
Example:
in the obex there is also a string-object for string-manipulation-operations
as extract a substring etc. and then convert the substring "11500" to an integervalue
best regards
Stefan
Post Edited (StefanL38) : 9/29/2009 7:33:33 PM GMT
OK
thanks a lot
but i think, its simple, when i done my original code on linux and on spin.
your way is slower, i must this done in realTime.
also:
linux send (1) propBox receive (1) send acknoledge
linux send (2) propBox receive (2) send acknowledge
this is faster
but thanks for your help
regards nomad
Then my suggestion is to increase the baudrate up to 115200 baud this is more than 10 times faster than 9600 baud.
and then you have time for all kinds of processing the data in spin.
At 9600 baud the bottleneck is the baudrate not the dataprocessing
best regards
Stefan
Post Edited (StefanL38) : 9/30/2009 3:59:09 PM GMT
i know
thanks for your replay
regards nomad