# Commands for Communication using VB

K

#### kiran

I am trying to communicate with a hardware based on RS 485 network. The procedure for the same is
Initialise the hardware by sending the command : Hex (81) {CR}. For getting the data : "RA : " this command is in ascii.

I am trying to communicate using VB but facing some problem. When I initialise the hardware using dos based COMM485 software and then sending
the command "RA" from VB I receive the correct values. But when I try to initialise the hardware by sending the command Hex (81) {CR} from VB, I am not able to communicate.

I think I am making some error in the command. It is something to do with Hex format.
Can any body suggest me the exact command in VB for the initialisation for my application?

Regards

Kiran Marekar

R

#### Raymundo D. Balderas

If you could post a segment of your code I think, it would be better to understand.

=====
Best Regards

Raymundo D. Balderas
[email protected]
(Automation Division)

C

Kiran,

If you are using the MSComm object, you will need to check the InputMode property. Make sure it is set up for binary mode, otherwise it will default to unicode. If you would like some sample code, email me at [email protected].

Regards, CF

P

#### Philip Irwin

conrad or anyone else that can help,
i was searching online because i am haveing trouble with sending hex code through a rs232 cable to a cash acceptor from a vending machine for a project i am working on, i found a comment that you had written some time ago on this page and was wondering if you had any pointers on how to get going, if you would like i can send you the code that i have been trying, but it doesnt seam to do the trick, i have a program written in C++ that works but need to make a simpler one in vb because thats what everything else is working with. please help if you can, you can email me at [email protected]
Philip Irwin
Programmer
Dechow Consulting>

K

#### Kevin MacMillan

'rename Form1 to modem
'rename MSComm1 to Comm

modem.Comm.CommPort = 1
modem.Comm.PortOpen = True
modem.Comm.InBufferCount = 0
modem.Comm.InputLen = 0

DLE = Chr$(&H10) STX = Chr$(&H2)
ETX = Chr$(&H3) ACK = Chr$(&H6)
CR = Chr\$(&HD)
modem.Show

'Put your "Do While ??" What ever you want to do!