how to declare 1 second pulse in rslogix 5000?

-KeNshIn-

Member
Join Date
Dec 2008
Location
cheras
Posts
14
Hi all,

Anyone knows how to declare a one second pulse in the Rslogix 5000? Is there any command for this function? It does not same like GE or other PLC where the 1s pulse is an internal bit. How to declare a bit or a tag to have this function? I am using Allen Bradley 1756-L61 controller. Appreciate for those can help. Thanks

KeNshIn
 
Hi all,

Anyone knows how to declare a one second pulse in the Rslogix 5000? Is there any command for this function? It does not same like GE or other PLC where the 1s pulse is an internal bit. How to declare a bit or a tag to have this function? I am using Allen Bradley 1756-L61 controller. Appreciate for those can help. Thanks

KeNshIn
How about creating a routine that runs every second and then getting your pulse there?
This will be a periodic task and you define the intervals.
You define under "tasks" and it is not part of the "Main task".
Hope this helps.
 
Last edited:
bkottaras,

yeah, i created a new task named "one_second" which is not in the main task. But is not running.
Is it because of that routine has been call yet?
How to call the routine in the other task to that I can use the bit created in the "one_second" task in the main program?
 
Hi all,

Anyone knows how to declare a one second pulse in the Rslogix 5000? Is there any command for this function? It does not same like GE or other PLC where the 1s pulse is an internal bit. How to declare a bit or a tag to have this function? I am using Allen Bradley 1756-L61 controller. Appreciate for those can help. Thanks

KeNshIn

I'm sure there is a number of different ways to do this, but for a simple pulse for "x" number of seconds I use a timer and the DN bits, i.e.

3116600039_d63eb41232_o.jpg


I added the GSV statement in case you need to be more exact on the time for the pulse. You may have to correct it based on the last scan time. I find that 90% of the time, the first rung would suffice.
 
I'm sure there is a number of different ways to do this, but for a simple pulse for "x" number of seconds I use a timer and the DN bits, i.e.

I added the GSV statement in case you need to be more exact on the time for the pulse. You may have to correct it based on the last scan time. I find that 90% of the time, the first rung would suffice.


This is how i do, but is not working anyway due to the routine is not in the main program. I m not sure hows the GSV thing work, but I want the timer pulse to be precise all the time and not affected by the scan time so I created in other new program. Is there anyway to call this routine back so that I can use the "UD_1s" bit in the main program? I had tested this is the main routine which works pretty good.

untitled.jpg
 
You don't need timers for this and in fact a timer will be affected by scan time if you are not very careful about how you reset the timer.

You need a task that runs once every 500 milliseconds. The task needs to have at least one program (A task can have multiple programs so if you have other things that happen on 500 millisecond intervals you can create programs to do those things).

In the attached example the 500 millisecond task named EVERY_HALF_SEC has a program called ONE_SECOND_PULSE_TRAIN. Right click on the task and click Program Schedule. You will see that the program ONE_SECOND_PULSE_TRAIN is scheduled for this task. Now click the + sign next to the task to expand it and then right click on program
ONE_SECOND_PULSE_TRAIN. Select Properties. Now click configuration and see that the ladder routine SEC_PULSE_TRAIN is designated as the main routine for the program. When you create a new program you have to define which routine of the program is the main routine, which may be why your routine is not running.

Now click on the ladder routine SEC_PULSE_TRAIN to see the single rung of logic. Once every half second this rung will change the state of the Controller Scoped Boolean tag ONE_SECOND so that it is on for 1/2 second, then off for 1/2 second, giving you a continuous pulse train with a one second duty cycle.

If you want to make sure that the pulse stays exact then make the task a high priority task in the task configuration.

One question: What is it you are trying to do that you need and exact one second pulse? I'm asking because the CLX contains many novel instructions that might be able to accomplish what you are trying to do another way.

(Since I have no idea which version of L5K you are using I saved it in version 13, the earliest version I have installed, if you only have a later version then RSLogix will up convert it for you.)


 
Last edited:
You need a task that runs once every 500 milliseconds. The task needs to have at least one program (A task can have multiple programs so if you have other things that happen on 500 millisecond intervals you can create programs to do those things).


Firstly, thanks for your way, is much simple. I'm having another problem now which is how to use the ONE_SECOND tag in the EVERY_HALF_SEC task in my main task? Can it be linked and use in both task?
 
When you create the ONE_SECOND tag make sure it is a controller scoped boolean, that way it will be available to all programs.
 
When you create the ONE_SECOND tag make sure it is a controller scoped boolean, that way it will be available to all programs.

Yeah, it works. Thanks alot.

In fact I not really understand how does it works. What I seen from the rung it only can energize the one second bit when 1st scan time comes. But when the next scan time comes, the bit it-self has alrdy de-energize and become an open contact. So how come it could able to produce a 1s pulse continuously?
 
First thing to keep in mind is that these are not contacts and coils. These are computer instructions that tell the processor to check the status of a bit and write a bit to a memory location. Once a bit is written, it stays that way until a new value is written.

A tag is a pointer to a location in memory. Think of it like this: You tell your friend there will be a party at Bob's house. Bob's house has an address, a location on a street in a city, but you and your friend don't know the house number of Bob's house, but both of you do know where Bob's house is, so all you need to tell your friend is that the party is at Bobs house. A tag is kind of like that. ONE_SECOND is a tag and all the programs "know" where the value for the tag is located in memory, but you don't need to know the exact address, you just know ONE_SECOND

Because the rung is in a periodic task it does not execute continuously. The rung is scanned only once every half second. When it is first scanned the value in memory at the bit location we named ONE_SECOND is 0. Therfore the first instruction of the rung, XIO ONE_SECOND evaluates as true. Its the only condition instruction on the rung so the rung is ture and the OTE now writes a 1 into the memory spot pointed to by the tag ONE_SECOND. Then the subroutine exits. Since nothing else is writing a value to the tag ONE_SECOND the 1 stays in that place in memory. Then a half second later the task runs again. Now when it evaluates XIO ONE_SECOND it will see that the value in the memory location ONE_SECOND is a 1, so the instruction will be false, the rung will be false, and the OTE ONE_SECOND will now write a 0 into the memory location pointed to by the tag ONE_SECOND. That 0 will stay there until the task executes again.

I hope that helps.
 
Last edited:
You don't need timers for this and in fact a timer will be affected by scan time if you are not very careful about how you reset the timer.

You need a task that runs once every 500 milliseconds. The task needs to have at least one program (A task can have multiple programs so if you have other things that happen on 500 millisecond intervals you can create programs to do those things).

In the attached example the 500 millisecond task named EVERY_HALF_SEC has a program called ONE_SECOND_PULSE_TRAIN. Right click on the task and click Program Schedule. You will see that the program ONE_SECOND_PULSE_TRAIN is scheduled for this task. Now click the + sign next to the task to expand it and then right click on program
ONE_SECOND_PULSE_TRAIN. Select Properties. Now click configuration and see that the ladder routine SEC_PULSE_TRAIN is designated as the main routine for the program. When you create a new program you have to define which routine of the program is the main routine, which may be why your routine is not running.

Now click on the ladder routine SEC_PULSE_TRAIN to see the single rung of logic. Once every half second this rung will change the state of the Controller Scoped Boolean tag ONE_SECOND so that it is on for 1/2 second, then off for 1/2 second, giving you a continuous pulse train with a one second duty cycle.

If you want to make sure that the pulse stays exact then make the task a high priority task in the task configuration.





I tried doing a program with the above procedure.
But when i run the program for 10 minute, i am getting a 12 sec variation. from the system time.
(for 10 minutes: the sec_pulse_train generated 10min and 12sec
but system time has reached only till 10min)

I tried timing with one sec timer. That was even worse it had a lagging more than 20sec.

Since i need to calculate the running hours for the motors and compressors i need to show the exact result. :unsure:

[If a motor runs continuously for 1 year, then there will be a difference of 60hrs.]
[im testing this in emulator]

can anyone help me from this problem... plssss...

rgds,
RBM
 
Last edited:
(ZOMBIE THREAD)
Simple solution, do NOT use timers to establish time intervals that require accuracy.

Use the GSV instruction, and you want WAlLCLOCKTIME (send it to an array of 7 DINTs). Take the 'Seconds' value (PLC_Time[5]), and pass it through a DTR instruction to an internal OTE.

Done. A one second period one shot based off of the system clock.

This will still be slightly off, as the system clock isn't perfect, but it's a whole lot closer then using a timer instruction.

BST GSV WALLCLOCKTIME   LocalDateTime PLC_Time[0] NXB DTR PLC_Time[5] 255 Sys_Old_Seconds OTE SYS_One_Second_OS BND 

 
Last edited:
(ZOMBIE THREAD)
Simple solution, do NOT use timers to establish time intervals that require accuracy.

Use the GSV instruction, and you want WAlLCLOCKTIME (send it to an array of 7 DINTs). Take the 'Seconds' value (PLC_Time[5]), and pass it through a DTR instruction to an internal OTE.

Done. A one second period one shot based off of the system clock.

(y)


Logic i used was the same.
took the system clock second value using GSV instruction
and then generated a second pulse when ever second value changes.
and then used a counter to calculate the running hours...

i tested and found that the value is matching with the system value..

Thanks a lot !!
 

Similar Topics

I'm new in PLC programming. I have a small project which have 12 temperature sensor. How I should declare the variable for this 12 sensor. I...
Replies
4
Views
2,390
I'm new in PLC programming. I have a small project which have 15 temperature sensor. How I should declare the variable for this 15 sensor. I...
Replies
3
Views
1,888
Hello Folks: I'm trying to create a function that takes an DINT to dynamically set the range to a random number generator. Below is the code, I...
Replies
7
Views
1,853
In my WinCC Runtime program, I have to declare these variables: Dim AllProperties As HMIProperties Dim objProperty As HMIProperty Dim...
Replies
0
Views
2,244
How to declare PIW PQW in WinCC (Analog Values)with simatic manager.... Any Examples Appreciated ..........
Replies
14
Views
7,691
Back
Top Bottom