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 - Presettable timer

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

Presettable timer (by José SCOURNEAU)
Good morning all,

I wish to realize a timer adjustable by potentiometer between 10 and 120 seconds with start of the delay by a contact. Would you have an idea for the program ?

thank you in advance.
Jose
Fri Nov 8 2019, 13:10:48
Presettable timer (by DanielH)
Hi José!

Attached scourneau_presettable_TON.ld as an example on how to program your adjustable timer.

Of course, there are multiple variants for programming this task, including the use of Time to Counter Converter instruction.

See https://github.com/LDmicro/LDmicro/wiki/TIME-to-COUNTER-converter

In LDmicro wiki and in this forum there are lot of examples.
But the user's own effort to learn how to program is irreplaceable.

Best regards,
DanielH
Fri Nov 8 2019, 22:20:39, download attachment scourneau_presettable_TON.ld
(no subject) (by DanielH)
One step further: performing calculations of the timer parameter only when TON is activated, using the evaluation of the rising edge in contact (Edge -> Insert OSR - One shot rising).

scourneau_presettable_TON_edge.ld attached.

Best regards,
DanielH
Fri Nov 8 2019, 22:41:45, download attachment scourneau_presettable_TON_edge.ld
Presettable timer (by José SCOURNEAU)
Hi Daniel,

thank you for your quick response!

I will check that as soon as I have some time,
thank you again.

Nice day to you.

Jose
Sat Nov 9 2019, 02:38:23
Presettable timer (by José SCOURNEAU)
Hi Daniel,

Sorry, I have no experience with analog inputs, for the TOF, how to proceed ?

Thank you,
Jose
Mon Nov 11 2019, 05:12:25
Presettable timer (by José SCOURNEAU)
Daniel,

in your first sample program, rung 16, how to configure the TON for scale?
Impossible for me to write "scale" in the field "time (ms)"

Thank you,
Jose
Mon Nov 11 2019, 09:42:50
Presettable timer: variable name in Timer's Delay (ms) field (by DanielH)
José:

I don't know why you cann't write "scale" or whatever variable name in Delay (ms) field of a timer: it accept strings since v4.4.1.0 (see https://github.com/LDmicro/LDmicro/wiki/Timer-with-variable-delay); but this feature was suffering a little error.

This error has been reported by me as #172 issue (see at https://github.com/LDmicro/LDmicro/issues?q=is%3Aopen+is%3Aissue : General variable name as Timer parameter: using keyboard, Delay text field only accepts characters used for hexadecimal digits #172)

Ihor has fixed this feature in v.5.3.0.4, so in latest versions this error doesn't appear.

What version of LDmicro are you using?
Latest stable release is 5.3.1.0, built 19:31:41 May 30 2019, you can download it from https://github.com/LDmicro/LDm...download/5.3.1.0/build5310.zip

Best regards,
DanielH
Thu Nov 14 2019, 09:32:43
Presettable timer (by DanielH)
...
>Hi Daniel,
>
>Sorry, I have no experience with analog inputs, for the TOF, how to proceed ?

What kind of Presettable timer do you need?
Delay ON (TON), Delay OFF (TOF), One Shot or Positive Pulse timer (THI), cyclic timer (TCY)?

I have developed my example as a TON; make a different type of presettable timer is not related on how to process potentiometer signal (analog input, rungs from beginning until 14) to obtain the "scale" value, but the logic for processing Xstart digital signal (rung 16).

Each kind of timer requires its own logic... but is easy to solve in this case: you can replace TON instruction in rung #16 by a TOF, or a THI, or a TCY...
Of course, you can do these changes using the same "scale" variable as parameter (please see my previous post on names for variable field in timers (and counters, too)).
I recommend you to try and simulate, you don't harm your PC!!!

BTW: there is a lot of programming examples in LDmicro forum, wiki, youtube. Take your time to read and learn!

Best regards,
DanielH
Thu Nov 14 2019, 10:03:25
(no subject) (by Tom J.)
José SCOURNEAU,

It's easier, and kind of neater to use two push buttons and step the delay value up and down rather than bother with ADC.
A PERSIST would ensure the timer value remained on the next boot but it's not a good idea to persist often so it would be maybe once per every timer cycle or two at most to keep the MCU healthy.
Sat Nov 16 2019, 14:07:26
Presettable timer (by José)
thank you for all these details,
I installed the latest version LDmico as suggested by Daniel,
I will test, ...
Wed Nov 20 2019, 02:05:38
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):