Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

I'm confusing...??? (about VB6 and VB2008 Serial Communication) please help...

Status
Not open for further replies.

boyguitar1

Member level 1
Joined
Nov 8, 2010
Messages
33
Helped
12
Reputation
24
Reaction score
12
Trophy points
1,288
Activity points
1,486
Hello...

Now i'm need to send some command via serial port but I found the issue below.
Example:
1. use VB6
Code:
MSComm1.Output = Chr(192) & Chr(38)
and I used program Free Serial Port Monitor check the command.
I can see as " C0 26 " This is correct!!

2. 1. use VB2008
Code:
 SerialPort1.Write(Chr(192) & Chr(38))
and also I used program Free Serial Port Monitor check the command.
I can see as " 3F 26 " this not correct!! (0x3F = Chr ? = Dec 63 )
Why ???????


Please help me why not ??? or My code is incorrect ??:cry:

I tried to do many code but not work!! for VB2008



Thank in advance
boy...
 

If you use the SerialPort1.Write method then the argument must be a byte, not a string.

Convert the chr/hex value to a byte.
 

Hope this code will help

Code:
Dim targetNumber(1) As Byte

targetNumber(0) = 192
targetNumber(1) = 38

SerialPort1.Write(targetNumber, 0, targetNumber.Length)
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top