[CX-ONE/Omron] Time Comparison Instruction

These instructions compare two sets of BCD date and time data each three words long and produce a true or false result. What are you trying to do??
 
I'm having trouble understanding this too.
Using a CP1L-EL20DR-D.

I'd like an output relay to switch on at midnight.

So far I've figured out:

C = 38 (which is 000111000 to HEX)
S1 = A351 (the internal clock)
S2 = ?

How do I input 0000 hours into S2? Do I use MOV into an address like D100? If so, how?

I'm trying to understand the conversion between digits to binary or whatever data is required.
 
Ok I got it working after 8 hours of trial and error..

For anyone who's struggling like me:

C is the mask for the timer and lets you ignore part of the current time.

The bits correspond to year/month/day/hour/min/sec.
So if you only need the hour it'll be 000100, or 3B in hex.

MOV #3B into D0 and that will be your mask.

S1 is the current time.
A351 = MMSS (minutes/seconds)
A352 = DDHH (day of month/hour)
A353 = YYMM (year/month)

S2 is the hour you'd like to set
So for 2PM you'd put #1400

I hope this helps and please correct me if I'm wrong.
 
Use ANDW #00FF or #FF00 to mask the values you do not require. For hours use ANDW #00FF A352 D???? and hours will be placed in D???? Quite easy when you know. The #00 masks the days. It is a 24 hour clock so 2PM is 1400 as you suggest but is in HEX. To compare use = D???? #14 then an output bit and the bit will turn on when it is 2PM and off at 3PM.
 

Similar Topics

so the CIO is for I/O and the W0.00 is like Siemens M 0.0 What is comparable to Siemens DB? I usually Map Siemens External I/O to a DB and then...
Replies
4
Views
2,021
Has anyone done SMS messaging from an Omron CJ2J-CPU31 PLC? If so could you help please. Omron here in Oz have not had any experience doing this...
Replies
3
Views
67
I have an old plc in the system I have, moxa nport was used to communicate with scada, I want to replace the plc with cj2m cpu33 and eliminate...
Replies
1
Views
53
Hi all, i have 8 CJ2m plc units that show different numbers on the plc display and i am stuck on reading the info. my unit has an ip address of...
Replies
3
Views
92
Hi all, Currently having trouble getting a speed reference to write over modbus to an Omron M1... I can successfully write a run command and...
Replies
6
Views
252
Back
Top Bottom