11-10-2009 12:27 PM
Guys,
If you look at this diagram:
If I use the RED box and send to serial port then my receiver would keep getting random 1 and 0 but if I use the blue box, I get exactly what I'm sending. I prefer the RED box method because it allows me to send more customizable pattern of 1 and 0. Could someone please tell me what have I done wrong and should I do to make it right? Thanks
11-10-2009 12:47 PM - edited 11-10-2009 12:49 PM
You are confusing binary and ASCII.
Your upper part is taking 16 characters of A. Then picking them off 1 at a time and converting them to the U8 equivalent of that character, which is hexA or decimal 10. It is the new line character.
Your lower part is taking an I64 quad integer which is hex value AAAA AAAA AAAA AAAA and flattening that to a string. Since each pair of A's is a byte, you have hex AA or decimal 170. So you have 8 of the hex AA ASCII character which is the raised little "a" in the extended part of the ASCII table.
So the results are two completely different strings. I'm not sure what you mean by "random ones and zeroes". There is nothing random about them. They are just the binary representation of whatever ASCII characters you are sending.
One problem you might have in your loop is that you are sending out the data over and over again with a 0 millisecond wait. You are probably going to flood your serial port buffer by loading it with data faster than it can send it out.
11-10-2009 01:03 PM - edited 11-10-2009 01:07 PM
You're right so I changed it to flatten but I'm still getting the same problem. The modem intepreted it as random 1 and 0 because that is what's being shown on my modem received side. Here is my attachment.
11-10-2009 01:12 PM
Reference to post #3:
This is the data pattern that I'm getting on the receiver side:
000000000000000000000000010100000000000000000000000000000101000000000000000000000000000001010000000000000000000000000000010100000000000000000000000000000101000000000000000000000000000001010000000000000000000000000000010100000000000000000000000000000101000001010000000000000000000000000000010100000000000000000000000000000101000000000000000000000000000001010000000000000000000000000000010100000000000000000000000000000101000000000000000000000000000001010000000000000000000000000000010100000000000000000000000000000101000000000000000000000000000001010000000000000000000000000000010100000000000000000000000000000101000000000000000000000000000001010000000000000000000000000000010100000000000000000000000000000101000000000000000000000000000001010000000000000000000000000000010100000101000000000000000000000000000001010000000000000000000000000000010100000000000000000000000000000101000000000000000000000000000001010000000000000000000000000000010100000000000000000000000000000101000000000000000000000000000001010000000000000000000000000000010100000000000000000000000000000101000000000000000000000000000001010000000000000000000000000000010100000000000000000000
11-10-2009 01:28 PM - edited 11-10-2009 01:33 PM
Ok, I've made a little progress. I added an I8 to the output and into Flatten Anything and this is what I'm getting on the receiver side:
010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000010100000101000001010000
This appears to be converting to I16 instead of I8. Is there a way to force it to always go down to I8 at all time?
11-10-2009 01:40 PM
How did you get your characters of 1's and 0's. Is the other side of the modem converting the boolean bits to 1's and 0's?
It looks like you are basically getting a 32 bit pattern there. I'm not sure exactly where it starts. But 32 bits makes sense since you are going from character A and converting that to a U32 number which is the default datatype for your hex string to number conversion. (Wire a U8 constant into that function and you will get 8 bits).
You are also ending your write with another hex 0A since you have the write termination character enabled.
What are you really trying to do here and why?
Perhaps rather than messing around with the datatype conversions as you are doing, you could just create boolean arrays, convert them to U8 bytes arrays, and convert them to string characters.
11-10-2009 01:56 PM
The 'A' in your string is not equal to hexidecimal 0xA or 0xAA. Change the view of the string constant 'A' to "Hex Display" and you will see that ASCII 'A' is 0x41. After you change the view to hex display type in AA and you should get a 01 binary pattern.
11-10-2009 03:12 PM
11-10-2009 03:15 PM
Finally, I got it!
010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101