Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MsComm serial communication - EXTREMELY URGENT

Status
Not open for further replies.

svu

Programmer
Apr 10, 2000
30
0
0
TH
Dear friends,

I need your help badly. I've a device for which I'm supposed to write a program which will collect data. I'm using VB6 and MScomm to do this job. I can connect to device and send commands, but cannot receive any answer. Following are the details i know about it :
1. it uses xon/xoff for handshaking
2. commands are ASCII text
3. connection paramters are standard (9600,n,8,1)
4. Can be connected directly to printer for paper output of data.
5. Uses A-Synchrone serial communication.
6. pursued with "HDLC Like Framing" as described in RFC1662

This is my first program with serial communications. Althoug i could communicate with the modem. This device still keeps mum.

My job's at stake.

thanks
svu
 
You might look into the status of the DTR line, and see if it needs to be set before your device will trasmit data back to you.

Robert
 
thanks for ur attention. i tried having DTR true and false both.. even tried with rthreshold (0/1) and streshold (0/1) and all possible combinations. But to no success. trying this thing last 10 hrs...

I wish somehow i get thru.

thank you once again

regards,
svu
 
Hi,
I use a lot of serial communication but the first thing i check is to see if your comm port is outputting when i run into problems with communicating. If you connect pin 2 to 3 on your cable and then try to transmit then recieve some string like below you should recieve the string you sent. If not a cable or port issue might be the problem. Also make sure the reciever doesnt need a Carriage return or some specific character.

Private Sub cmdCom1_Click()

Dim BufferIn, BufferOut As String
BufferOut = "Com 1 Test Ok" & vbCrLf
Call ComInit1

txtCom1.Text = ""
txtCom1.Refresh
Delay (1)
MSComm1.Output = BufferOut
Delay (0.1)
BufferIn = MSComm1.Input
If BufferIn = BufferOut Then
txtCom1.Text = BufferIn
Else
txtCom1.Text = "Com FAIL" & vbCrLf
End If
MSComm1.PortOpen = False
End Sub

Public Sub Delay(Value1 As Double)
Dim PauseTime, Start
PauseTime = Value1 ' Set duration.
Start = Timer ' Set start time.
Do While Timer < Start + PauseTime

Loop
End Sub

 
my guess would be that if you're not receiving answers from the device, you are not sending the right commands, either that or it's broken. debug some of your values that you are sending and see if it's to specifications, maybe you are missing a termination character or perhaps you have to send an update command or something, could be a number of things.
 
thanks for your replies.

wlaflamme i'm having seperate buttons for send and receive. So, there is enough delay between to get the data.

sciophyte, the commands are right as far as I know. the termination char is Chr(13) as per the (little) documentation i have here. i spent last 10.3 hrs trying out the various possiblilities. hard luck, nothing works for me yet.

i have a running program which can work with the device comfortably. Except, the programmer who did this program is no longer around.

feeling nice u guys are around. thanks for ur company

regards,
svu
 
If you're serious into programming serial devices, for certain if it's for the job, I'd suggest hooking up a protocol analyzer between the PC and the device. It's is VERY difficult and VERY error-prone not to at least monitor the messages send by the PC and the device.....

Greetings,
Rick
 
Lazyme, thanks for ur reply. I agree with u to a large extent. But, I don have that facility out here. Need to figure it out only the software way. I now the lane is quite narrow, but somehow need to pass thru.

regards,
svu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top