Serial communication in B4A: question!

Beja

Expert
Licensed User
Longtime User
Hi friends,

Browsing the forum I couldn't find a post about serial communication, but I believe it is there hiding somewhere. I want my app be able to communicate with a controller using standard serial port (rs232, rs485, usb). I will compile a string of values then send it as byte array.

Any help appreciated.
 

Beja

Expert
Licensed User
Longtime User
Thanks Erel,
in vb I used to write:
dim sent (1 to 9) as byte
dim WindSpeed as String '(there is a purpose for string representation)
WindSpeed = "select WindSpeed from weather where ID = .... and so on"
sent(1) = &H7F
.
.
sent(9) = "&H" & WindSpeed '(assuming WindSpeed contains valid Hex value)

MSCOMM1.Output = sent

Then I send the array to the device by way of direct serial connection,
I use RS485 communications for easy interface. (No special comm. protocol).
but with smartphone I must use the USB port, and design USB port in the device's PCB as well.

I will be using B4A mostly in communications and data acquisition (SCADA systems)
 
Upvote 0

Beja

Expert
Licensed User
Longtime User
No I will not use USB <-> Serial converter, converters bought from Radio Shack will go nowhere. I will incorporate USB HID circuit on
the PCB.. so I will have USB connector on the device side and no driver
needed.. I believe Android 4.0 has HID driver built-in. will try!, but the
thing is how to interface using B4A.
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
Upvote 0
Top