Fuji Electric PXG-9 Communication Instruction Manual page 76

Digtal controller micro controller x communication function (rs-485 modbus)
Hide thumbs Also See for PXG-9:
Table of Contents

Advertisement

' Setting the Communication Number for the Other Party ***************************************
St = Val(Stno1(idx).Text)
Stno = St Mod 256
Stno1(idx).Text = Str(Stno)
' Processing the Address *********************************************************************
AD$ = Str(Val(Address(idx).Text) - 1)
AD$ = Right$(("00000" & AD$), 5)
Area = Val(Left$(AD$, 1))
Adrsh = Int(Val(Right$(AD$, 4)) / 256)
Adrsl = Val(Right$(AD$, 4)) Mod 256
'Creating the Send Command *******************************************************************
Select Case Area
Case 4
'Normal sending data is processed.
Dim byteData(3) As Byte
Dim sHex
As String
sHex = Right("00000000" & Hex(Val(Write_data.Text)), 8)
byteData(0) = CByte("&H" & Mid(sHex, 1, 2))
byteData(1) = CByte("&H" & Mid(sHex, 3, 2))
Chapter
byteData(2) = CByte("&H" & Mid(sHex, 5, 2))
8
byteData(3) = CByte("&H" & Mid(sHex, 7, 2))
ReDim Txdat(12) As Byte
Txdat(0) = Stno
Txdat(1) = &H10
Txdat(2) = Adrsh
Txdat(3) = Adrsl
Txdat(4) = &H0
Txdat(5) = &H2
Txdat(6) = &H4
Txdat(7) = byteData(2)
Txdat(8) = byteData(3)
Txdat(9) = byteData(0)
Txdat(10) = byteData(1)
Txsu = 10
Case Else
MSComm1.PortOpen = False
Write_command.Enabled = True
Exit Sub
End Select
' 13 bytes
' Station No.
' Command
' High address
' Low address
' Write no. of words (High)
' Write no. of words (Low)
' Write no. of bytes
' Write data (Lo high)
' Write data (Lo lo)
' Write data (High high)
' Write data (High lo)
' No. of sent data
' For other values
' COM port close
– 74 –
'Decimal to hexadecimal
'hh byte
'hl byte
'lh byte
'll byte

Hide quick links:

Advertisement

Chapters

Table of Contents
loading

This manual is also suitable for:

Pxg-5Pxg-4

Table of Contents