I'm using a BL20-PN-EN-DN-JA for a project in CoDeSys v2.3 that requires accurate timestamps for quality traceability.
The PLC is connected to a PC, and the PC uses the Visualization tab displayed on its monitor as an HMI for the operator to control the procss (not ideal, but i did not design this syste... i'm simply trying to improve it per updated project requirements).
The old system relies on the operator + SysLibRtc.lib to produce timestamps:
This reliance on manual data entry has failed us many times in the past...
Among the project requirements, automating this time synch is a task that i'm struggling with.
I've dabbled with the OSCAT_NETLIB library and can't establish a network connection between the PLC and the PC. To do so, i exported the SNTP_CLIENT() function to my project. Compiled, then export(OSCAT)->imported(myproject) any peripheral dependencies from the OSCAT libraries that were throwing errors...
I work in structured text, but i believe that i'm understanding the FBD of the DNS_SNTP_SYSLOG_DEMO included in OSCAT_NETLIB... The example seems straightforward; hex IP address fed in, IP control datatype IP_C fed, Send (S_BUF) and Receive (R_BUF) buffers fed in.
I read somewhere that the OSCAT Sntp function might only compatible with a host running <= Win7? (we're on win 10)
I adjusted the registries of the host PC to allow it to enable NTP server functionality
* My inputs to the SNTP_CLIENT() function are
fSNTP_CIENT( IP_C := ipc1, (data type i copied directly from OSCAT library)
S_BUF := sBuff, (Data type NETWORK_BUFFER copied from OSCAT)
R_BUFF := rBuff, (Data type NETWORK_BUFFER copied from OSCAT)
ACTIVE := bActive, (bool i throw high to activate the function)
IP4 := IP4_DECODE('10.10.XX.XX'));(ip of my connected PC passed through the IP4_DECODE
function i exported from OSCAT. i've also tried
feeding the IP from DNS_CLIENT.IP4)
(outputs omitted since i'm not receiving any)
%t%a %b %d.%m.%y%H:%M:%S
Any thoughts? I can share a gutted version of my source with the OSCAT functions included if it would help.
Thanks in advance!
Log in to post a comment.