Use masked equality comparisons against the CJ1M-CPU11 real-time clock words. Minutes occupy the high byte of A351, while hours occupy the low byte of A352. Compare these BCD fields with #-prefixed constants, then generate a one-shot event so the bell does not retrigger throughout the matching minute.
Identify the Clock Fields
The clock words contain multiple fields, so do not compare the complete A351 or A352 word with a standalone hour or minute. The clock data in A351 through A354 is read-only; reading it for bell control does not require the DATE instruction.
| Value | Location | Mask | Comparison form |
|---|---|---|---|
| Hours | Low byte of A352 | #00FF |
#0007 for 07; #0008 for 08 |
Compare BCD Time Correctly
The clock stores decimal digits in BCD. A #-prefixed constant preserves the required digit pattern, so no decimal conversion is needed. Mask each word with ANDW, then use an equality comparison or CMP. A date/time comparison such as =DT is unnecessary for matching individual hour and minute fields.
minute_field := A351 AND #FF00
hour_field := A352 AND #00FF
short_request := (minute_field = #5900) AND (hour_field = #0007)
long_request := (minute_field = #0000) AND (hour_field = #0008)
If MOVD extracts and relocates the digits instead, compare against the value at the destination's new digit position. Do not combine a high-byte mask with an unshifted #0059 comparison: masking A351 with #FF00#5900.
Generate One Bell Event
- Mask A351 and A352 into working words.
- Compare the masked fields with the scheduled BCD hour and minute.
- Combine the time result with the required day condition, such as the existing A354.01 Monday qualifier.
- Apply a rising-edge or one-shot condition before starting the bell timer. Alternatively, store the previous hour and trigger when the hour changes.
- Let separate timers define the short and long bell durations. One documented implementation used W0.00 for a 5-second bell on the hour; choose durations appropriate to the installation.
The one-shot is essential because an equality condition such as minutes equal zero remains true for the entire matching minute. The bell request must start the timer once, not on every PLC scan.
Verify the Schedule
Monitor A351, A352, the masked working words, comparison results, one-shot bit, timer, and bell output online. At 07:59, confirm the minute field is #5900 and the hour field is #0007. At 08:00, confirm they become #0000 and #0008, and verify that each transition starts only one bell cycle.
FAQ
Which CJ1M clock addresses contain hours and minutes?
Minutes are in the high byte of A351, and hours are in the low byte of A352. Mask them with #FF00 and #00FF, respectively.
How do I compare 07:59 in an Omron CJ1M PLC?
After masking, compare the A351 minute field with #5900 and the A352 hour field with #0007. The # prefix supplies the required BCD-compatible digit pattern.
Why does the hourly bell trigger repeatedly?
The minutes-equal-zero condition stays true for the complete minute. Put a rising-edge or one-shot condition before the bell timer, or trigger once when the stored previous hour differs from the current hour.