Making a timer in cx-programmer

Patrix

Member
Join Date
Aug 2011
Location
Enschede
Posts
107
Hello everyone,

I'm trying to make a timer function in cx-programmer. For example i want everyday to switch an output on at 7 am and off at 7 pm. I looked in the instruction list and all i find a instructing like CSUB and CADD. I think i need CSUB, i looked at the example provided by Omron. But they explain how to count from the cpu date/time to a date/time that i choose. Is there one of you experts here who could explain to me how to make a everyday timer function.
 
You will need to provide additional information.
What plc are you working with. This information would point you to the memory location of the internal clock/calendar.

You will need to Compare the internal clock words with your desired time values to allow your program to work.

A Timer (TIM) will not work for your application.

I hope this will help.
 
Well i just using the program, not a PLC. trying to self teach me, how this all work. When i started a new project i choose a CP1H PLC. That a TIM doesn't work i figured out by trying. Hope this will answer your question.
 
You should download the manuals for the plc you are studying.
CP1H manuals are W450 (Hardware) and W451 (Programming).

Attached is the clock data memory locations.

Look in the programming manual (W451) at the Comparison instructions. This should get you started.

You can download the manuals from this site:
http://industrial.omron.eu/en/services_and_support/download_centre/default.html

I hope this will help.

CP1H_Clock_Info.jpg
 
Thanx gtsuport, i will try that, if i cant manage it by myself i'll post it here again.
 
Last edited:
Here is what I use for this - this is hours only and days, minutes etc can be added.
ANDW is used as a mask.

Time Clock Hours.jpg
 
Thanx BobB, that helps allot. always nice to have a sample. Only is it possible to zip this picture so i can read it better?
 
Thanx BobB, that helps allot. always nice to have a sample. Only is it possible to zip this picture so i can read it better?

I doubt Zipping it would make any difference. Try Right Clicking it and selecting "Save Picture As..." and save it to your Hard Drive. Then you can Open it with a Viewer, and Zoom and Pan with it.

Stu....
 
Hello stu,

I've tryed that but it becomes blurrier. Zoom out helps but then i can't read it because its to small.
 
Ah, I was afraid of that. Perhaps Bob could Post the Code Snippet in CXP Format, or Print/Save it as a PDF, which is scalable.

Stu....
 
Look in the programming manual (W451) at the Comparison instructions. This should get you started.
Oke downloaded the manual and started to try a time comparison instruction =DT(341) as shown as a example in the manual.


I set D0 at HEX 003B so the instruction only looks at hours, i did this by making a MOV instruction. If i set D100 at the same HEX number as the clock using also the MOV instructing, then Q100.00 (for 0.00 i used P_On) doesn't get 1. What am i doing wrong here, or what am i missing and can someone tell me how i translate the HEX value to the time value in hours:minutes:sec

=DT.jpg
 
Last edited:
To compare the hour data, you would set the value in D101.
Example: If you want the Q100.00 to turn on at 7:00 am, set D101 for #0007.

I just set this up in a CP1H and it works per the example you posted.

Also note, clock data is in BCD format.

Hope this will help.
 
Thanx guys for the reply,

i see it now, correct me if im wrong, D101 looks at hours D100 looks at min and/or sec. I will try what you suggested.
 

Similar Topics

Hi, I have a simple function block that does not function when I use multi instance SFB4 IEC Timer On Delay. I could not attached a zip of the...
Replies
7
Views
9,087
Hi, I have seen a few post with similar topics and I have tried contacting the authors however I have not had any luck so I am posting this new...
Replies
14
Views
1,007
Hi everyone I've created an FC that includes the blocks TCON, TDISCON, TSEND and TRCV. This block has to be as generic as possible across...
Replies
15
Views
1,508
Hi all, I have been working on a tool for my company that handles a specific task our company runs into often related to PLC's. This is a tool I...
Replies
15
Views
2,874
Hi, i need to make: 1- A PLC Program on Omron PLC CP2E-N using high speed counter E6C3-AG5B 360P/R 2M(Absolute) ,to Reject bottles on Conveyor...
Replies
4
Views
874
Back
Top Bottom