Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DPRAM (CLIPPER) in VB.NET is not working
#1
Dear All,

I am working on VB.NET project. We want to fetch parameter from DPRAM (CLIPPER).

But I am unable to fetch parameter from DPRAM. Please help me to overcome from this issue. Here I am attaching some code from PLC and in VB.NET. Here I am fetching axis enabled status. But its always give me false result even after axis is enabled.
;Configuration of DPRAM variable
I24=$60000
;==== PLC CODE =====
CLOSE
DELETE GATHER
M2100->F:$60DC4
M2101->F:$60DC5
M2102->F:$60DC6
OPEN PLC1 CLEAR
;===== Enable Status
M2100 = M139
M2101 = M239
M2102 = M339
CLOSE

'====== VB.NET Code to read DPRAM=====
Public mem(3) As Single
Public Function fetchFromUMACmemoryBlock() As Boolean
PmacDPRGetMem(0, &H3580, 3 * 4, mem(0))
populateFromUMAC()
End Function

Public Sub populateFromUMAC()
Var.aIn.M1Enabled = mem(0)
Var.aIn.M2Enabled = mem(1)
Var.aIn.M3Enabled = mem(2)
End Sub

'=== Module for API declaration
Public Declare Function ClosePmacDevice Lib "pcomm32W.dll" ( _
ByVal dwDevice As Integer) As Boolean

Public Declare Function OpenPmacDevice Lib "pcomm32W.dll" ( _
ByVal dwDevice As Integer) As Boolean

Public Declare Sub PmacDPRGetMem Lib "pcomm32W.dll" ( _
ByVal dwDevice As Integer, _
ByVal offset As Integer, _
ByVal count As Integer, _
ByRef val As Single)
Thanks,
Amar
Reply
#2
Try using integer definitions in DPRAM instead of floating point.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)