This small tutorial will show you how can get connect MGCplus with your program. Why I decide to upload this, when I was going to develop my
program had to face difficulties, and It was a s
o hard task for me.
ok ...
fallow this steps ...
Step1.
First of all you should aware about the keywords require to communicate via com port. this may be GREEK for you, go to this link and refer this document.
Then create an account and download the file fro
m there. It is a ziped file.
Step2
Then open your program and just import a Microsoft COM component to the project and change its properties in this way.
Important :- In this image I have set the baud rate as 38400, but if you have somewhat old MGCplus it may support for 9600 like lower baud rate. so first refer Ma
nual ( given in LINK1) .
Other all settings are same.
Even if there is an error check the parity bits, bits per packet and other settings given in manual.
38400,e,8,1
OR
9600,e,8,1
8 - is number of bits per packet.
1 - parity
Step3
Now your port configuration almost finish. Then move to codings. Now you should have referred the keyword document then this will easy.
here I'll past my VB6 code and the picture of the form then you can just try it out. (This program I have written for get the readings from Loadcells change your codes according to the usage )
All the name of the textboxes are wrote in the textboxes.
Add a timer and change its parameters according to property window
CODE-----------------------------------------------------------///
Private Sub Command1_Click()
Dim Instring As String
MSComm1.Output = "rmv?203,1;"
Do
DoEvents
Buffer$ = Buffer$ & MSComm1.Input
Loop Until InStr(Buffer$, vbCrLf)
Text3.Text = Buffer$
Text4.Text = Left(Right(Buffer$, 10), 1)
If Left(Buffer$, 1) = "-" Then
Text1.Text = Left(Buffer$, 8)
Else: Text1.Text = Left(Buffer$, 7)
End If
If Left(Buffer$, 1) = "-" Then
If Left(Right(Buffer$, 10), 1) = "-" Then
Text2.Text = Mid(Buffer$, 10, 8)
Else: Text2.Text = Mid(Buffer$, 10, 7)
End If
Else
If Left(Right(Buffer$, 10), 1) = "-" Then
Text2.Text = Mid(Buffer$, 9, 8)
Else: Text2.Text = Mid(Buffer$, 9, 7)
End If
End If
End Sub
Private Sub Form_Load()
Dim Instring As String
If MSComm1.PortOpen = True Then
MSComm1.PortOpen = False
End If
MSComm1.CommPort = 1
MSComm1.Settings = "38400,E,8,1"
MSComm1.InputLen = 0
MSComm1.PortOpen = True
MSComm1.Output = Chr$(18)
MSComm1.Output = "mvf1251;"
MSComm1.Output = "ics5,110;"
MSComm1.Output = "SRB0;"
MSComm1.Output = "COF1;"
MSComm1.Output = "Cal;"
MSComm1.Output = "enu1" & Chr$(44) & Chr$(34) & "mV/V" & Chr$(34) & Chr(59)
End Sub
Private Sub Timer1_Timer()
Command1_Click
End Sub
CODE-----------------------------------------------------------///
This code may not clear just copy and past your VB6 form code.
:
:
MSComm1.Output = "mvf1251;"
MSComm1.Output = "ics5,110;"
MSComm1.Output = "SRB0;"
MSComm1.Output = "COF1;"
MSComm1.Output = "Cal;"
:
:
these are set of keywords given that require to communicate with those are given in the keyword list from HBM.
change those according to your requirments, may be you have to add more..
Tell me if there is any problem
like feedbacks..
thank you all....................
good luck guys............