Stupid Question <FullDuplexSerial>
grasshopper
Posts: 438
This is a stupid question but i cant seem to figure it out
It wont send the data "0" out the serial port. I guess i need to send various conditions of my program i.e startbit and Sorc etc...
Help is appreciated
Main StartBit := "0" SorC := "-" Sor3 := "+" ser.str(string(startbit))
It wont send the data "0" out the serial port. I guess i need to send various conditions of my program i.e startbit and Sorc etc...
Help is appreciated
Comments
Without knowing more background on what you are trying to do, it's hard to point you in the right direction. The answer may be as simple as ser.tx(StartBit).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
Post Edited (Paul Baker (Parallax)) : 9/15/2008 11:51:44 PM GMT
I will have my variables as a byte. I not only want to use the "+" and "-" but also a "0" and"1". these variables will be toggled in my program and then "glued" together in one long string for a user to note the current condition of the device I am designing.
i.e a returned string would look something like this on the computer side
The pseudo propeller code would look like this
Mike I will try some thing like you demonstrated.
After reading this over and over I ask you this...
A character is how many bits? I am imagining 8 bits, not sure but 1111 = 15 so this is directly related to hex or F or 1/2 a byte since "A" = $41
A Long can hold how many characters? perhaps 32 bit? thus = 1111 1111 1111 1111 1111 1111 1111 1111 or 4 characters?
and while i am asking may as well ask what the hell a <<8 is doing? Bit shifting left? Why left? Why not right?
Thanks for any help ...
What you wrote will also work if you change everything to WORDs (with VAR WORD SorB, SorC, SorD, SorE)
and put "@" in front of the variable names like: ser.str(@SorB)
Again, this is because a single character stored in a WORD looks the same as a byte with the character
followed by a zero byte (which makes it a string to Spin).
as you send single bytes i would prefer the command for sending a single byte
so your code posted above would be changed to
best regards
Stefan
This does not work... Hum
I even tried making the variables a long as well
That said, why do you have "Pub Running"? That creates a separate method (subroutine) which is never called.
Try putting "Running" after the 'SorE := "+"' line or simply removing the "Pub Running".
Here is the code that works but not efficient.
I have tried all of the examples listed but no luck, The one i posted works but it is not a great way to go about it. The variables will change during run time
How about posting what you really used? Try attaching the file to your message so there's no possibility of the forum software "eating" some of it.
the following code IS running on my propeller
So if it does not run on yours it's NOT a coding-problem
Then the problem must be somewhere else
best regards
Stefan