05-13-2006 05:45 AM
05-13-2006 11:49 AM
What do you mean with "binary format" ? Can you provide an example ?
Lil a écrit: ... The output from the tilt sensor is in binary format and i want to change this to ASCII format in order to read the output...
05-15-2006 05:57 AM
This is the example that was provided with the spec sheet. i dont know if this is any help. i am currently using software called vxHPC on the pda which is similar to hyperterminal for the pc. At the moment this is not showing any info coming from the tilt sensor but i am told this is due to the fact that the tilt sensor is ouputting in binary but vxhpc will only accept ASCII. i have previously written a simple read and write program in labview to communicate with a programmable psu and when i run the program connected to the tilt i get a load of -well waffle- in the reponse section which i presume is the tilt communicating but that it is not being recognised.
I hope this gives a bit more background but if you need more info please ask.
Data format:
The MSByte is sent first.
9600baud rate
1 start bit
1 stop bit
Parity Even
Start,b0,b1,b2,b3,b4,b5,b6,b7,Stop
Examples
Byte 1001 0110 and 0101 0101
A/D converter
→ Hex 195 → Dec 405 → -56.27 DegByte 1101 1110 and 0011 0011
AD converter
→ Hex 3B3 → Dec 947 → -37.71 DegCheers Lil
05-15-2006 06:59 AM
Lil a écrit: ... ExamplesByte 1001 0110 and 0101 0101
E466
A/D converter
→ Hex 195 → Dec 405 → -56.27 Deg
The binary to HEX conversion does not make much sense to me. The bit pattern correspond to $9655. Even using Gray code, this gives $E466. The fact that the last nibble is repeated twice (0101 0101) while there is not char repetition in the corresponding Hex string is unexpected.
Nor can I translate 195 into -56.27
The communication seems to flollow a simple and standard serial protocol, but the information coding is not simple. Seems that you'll need to provide more details...
05-15-2006 07:36 PM
05-16-2006 04:53 AM
05-16-2006 05:40 AM
The two-bits stripping was not at all evident to me. Did you discovered it, or was it explained somewhere ?
When applied to the other bit string provided as example, it yields a different result ($595 - dec 1429) instead of $195 (dec 405). Are byou sure of your code ?
05-16-2006 08:44 AM
Well the spec sheet pointed me in the right direction but it was very unclear and did take me some time to figure out. If you use the same theory for the other example then the binary of 00 1110 11 0011 will yeild 947 dec.
i am providing my first attempt at the program which is very simply recieving the data from the tilt and displaying what i presume is the ascii equivalent as the response is currently reading in a string. What i need the program to do is to take the two bytes of info (msb&lsb) and strip out the first two bits of each byte. Then the 12 bits remaining have to be put together and converted to decimal. I am very new to this language and all of this is way beyond me so any help that you could provide however small would be great!
Cheers,
Lil
05-16-2006 10:28 AM
05-16-2006 11:02 AM