Having problem to find a solution.
Germt van de Sande
Posts: 8
I have a file that has some data.
Like:
0000:f0
0001:02
0002:14
0003:00
0004:00
0005:01
0006:01
0007:36
0008:00
0009:80
000a:1c
000b:00
000c:00
000d:4e
000e:65
000f:77
0010:20
Now i need to send the data to a serial port.
I only need the last 2 of line 1.
So from line 1 i have F0. but i want it send like a HEX value $F0 to the port.
I need to send every line after the other.
I try a lot to have it work but i dont see it anymore.
I am reading the file, reading line 1 and get the last 2 with right_string(buffer,2)
is there someone that can help me?
Like:
0000:f0
0001:02
0002:14
0003:00
0004:00
0005:01
0006:01
0007:36
0008:00
0009:80
000a:1c
000b:00
000c:00
000d:4e
000e:65
000f:77
0010:20
Now i need to send the data to a serial port.
I only need the last 2 of line 1.
So from line 1 i have F0. but i want it send like a HEX value $F0 to the port.
I need to send every line after the other.
I try a lot to have it work but i dont see it anymore.
I am reading the file, reading line 1 and get the last 2 with right_string(buffer,2)
is there someone that can help me?
0
Comments
I think HEXTOI() will do what you want. If you take the string that you get with your right_string() and do HEXTOI() on that result, you'll get an integer that has the same value as the hex characters. For instance, F0 in ASCII will turn into 240 in an integer variable. Then you can do send_string to send the string to the serial device. Here's the basic code for just that part...
I've tested something similar and it does exactly what you want. Hope that helps.
iT WORKS... Thanks a lot, now i can sleep tonight.
Glad I could help.