pradeep chauhan

how to set up timer in st

14 posts in this topic

Hello all

I m new in st programming in omron

I want to use timer in st please help me regarding this

Share this post


Link to post
Share on other sites

If you look at the help file for a function / instruction that you would like to use, you can see the ST layout for that item.  See below:

weOop1iiyQq9QAAAABJRU5ErkJggg==

Just copy that text and paste it into your structured text and modify.  You could end up with something like this:

ADj8cpihs4uOAAAAAElFTkSuQmCC

Variables:

PlzuHnjBjyfaiNaiIiIyrb4n47Duk4dNGnSVLQUH

1 person likes this

Share this post


Link to post
Share on other sites

I just noticed that I gave you an answer for Sysmac Studio.  Please ignore the above answer....

For CX-Programmer, type ahead works in the structured text environment.  The type ahead will show you what each field is expecting:

 

wdWIekzgaoe2wAAAABJRU5ErkJggg==

So, you end up with something like this:

we4ZRiv5wy6rgAAAABJRU5ErkJggg==

1 person likes this

Share this post


Link to post
Share on other sites
On 9/10/2016 at 10:07 PM, Michael Walsh said:

If you look at the help file for a function / instruction that you would like to use, you can see the ST layout for that item.  See below:

Just copy that text and paste it into your structured text and modify.  You could end up with something like this:

Variables:

May you help me change this ladder into ST, please

Snap1.jpg

Share this post


Link to post
Share on other sites

5baa6230680c1_STtimerExample.jpg.98b508d

 

Make sure to declare all of the variables that you are using in the structured text block as I have shown above.  I declared I00 as a global since your code did that.

 

1 person likes this

Share this post


Link to post
Share on other sites
34 minutes ago, Michael Walsh said:

5baa6230680c1_STtimerExample.jpg.98b508d

 

Make sure to declare all of the variables that you are using in the structured text block as I have shown above.  I declared I00 as a global since your code did that.

 

Thank you so much Wash.

When I want to use another TON with different PT , do I need to declare another  function block with different instance name or can I use that FB above , only need to change the value of T , and the condition of IN

 

Share this post


Link to post
Share on other sites
41 minutes ago, vanquangtk said:

Thank you so much Wash.

When I want to use another TON with different PT , do I need to declare another  function block with different instance name or can I use that FB above , only need to change the value of T , and the condition of IN

 

You would need to declare another instance of the FB.  You could use the TIMER function however.  Functions do not require instances.  

1 person likes this

Share this post


Link to post
Share on other sites
21 minutes ago, Michael Walsh said:

You would need to declare another instance of the FB.  You could use the TIMER function however.  Functions do not require instances.  

Thank you Walsh again. By the way, this problem is not related to the topic; but do you know how to clear an event in event history.

Share this post


Link to post
Share on other sites

Hi Michael Walsh,

I had a question about using timers or counters in structured text. I did declare the timer in the external section. I did try it declaring it in internal. I always end up getting the same error. I suppose you will be able to help me with my question. Please see the attached screenshot of my program and errors.

code :TIMX(A, TimerNumber, 500);

Declaration:TimerNumber    TIMER                            INTERNAL     0    0    
 

ERROR: Symbol 'TimerNumber' is the invalid data type(TIMER or COUNTER) in the SFC/ST program.
 

Thanks

JOEL

code.PNG

error.PNG

Share this post


Link to post
Share on other sites

I am not having any issues.  If you post your code here(.cxp file), I can look at it to see if I can tell what is wrong.

TIMXSt.jpg.b8b359fbadc846147f138327188c4

Share this post


Link to post
Share on other sites
10 hours ago, joelsimon15 said:

Hi Michael Walsh,

I had a question about using timers or counters in structured text. I did declare the timer in the external section. I did try it declaring it in internal. I always end up getting the same error. I suppose you will be able to help me with my question. Please see the attached screenshot of my program and errors.

code :TIMX(A, TimerNumber, 500);

Declaration:TimerNumber    TIMER                            INTERNAL     0    0    
 

ERROR: Symbol 'TimerNumber' is the invalid data type(TIMER or COUNTER) in the SFC/ST program.
 

Thanks

JOEL

code.PNG

error.PNG

What is the model number of the PLC you are using? CJ2M, CP1L, CP1E............................

Structured Text timers or Counters can ONLY be used with CS/CJ series CPU units version 4.0 or later, or with CJ2-Series CPU units.

Edited by BITS N BYTES
More Info

Share this post


Link to post
Share on other sites
26 minutes ago, BITS N BYTES said:

What is the model number of the PLC you are using? CJ2M, CP1L, CP1E............................

Good point.... @BITS N BYTES

Share this post


Link to post
Share on other sites

I wanted to point out some misleading info / mistakes in my comments above.  The first bit in the TIMX structured text instruction is the enable bit (highlighted yellow).  To access the done bit, you need to look at the TimerNumber.CF flag (Complete Flag - Highlighted green) and to access the present value of the timer, you would use the TimerNumber.PV (Present Value - Highlighted blue)  UINT variable.  See my example below.

 

6291096da93c5_TIMXST.jpg.2d848a6fed40245

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now