send the hex data

Status
Not open for further replies.

alex_up

Member
You can send data as a string or as an array of bytes.
What type of data do you have? Can you give us a small example of it.

Erel ,
I need to send for example follow data:

1. 7E 40 25 01 00 00 8E 03 09 40 7E
2. 7E 40 25 00 00 00 8E 03 A3 11 7E

here two commands


Regards,
Alex
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
I've modified the SerialTermial example to parse the data, convert it to a bytes array and send it.
bit is a Bitwise object.
The complete source code is attached.
B4X:
Sub btnSend_Click
    strings() = StrSplit(textBox1.Text," ")
    Dim data(ArrayLen(strings())) As byte
    For i = 0 To ArrayLen(strings())-1
        data(i) = bit.HexToDec(strings(i))
    Next
    If serial.PortOpen = true Then serial.Output2(data())
End Sub
 

Attachments

  • a.sbp
    3.1 KB · Views: 193

alex_up

Member
I've modified the SerialTermial example to parse the data, convert it to a bytes array and send it.
bit is a Bitwise object.
The complete source code is attached.
B4X:
Sub btnSend_Click
    strings() = StrSplit(textBox1.Text," ")
    Dim data(ArrayLen(strings())) As byte
    For i = 0 To ArrayLen(strings())-1
        data(i) = bit.HexToDec(strings(i))
    Next
    If serial.PortOpen = true Then serial.Output2(data())
End Sub



Erel its great!!!
Its work!
Thank you very very match!!!
Best regards,
Alex.
 

alex_up

Member
Erel its great!!!
Its work!
Thank you very very match!!!
Best regards,
Alex.

Erel ,can you create Text ini file for 20 commands ,with 20 buttons?
Its very hard?

I am sorry for my stupid questions but its necessary for me (i beginning user)

Regards.
 

alex_up

Member
Erel,
Why compilled Device.exe not run on my PPC (Error loading programm .....\Serial2.dll)?
It's work only under Basic4ppc ,from source code.

Operation system WM2003SE, .NET CF 2.0 and Bitwise.dll,Serial2.dll installed.

Regards.
 
Status
Not open for further replies.
Top