Tải bản đầy đủ (.doc) (13 trang)

High Speed Counters (HSC) Hardware Software Versions

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (583.5 KB, 13 trang )

High Speed Counters (HSC)

Hardware & Software Versions Used to Develop This Guide
• Windows XP, Service Pack 3
• Connected Components Workbench (CCW) Release software
• Micro830 controller (2080-24QBB)
• 845T-DZ33ACR encoder

• Micro830 User Manual (2080-UM002A-EN-E)
• RATube: How to use HSC instruction ( />v=2921AA35SSBR)

Building a High Speed Counter HSC Project
This guide will show you how to create a HSC function block and set the correct
1) Start CCW and open a new project. From the Catalog windows, choose the
correct controller by double clicking on it or dragging and dropping it onto the
Project Organizer windows.

2) Right click on programs (under Project manager) and click on new ladder diagram
to create a new ladder logic windows.

3) On the rung, add a direct contact and assign it to input 5 (further on this guide you
will learn which input to choose for your specific controller or application). To the
right of the contact, add a function block and choose HSC from the options given
in the Instruction Block Selector. You could do a search by typing HSC on the
NAME box. Your windows should now look as follows:

4) In the Project Organizer window, double click Local Variables to bring up the
variables window. Add the following variables with its corresponding data type:


The variable windows should look as follows:

5) Now, we want to add values into the variables we just created. While still on the
variables window, click on the box under the Initial Value tab which is assigned to
the MyCommand variable (you could drag and drop the Initial Value tab to the
right of the Data Type tab for ease of use) and set the value to 1. for a list of
commands refer to the table below:

6) Next we will assign values to the MyAppData variable. Click on the + sign next
to the MyAppData variable to expand it and reveal the sub-variables. Set the
initial values same to those shown in the diagram below as well as the dimension
value of the MyPLS variable:

MyAppData variable has many sub-variables which determines the settings of the
counter, it is crucial to know each one in order to determine how the counter will
MyAppData.PlsEnable allows the user to either enable or disable the PLS
settings. It should be set to FALSE (disabled) if the MyAppData variable is to be
MyAppData.HsID allows the user to specify which embedded inputs will be
used depending on the MODE and the type of application. The table below shows the
different IDs that can be used as well as the embedded inputs and its characteristics:

If ID 0 is used, ID 1 cannot be used on the same controller since the inputs are
being used by the Reset and Hold. For a list of the amount of HSC that can be used
per controller, refer to the Micro830 user guide (2080-UM002A-EN-E) page 91.
MyAppData.HscMode allows the user to specify the type of operation in which
the HSC will count. Please see the table below for a list of MODES available:

Modes 1, 3, 5, 7, and 9 will only work when an ID of 0, 2, or 4 is set due to the
fact that these modes use reset and hold. Modes 0, 2, 4, 6, and 8 will work on any ID.
Modes 6-9 will only work when an encoder is connected to the controller. Use the
HSC ID chart as a reference to wire the encoder to the controller.

MyAppData.HPSetting, MyAppData.LPSettign, MyAppData.OFSetting, and
MyAppData.UFSettign are all user defined variables which represent the counting
range of the HSC. The diagram below gives an example of a range of values that can
be set for these variables:

MyAppData.OutputMask along with MyAppData.HPOutput and
MyAppData.LPOutput allows the user to specify which embedded outputs can be

turned on when a High Preset or Low Preset is reached. These variables use a
combination of decimals and binary numbers to specify the embedded outputs that are
able to turn on/off.
Thus in our example, we first set the Output Mask to a decimal value of 3 which
when converted to binary is equal to 0011. This means that now outputs O0 and O1
are allowed to turn on/off. Now, we set the HPOutput to a decimal value of 1, which
when converted to binary is equal to 0001. This means that when a High Preset is
reached, output O0 will turn on and stay on until the HSC is reset or the counter
counts back down to a Low Preset. The LPOutput works same way as the HPOutput
except an output will be turned on when a Low Preset is reached.

7) Go back to the ladder diagram and assign the variables to the corresponding
blocks of the HSC function block. The HSC function block should look as

8) Next, click on the Micro830 controller under the Project Organizer windows to
bring up the Micro830 windows. In it, click on the Embedded I/O option and set
the input filters to a correct value depending on the characteristics of the encoder.

9) Make sure that your encoder is connected to the Micro830 then power on the
Micro830 and connect it to your PC. Build the program in CCW and Download it
to the controller.

Running the High Speed Counter HSC
10) To test the program, go into debug mode by either clicking on Debug option on
the upper left corner of the screen then choosing start debug, or by clicking on the
green play button on the top middle of the screen, or simply hitting the F5
windows key.

Now that we are on debug mode we can see the values of the HSC output. The
HSC function block has two outputs, one is the STS (MyStatus) and the other is the
HSCSTS (MyInfo).
11) Double click on the direct contact labeled _IO_EM_DI_05 to bring up the
Variable Monitoring window. Click on the I/O-Micro830 tab, and then click on
the _IO_EM_DI_05 boxes to check the Lock then Logical Value options so that
this input will stay in the ON position.

12) Click on the Local Variables tab to see any real time changes being made to the
variables. Click on the + sign next to MyAppData and MyInfo to expand these
variables. You can now turn the encoder to see the counter count up/down; the
value will be displayed on MyInfo.Accumulator. MyStatus variable should
display a Logical Value of 1 meaning that the HSC is running.

For this example; once the Accumulator reaches a High Preset value of 40, output
0 will be turned on and the HPReached flag will be turned on. Once the Accumulator
reaches a Low Preset value of -40, output 1 will be turned on and the LPReached flag
will be turned on as well.

Using the Programmable Limit Switch (PLS) Function
The Programmable Limit Switch function allows you to configure the High-Speed
Counter to operate as a PLS (programmable limit switch) or rotary cam switch.

Start a new project and follow the same guidelines as the previous project.
The only difference is that the values in the variables will be different. The

main difference is that within HSCAPP the PlsEnable variable should now
be set to TRUE and you need to set a value only for UFSetting and
OFSetting (OutputMask is optional depending if an output is to be set or
not). So your new variable values should look something like this:

On this example the PLS variable was give a dimension of [1..4]. This
means that the HSC could have 4 different High Presets and 4 different Low
Preset. Once again, your High Presets should be set lower than the OFSetting and
the Low Preset should be greater than the UFSetting. The HscHPOutPut and
HscLPOutPut values will determine which outputs will be turned on when a High
Preset or Low Preset is reached.
2) You can now build and download the program into the controller then debug
and test it. The counter will keep counting until an Over Flow or Under Flow is
reached then starts again from either the lowest or highest value depending on
which direction the counter is counting.