Internet PLC Forum

General => Technical support => Topic started by: Sonny on May 27, 2005, 11:34:38 AM

Title: Master-slave DACs
Post by: Sonny on May 27, 2005, 11:34:38 AM
Hi,
i'm working on a project where I am using the D/A outputs to control 4 variable valves (I chose the D/A outputs over the PWM outputs because the valves are controlled by a 0-5V voltage).

I am buying another T100MD-888 to use in a master-slave configuration so that I then have 4 D/A outputs.  However, I can not figure out, from the manuals, how to send instructions from the master to the slave, specifically instructions that pertain to the D/A outputs.  I would like to learn about those before purchasing the 2nd PLC.

Also, is it possible to divide my program between both PLCs?  In that way, I can divide my program into 2 separate files, and do certain functions on each?  As in, when the master runs into code that it does not contain, it activates the slave(somehow), and then the slave runs through its program?  It would definitely make my program easier to manage.

Thanks
Title: Re:Master-slave DACs
Post by: support on May 27, 2005, 11:59:11 AM
You can link up the two PLCs' RS485 bus. Then you can let the master write a value for the DAC to the slave using the NETCMD$ output. There are two ways of doing it:

1) If your slave PLC has firmware version r47 or above (new PLCs  now carry firmware r49), you can use the "@nnWAnnccxxxx" host link command to directly set the DAC on the slave without the slave program doing anything. See page 4-15 in your T100MD+ User's Manual (blue color cover) for description of this command.

2) If your firmware version is older than f47 which means it does not support the "WA  host link command. In that case, then the master will have to write to the slave PLC's data memory DM . The slave PLC will have a function that regularly checks the value of the DM and update the DM value to the DAC using the SETDAC command. i.e. in this case the slave PLC needs to handle the SETDAC command. However, this approach has the advantage that master/slave communication can be accomplished using READMODBUS/WRITEMODBUS command which is slightly simpler to use.

The "RemoteIO-Mseries.PC5" sample program in your TRiLOGI samples folder gives you the example of master-slave communication using NETCMD$.
Title: Re:Master-slave DACs
Post by: Sonny on May 27, 2005, 12:34:04 PM
The T100MD888 that I have now has older firmware, however, the slave would be the new one that I purchase.  I'm assuming that then, I could use the WA host link command?

Also, if I were to use this method, what does the response mean? I mean, if I'm sending something to a D/A output, I shouldn't expect a response, right?

I'd be using the slave for the D/A outputs, as well as to control 3 ON/OFF valves (through digital outputs).  Will the sending of instructions to the slave result in any timing delays?  Or will the master execute its instructions as normal even when it sends information to the slave.
Title: Re:Master-slave DACs
Post by: support on May 27, 2005, 12:37:56 PM
Yes, the newer PLC you purchase should carry the new firmware. The master can be older firmware since the PLC always support the NETCMD$ command.

The response string from the all the host link commands are listed in the User's Manual. Please refer to the manual for details. Normally you don't have to do anything about the response string if it is a write commnad. The NECMD$ takes care of FCS and slave ID verification before returning the string to you so you can assume that the returned response should be correct unless there are multiple PLC of the same slave ID on the same RS485 network, then the response may be erroneous.
Title: Re:Master-slave DACs
Post by: Sonny on May 31, 2005, 06:54:51 AM
In looking through the manual for my PLC, I was wondering if it was possible to use the following command to write to the DAC:

WVS0Cxxxxxx*
Title: Re:Master-slave DACs
Post by: support on May 31, 2005, 11:10:16 AM
No, that will not work. The PLC CPU will not be aware that it needs to update the DAC hardware with the new value even if it accepts the WVS command.  Only the newer PLC with firmware r47 and above will react to the WA command to set the DAC accordingly.
Title: Re:Master-slave DACs
Post by: Sonny on June 08, 2005, 06:41:16 AM
Well, I just got my 2nd T100MD888 in the mail, and in looking through the instructions for setting the D/A output, I got confused.

It says that the format is:

WAnncc(16^3)(16^2)(16^1)(16^0)...(16^1)(16^0)*

where
nn=starting analog channel #(01-02h)
cc=channel count

what does that mean? is a channel count like a timer or something? There's only 2 analog channels, so I'm assuming nn would be 01 or 02

Then it says that you enter the DAC output data for 1st channel and then DAC output data for subsequent data.  I don't understand that either.  I'm assuming the first 4 numbers would be the 0-4096 number.  But what about the next few numbers?

Thanks
Title: Re:Master-slave DACs
Post by: support on June 08, 2005, 09:42:53 AM
The channel count allows you to write to one or more DAC in a single NETCMD command. If you are writing to only a single DAC, then put 01 and only 4 digit of hex value

E.g, to write to DAC #1 and 2,

  DAC1  =  1000  decimal, or  03E8 in hex
  DAC2 =   2000  decimal, or  07D0 in hex

and assuming your slave PLC has ID=05

Then run:
   A$ = NETCMD$(3, "@05WA010203E807D0")

That will write 03E8 to DAC 1 and 07D0 to DAC 2.
Title: Re:Master-slave DACs
Post by: Sonny on June 09, 2005, 07:16:05 AM
the communication is going well, the problem I am having is that there is always a little bit of error in the value of the D/A output on the slave.  For example, if I input 4095 (4096 does not work for some reason), I get 4.95V instead of 4.99 or 5.00V.  This small drift occurs for any value I try to input (instead of 3.70 i get 3.67, etc.).  I calibrated the outputs on the slave by turning the potentiometer, but now it cannot turn any farther and I'm at a loss as to why there is this small difference.

Is there supposed to be a slight loss of accuracy when you send something to the slave?
Title: Re:Master-slave DACs
Post by: support on June 09, 2005, 12:40:30 PM
You should calibrate for the analog reference voltage (AVcc) to +5V by using a voltmeter to measure the analog reference voltage pin while you turn the potentiometer.  (Of course the calibration for the slave analog is to be performed at the slave PLC, not at the master).

The highest DAC value you can set for an 8-bit DAC is 255 out of full scale of 256.  For the M-series PLC it was normalized to 12-bit so the maximum possible value for DAT is 4080 out of full scale of 4096. So if your reference voltage is +5V the maximum output voltage from DAC is:

    4080/4096 * 5.00V = 4.98V.

Did you connect the DAC output to any low impedance load?  The loading factor can cause the DAC output to drop. You are supposed to connect only to high impedance load or use a buffering opAmp to buffer the DAC outputs.  Try to measure the voltage before the DAC is connected to the load.

A better way to measure is when DAC is set to 2048 and you should get about 2.50V +/- linearity and quantization error.



Title: Re:Master-slave DACs
Post by: Sonny on June 15, 2005, 12:10:28 PM
small, off-topic question here:

If I want to update my PLC from my house, how does it work?  Do I need TLServer over there too?  Or is having it connected to my computer at work enough?

Thanks
Title: Re:Master-slave DACs
Post by: support on June 16, 2005, 01:02:28 PM
To connect to the PLC there are two means:

1) Connect the PLC to a PC running TLServer or connect it to an Xserver.  I assume either the PC or the XServer would be accessible via the Internet. If you use a router for your network then you have to configure the network such that the TLServer or XServer can be accessed from the public internet address (usually by means of "Port Forwarding" method). You now can use your home computer's TRiLOGI software to access the PLC via the Internet.

2)  Connect the PLC to a MODEM and use your home PC's modem to connect to the PLC. In this case, Both TRiLOGI and TLServer should be running on your home computer. TLServer is the one that will dial the PC's modem to connect to the remote modem.
Title: Re:Master-slave DACs
Post by: Sonny on June 20, 2005, 12:48:30 PM
You should calibrate for the analog reference voltage (AVcc) to +5V by using a voltmeter to measure the analog reference voltage pin while you turn the potentiometer.  (Of course the calibration for the slave analog is to be performed at the slave PLC, not at the master).

The highest DAC value you can set for an 8-bit DAC is 255 out of full scale of 256.  For the M-series PLC it was normalized to 12-bit so the maximum possible value for DAT is 4080 out of full scale of 4096. So if your reference voltage is +5V the maximum output voltage from DAC is:

    4080/4096 * 5.00V = 4.98V.

Did you connect the DAC output to any low impedance load?  The loading factor can cause the DAC output to drop. You are supposed to connect only to high impedance load or use a buffering opAmp to buffer the DAC outputs.  Try to measure the voltage before the DAC is connected to the load.

A better way to measure is when DAC is set to 2048 and you should get about 2.50V +/- linearity and quantization error.






When I calibrated the reference, it goes up to 4.99V, which I guess is ok.  But on the other PLC, I can go over 5V for the reference, and when I do that, the DAC is more accurate (it goes up to 5V, and gives exactly 2.50 V when I input 2048, when the reference is 5.03V).

So, when I input 2048, I get 2.48V, and when I input 4095, I get 4.96V on the new PLC.
Title: Re:Master-slave DACs
Post by: Sonny on June 28, 2005, 10:42:32 AM
I have another problem.  On my PLC, I want it display the user interface in both English and French.  However, when I wrote in special characters (?...) they come out as weird characters on the PLC LCD (? comes out as the exponent -1).  How can I do this?
Title: Re:Master-slave DACs
Post by: support on June 28, 2005, 01:53:29 PM
The LCDs support standard ASCII text only and a limited number of special characters. You need to check the character maps for LCD420 which can be found in the LCD full manual. A scanned copy of the character map is as follow:

(http://www.tri-plc.com/mds-1.gif)

The LCD will not be able display beyond these predefined character set unless you want to create your own character using the special LCD command (pretty messy way and you are pretty much on your own if you want to take that route).
Title: Re:Master-slave DACs
Post by: Sonny on July 08, 2005, 07:09:36 AM
To connect to the PLC there are two means:

1) Connect the PLC to a PC running TLServer or connect it to an Xserver.  I assume either the PC or the XServer would be accessible via the Internet. If you use a router for your network then you have to configure the network such that the TLServer or XServer can be accessed from the public internet address (usually by means of "Port Forwarding" method). You now can use your home computer's TRiLOGI software to access the PLC via the Internet.

2)  Connect the PLC to a MODEM and use your home PC's modem to connect to the PLC. In this case, Both TRiLOGI and TLServer should be running on your home computer. TLServer is the one that will dial the PC's modem to connect to the remote modem.


If I give the PLC to our client, how can we update the program from our office?  Would they have to have a copy of Trilogi themselves?  And if they do have TLServer running on their computer, all I need then is their IP, right?
Title: Re:Master-slave DACs
Post by: support on July 08, 2005, 11:08:50 AM
They will need to have a copy of the TRILOGI software in order to run the TLServer. Once the TLServer is running on their computer and if the PC has direct link to the internet then you can use TRiLOGI to remotely program the PLC via the TLServer.

However, if the PC running TLServer is behind a corporate firewall /NAT router then the network administrator would have to configure that PC to allow it to be accessible via the Internet before you can do that. There are some description of this issue in the TLServer help pages.
Title: Re:Master-slave DACs
Post by: Sonny on July 12, 2005, 05:45:31 AM
They will need to have a copy of the TRILOGI software in order to run the TLServer. Once the TLServer is running on their computer and if the PC has direct link to the internet then you can use TRiLOGI to remotely program the PLC via the TLServer.

However, if the PC running TLServer is behind a corporate firewall /NAT router then the network administrator would have to configure that PC to allow it to be accessible via the Internet before you can do that. There are some description of this issue in the TLServer help pages.

Thanks.  One last thing about this, if I'm trying to access a PLC at a non-firewall location where they have TLServer running, then I just start up TLServer on my computer and type in their IP address, right?  Or, when I click on "Program Transfer to PLC", do I put in their IP address there?
Title: Re:Master-slave DACs
Post by: support on July 15, 2005, 09:08:25 AM
Thanks.  One last thing about this, if I'm trying to access a PLC at a non-firewall location where they have TLServer running, then I just start up TLServer on my computer and type in their IP address, right?  Or, when I click on "Program Transfer to PLC", do I put in their IP address there?

You don't need to start up your own TLServer at all. You just need TRiLOGI running on your PC and when you attempt to do any program transfer or online monitoring, the login screen will appear and you just need to type in the IP address of the REMOTE TLServer and the username and password configured in the REMOTE TLServer.
Title: Re:Master-slave DACs
Post by: Sonny on July 19, 2005, 12:28:38 PM
Does anyone know of a way that I can control multiple valves with the same analog output or PWM output?  This would involve multiplexing, and I have digital outputs that could be used.  I can't think of the circuitry.

Thanks
Title: Re:Master-slave DACs
Post by: support on July 19, 2005, 12:55:16 PM
It depends on whether the valve that are not in use will be completely OFF?  If so, then you can use external relays (electromagnetic type) and you can use your digital output to selectively turn on the contact of each relay. The PWM output is sent to the common contact and the other side of the contact is connected to the valve that you wish to apply proportional voltage.