7: BASIC I NSTRUCTIONSFC5A MICROS MART U SER’ S MANUAL FC9Y-B1268 7-15CNTD, CDPD, and CUDD (Double-Word Counter)Three types of double-word counters are available; adding (up) counter CNTD, dual-pulse reversible counter CDPD, andup/down selection reversible counter CUDD. A total of 128 double-word counters can be programmed in a user programfor any type of CPU module. Each double-word counter uses 2 consecutive devices starting with the allocated device,which can be C0 through C254. Once used in a user program, counters cannot be used in any other counter instructions.These instructions are available on upgraded CPU modules with system program version 200 or higher.Counter Device Address Preset ValueCNTD (double-word adding counter) C0 to C254 Constant: 0 to 4294967295Data registers: D0 to D1998D2000 to D7998D10000 to D49998CDPD (double-word dual-pulse reversible counter) C0 to C254CUDD (double-word up/down selection reversible counter) C0 to C254The valid device range depends on the CPU module type. For details, see pages 6-1 and 6-2.The preset value can be 0 through 4,294,967,295 and designated using a constant or a data register. If a data register is designated asthe preset value, two consecutive data registers are used.CNTD (Double-Word Adding Counter)When double-word adding counter instructions are programmed, two addresses are required. The circuit for a double-word adding (UP) counter must be programmed in the following order: reset input, pulse input, the CNTD instruction,and a counter number C0 through C254, followed by a counter preset value from 0 to 4,294,967,295.The preset value can be designated using a constant or a data register. When a data register is used, the double-worddata of two consecutive data registers becomes the preset value. For 32-bit data storage setting, see page 5-48.Ladder DiagramI2Reset Input I0 ONOFFPulse Input I1 ONOFFCounter C0 ONOFFTiming ChartOutput Q0 ONOFF99998Input I2• • •C099999 100000ONOFFCNTD C0100000I1ResetPulseInstruction DataLODLODCNTDLODANDOUTI0I1C0100000I2C0Q0Program ListI0 Double-word counter instructions use two consecutivecounters, and counters cannot be used more than once in auser program. While the reset input is off, the counter counts the leadingedges of pulse inputs and compares them with the presetvalue. When the current value reaches the preset value, the coun-ter turns output on. The output stays on until the reset inputis turned on. When the reset input changes from off to on, the currentvalue is reset. When the reset input is on, all pulse inputs are ignored. The reset input must be turned off before counting maybegin. When power is off, the counter’s current value is held, andcan also be designated as “clear” type counters using Func-tion Area Settings (see page 5-5). Counter preset and current values can be changed usingWindLDR without downloading the entire program to theCPU again. From the WindLDR menu bar, select Online >Monitor > Monitor, then Online > Custom > New CustomMonitor. To change a counter preset value, select DEC(D) inthe pull-down list box. When the preset or current value is changed during counteroperation, the change becomes effective immediately. For the data movement when changing, confirming, andclearing preset values, see page 7-18. WindLDR ladder diagrams show CP (counter preset value)and CC (counter current value) in advanced instructiondevices. The preset value 0 through 4,294,967,295 can be designatedusing a data register D0 through D1998 (all CPU modules) orD2000 through D7998 and D10000 through D49998 (slim typeCPU modules); then the data of the data registers becomesthe preset value. Directly after the CNTD instruction, the OUT,OUTN, SET, RST, TML, TIM, TMH, TMS, TMLO, TIMO, TMHO, orTMSO instruction can be programmed.CNTD C28D5I1ResetPulseI0 Q0Q0Phone: 800.894.0412 - Fax: 888.723.4773 - Web: www.clrwtr.com - Email: info@clrwtr.com