Author Topic: Readin data from a text file  (Read 6349 times)

SunBum57

  • Newbie
  • Posts: 4
  • I'm a llama!
    • View Profile
Readin data from a text file
« on: October 25, 2007, 07:05:30 PM »
 ;D
Hi  
Just bought one of your plc's and they are quite good. I got most things to work first try. However I have a problem with the Read <File.nam>  function.  THere was no example of using it in the manual nor much in the forum. Basically I want to write values to the DM areas from a text file. The write function worked fine and created my file. I could not read it back as I am not sure of the syntax. Could you give me a simple example.
Thanks.

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3170
    • View Profile
    • Internet Programmable PLCs
Re:Readin data from a text file
« Reply #1 on: October 26, 2007, 02:49:03 PM »
When you send the read request to TLServer it will start to send back the CR terminated strings back to the PLC and you need to use the INPUT$(1) command to read the string into internal variable and then convert them to numerical form (use the VAL or HEXVAL functions) and assign to DM.

One example you can follow is the "SynchronizeRTC.PC6" sample program in the folder:

c:\Trilogi\tl6\samples\FileService_Modem

The example reads the RTC data sent by TLServer. You can follow the same way to read file data sent by the TLServer when you send it the READ tag.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS