Home
Prox / RFID
Verichips
Ladder Logic
[interfacing] †
Tube Joints
Key Code From Photo
SolveSpace (3d CAD)
SketchFlat (2d CAD)
Photographs
Miscellany
Resume / Consulting
Contact Me

LDmicro Forum - Please, give me some advice for a part of the WriteRuntime rutine.

(you are viewing a thread; or go back to list of threads)

Please, give me some advice for a part of the WriteRuntime rutine. (by Noh)
I'm a beginner in the LDmicro and I have a question.

Why this program should go into the loop and be waiting for the interrupt
which occurs after the cycle time?

DWORD now = AvrProgWriteP;
IfBitClear(REG_TIFR, tifrBitForOCF1A);
Instruction(OP_RJMP, now, 0);

Thank in advance!
Wed Nov 2 2011, 20:10:01
(no subject) (by Jonathan Westhues)
The ladder logic program gets executed repeatedly, once every cycle time. That's the fundamental way that the ladder logic program gets its sense of time. A timer, for example, is really just a counter that counts up every cycle; with a cycle time of, for example, 10 ms, a time delay of 300 ms is represented as a count of 30.

The micro's timer peripheral is used to measured that cycle time. So every cycle, we execute the program, wait for the next cycle time, and repeat. There's other ways that we could do that timing, but the timer peripheral is convenient.
Thu Nov 3 2011, 00:32:23
Post a reply to this comment:
Your Name:
Your Email:
Subject:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):