Posted 3 Aug 2005 I am using a Omron CQM1 plc and need to interface with a Laptop via Finsgateway and using Compolet. The Manual which is supplied is very sparse on simple examples of VB code. I have got most of the Forms , Text and controls I want to use working but am having difficulties in Writing a Long variable to the plc. ie I want to send the decimal number 1000000 to HR0 HR1 ((2 words ) as a UDINT). Does anyone have any simple code examples or is there a book or training specifically for Omron plc . Regards Nick Share this post Link to post Share on other sites
Posted 3 Aug 2005 Compolet Examples @ MrPLC.com You can find lots of helpfull info at this site by checking the "download code" link at the top of the page. Share this post Link to post Share on other sites
Posted 5 Aug 2005 Hi This works on my app Private Function fHRSendBCD(RegVal As Long, Reg As Integer) As Integer Dim iLow As Long Dim iHigh As Long Dim iString As String iString = CStr(RegVal) If Len(iString) > 4 Then iHigh = Val(Left(iString, Len(iString) - 4)) Else iHigh = 0 End If If Len(iString) < 5 Then iLow = Val(iString) Else iLow = Val(Right(iString, 4)) End If plcOmron.HR(Reg) = CLng("&h" & iLow) plcOmron.HR(Reg + 1) = CLng("&h" & iHigh) End Function Where plcOmron is the name of the object. Hope this helps Regards Alan Edwards http://www.wolfelectrical.co.uk Share this post Link to post Share on other sites