BC AppNote 002
BC AppNote 002
BC AppNote 002
Application Notes
www.beckhoffautomation.com
BC-AppNote-002 1.0 27 August 2007 This application note is intended for the first time user of the BC9000 and TwinCAT PLC who wants to control digital inputs and outputs with ladder logic in TwinCAT PLC. The procedure utilizes a 2 channel 24VDC input terminal (KL1002) and a 2 channel 24VDC output terminal (KL2012). It does not include TwinCAT programming details and methodology. This application note is for default settings only on the BC9000. Refer to BC9000 first steps located on the CD included with the BC9000 for modification of BC9000 system parameters
For additional documentation, please visit www.beckhoffautomation.com For further assistance, please contact Beckhoff USA support at supportUSA@beckhoff.com
Beckhoff Automation 12150 Nicollet Avenue South Burnsville, MN 55337 Phone: + 1 952 / 890 0000 Fax: + 1 952 / 890 2888 beckhoff.usa@beckhoff.com
Overview
Sample Files
Key Concepts
Use Hyperterminal to simulate or monitor the RS232 communication. Use the Beckhoff Modbus Monitor program or Modscan to analyze the system before attempting specialized programming. Refer often to the KL6001 and BK/BC9000 documents to determine the mapping for the terminal.
16 April 2008
Procedure
PC and PLC Setup Procedure
Configure and program the BC9000 CPU by installing TwinCAT PLC 2.10 build 1244 or higher. TwinCAT is available via the Beckhoff website, www.beckhoff.com, free of charge, for 30 days. Please contact your sales representative for quoting TwinCAT and purchasing a registration number to license TwinCAT PLC beyond the 30 days. Configure your PC Ethernet port for a dedicated IP address by selecting start, My Network Places, and View Network Connections. Right click on Local Area Connection and select Properties. Scroll down in the selection box to Internet Protocol (TCP/IP) and select Properties. Set the parameters to: IP Address: 172.16.17.1 Sub Net Mask: 255.255.0.0 Default Gateway: 0.0.0.0. (See figure below.) Select "OK"
Install KL1104, KL2612, and then KL9010 on the BC9000. Connect 24VDC @ 2A from power supply to 24V and OV to the coupler. Connect 24VDC up to 10A for I/O load power to pins marked + and -. Connect an Ethernet 10/100BaseT, Cat 5e, crossover cable to the PC Ethernet port and the BC9000.
16 April 2008
The following parameterizations can be carried out without using configuration software and with the aid of the DIP switches and the end terminal (KL9010). This parameterization mode is active only if just one end terminal (KL9010) is inserted. Otherwise, the normal settings apply. Restoring the manufacturer's settings Switch off the Bus Coupler, and plug in just the end terminal (KL9010). Set all the DIP switches to ON, and switch the Bus Coupler on again. Once the default parameters have successfully been set, the Error LED lights, and the I/O Run and I/O Error Led's flash alternately. You can then switch the Bus Coupler off, connect the Bus Terminals, and continue as usual. Deleting the boot project (only BC9000) Switch off the Bus Coupler, and plug in just the end terminal (KL9010). Set DIP switches 1 to 9 to ON, DIP switch 10 to OFF, and switch the Bus Coupler on again. Once the boot project has been successfully deleted, the I/O Run and I/O Error Led's flash alternately. "You can then switch the Bus Coupler off, connect the Bus Terminals, and continue as usual. Setting the Ethernet Parameters Switch off the Bus Coupler, and plug in just the end terminal (KL9010). Set all the DIP switches to OFF, and switch the Bus Coupler on again. The I/O RUN and I/O Error Led's light steadily. Make the desired setting in accordance with the following table.
DIP Switch 1 2
16 April 2008
DIP Switch 3
Comment Default
To accept the values, set DIP switch 10 to ON. The Bus Coupler indicates that it has accepted the parameters by flashing the I/O RUN and I/O ERR Led's You can then switch the Bus Coupler off, connect the Bus Terminals, and continue as usual.
1.
Click on the icon in the lower right Windows menu bar (see below)
select System Manager. 2. On the left side of this new window under I/O - Configuration, right click on I/O Devices and then select Append Device. The following image will appear:
16 April 2008
3.
In the window, select Ethernet and then select Virtual Ethernet Interface.Note the name at the bottom of the window. While it can be renamed, it is most often not changed. Please note as well that the BC9000 is not capable of being used in a Real-Time Ethernet or EtherCAT (Direct Mode) situation. Click OK The following image shows the Device 1 (Virtual-Ethernet) selection:
4. 5.
16 April 2008
6.
Right click on Device 1 (Virtual-Ethernet) and select Scan Boxes (see image below).
16 April 2008
7.
Once the selection has been made, TwinCAT will go out and search for all the PLC's on the Ethernet network. In this instance, there is only one (see the image below:
8.
Note that the name of the PLC was automatically assigned as BC9000-2 (172.16.17.2). Obviously, the PLC is a BC9000. The -2 at the end identifies the last portion of the Ethernet Node address as Node 2. This is further confirmed with the display of the full Node address of 172.16.17.2. Place a check mark in the box for this PLC and then click OK.
16 April 2008
9.
16 April 2008
10. Double click on BC9000-2 to see if all the Bus Terminals have been found, identified, and listed below the BC9000-2 heading.
16 April 2008
10
12. When you click Export Variable Info . . . , a Save As window opens. Find the folder to save this project information to, then click Save. The image below illustrates this task. Please note that the name of the PLC (BC9000-2) has already been entered automatically into the name space. Once saved, the document will have an "exp" file extension attached.
16 April 2008
11
Note: This "exp" document must be saved with the System Manager file (tsm file extension) as well as the PLC program file (pr6 file extension) in the same folder. The tsm and pr6 files must also have the same names.
13. At this point, everything about the hardware for this PLC is known. At the top left corner of the TwinCAT window, select File and Save As. Find the folder of the previous step and then type in the name for this project. Click Save and this file will be saved as a tsm file.
Click on the icon in the lower right Windows menu bar (see below)
SelectPLC Control. When the TwinCAT PLC Control windowopens, there may be a program already open from a previous effort. If so, go to the File menu and select New.
16 April 2008
12
14. The Choose Target System Typewindow (shown below) will open.Select BC via AMS and click OK
15. The New POU window appears to allow for the selection of the name for the new POU, the type of POU, and the Language of the POU. Generally speaking, the first POU should be MAIN as there has to be one POU in the program named MAIN and it must also be a selected as a program. Also, a Language for the POU must be selected. Here, Ladder Diagram (LD) was selected:
16 April 2008
13
16 April 2008
14
16 April 2008
15
18. When Import... is selected, the Import Project windowappears. Find the project folder and the BC9000-2.expfile. SelectOpen.
16 April 2008
16
The main window, TwinCAT PLC Control, will appear unchanged. But, in fact, it has. At the bottom left of the window is a tab labeled R... The R stands for Resources. Click on this tab, then on the Global Variables folder, and then click on TwinCAT_Import. What appears in the larger central window are all the variables for the I/O modules. Those variables at the top of the list are the status and control bits associated with the respective Bus Terminal I/O modules. Those at the bottom (see the next image) are the actual I/O points. Also shown are the physical addresses within TwinCAT.
16 April 2008
17
For the most part, these items at the end of the list are what you will use in the PLC program. 19. At the bottom of the main window, TwinCAT PLC Control, select "P..." This "P" stands for POU. Selecting this will return you to the program screen where you may begin entering your program in the language you have selected.
16 April 2008
18
20. Before continuing with programming, it would be wise to save everything established thus far. Under File, click Save As, browse for your project folder, and then name the program. Again, make sure the name for this file is the same as the TwinCAT System Manager file.
21. In the main window is the main form for starting a Ladder Diagram program. The top section of the main window on the right is a place for declaring variables. In the middle is where the program is entered. At the bottom is where the status of the program is displayed.
16 April 2008
19
To insert a contact, coil, or Function Block, right click in the dotted rectangle, and a menu will appear (see below). Select Contact and a contact will appear on the rung with three question marks above it.
16 April 2008
20
With the contact inserted, click on the three question marks, and then enter a new variable name or press F2. F2 opens the Help Manager window, which has a list of all the variables associated with the I/O Bus Terminals described before.
There is another way of entering contacts and coils. At the top and center of the main window is a small bar (see below) for making that selection.
If a new variable name is entered, a new window will appear to aid in the declaration of the variable name. The Declare Variable window (see below) allows for entry of all the detailed information required to declare the variable. When entered, click OK and the variable name and Type will appear in the small window at the top.
16 April 2008
21
22. After the program is entered, select Project and then Rebuild All. This will compile the logic to be downloaded to the BC9000. If there are any errors, they will be reported at the bottom of the main window. Do not forget to save the program regularly
At the Menu bar select Online and then Choose Run-Time System...Another window will open (see below). Double click on BC9000-2, click on Run-Time 1 (Port 800), and then click OK. At the bottom of the main window will be a red colored bar with the name of the PLC inside.
At the Menu bar select Online and then Login. TwinCAT will issue prompts saying there may be no program or a different program in the BC9000. Select OK to all prompts. At the Menu bar select Online and then Run. If all is well, the PLC program will now be running. Evidence of this will appear at the bottom of the main window with a green bar that says RUN.
16 April 2008
22