Search the Community
Showing results for tags 'dll'.
Hi, I managed how to get data from database using read_db function from activex.dll in vb6. I want to read whith copymemory function a float value from database but i get a large decimal number with cientific notation. Also i cannot read the entire database, so im doing it in groups of 19 cuz if i do 20 i get an error "9 Subscript out of range". Here is my code: Private Sub LeerBD() Dim Valores() As Byte Dim i As Integer Dim iFecha As String Dim iHora As String Dim iTipo As String Dim iLote As Long Dim iTemCam As Double Dim iHumedad As Integer Dim iPresion As Integer Dim iPeso As Double Dim iEst As String Dim Pointer As Long Dim grupo As Long On Error GoTo mal For grupo = 0 To 101949 Step 19 * 51 Call mComDriver.Read_DB(grupo, 19, 51, 51, Valores) Pointer = 0 For i = 1 To 19 iFecha = PointerToString(VarPtr(Valores(Pointer))) Pointer = Pointer + 10 iHora = PointerToString(VarPtr(Valores(Pointer))) Pointer = Pointer + 10 iTipo = PointerToString(VarPtr(Valores(Pointer))) Pointer = Pointer + 10 Call CopyMemory(iLote, Valores(Pointer), 4) Pointer = Pointer + 4 Call CopyMemory(iTemCam, Valores(Pointer), 4) Pointer = Pointer + 4 Call CopyMemory(iHumedad, Valores(Pointer), 2) Pointer = Pointer + 2 Call CopyMemory(iPresion, Valores(Pointer), 2) Pointer = Pointer + 2 Call CopyMemory(iPeso, Valores(Pointer), 4) Pointer = Pointer + 4 iEst = PointerToString(VarPtr(Valores(Pointer))) Pointer = Pointer + 5 Debug.Print iFecha & "-" & iHora & "-" & iTipo & "-" & iLote & "-" & iTemCam & "-" & iHumedad & "-" & iPresion & "-" & iPeso & "-" & iEst Next i Next grupo Exit Sub mal: MsgBox "[" & Err.Number & "] " & Err.Description, vbCritical, "Error" End Sub the results for iTemCam or iPeso are like this: 8.39516345413446E-320 1.27321882187115E-314 Any ideas what im doing wrong?
Hello, I am having an issue with intermittant connection to a remote PLC. The setup is as follows: Server has a VPN connection to a GSM router on site. This is connected via ethernet to the PLC. What I have found: I lose the ability to do a socket ping to the PLC on 20256. When I lose this ability, I also lose the ability to pull telemetry data off the PLC from the registers. (makes sense, they use the same port). I am doing this ping test from the local router on site, over the VPN. The issue is therefore not with the VPN itself, but the connection between the router and the PLC. The ladder logic code that manages the connection is attached. Can you see where I have gone wrong? How can I increase the robustness? Additionally, can you suggest timeout/keepalive settings that would help? At the moment, I can regain the connection by restarting the router (set to a automatic timed restart at the moment). Additionally, I have noticed more than once that if I go into the socket parameter screen on the PLC, it has sprung back into life. (maybe coincidence?) Many thanks in advance for any help!