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 - count up/ count down

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

count up/ count down (by Alex)
i was trying to make a counter from 0 to 10, like this



LADDER DIAGRAM:
|| ||
|| X1 Cnew ||
0001||-------] [----------[CTR 10:0]----||
24|| ||
|| ||
|| X2 Cnew ||
0002||-------] [----------[CTC 0:10]----||
28|| ||
|| ||
|| ||
2||------[END]-----------------------||
58|| ||
|| ||

I/O ASSIGNMENT:
Name | Type | Pin | Port | Pin name
----------------------------+--------------------+-----+------+-----------
Cnew | contador | | |
X1 | entrada digital | | |
X2 | entrada digital | | |

VAR LIST:
2 bytes CA Now not used !!!
2 bytes Cnew Now not used !!!


* I want to make an up/down counter that starts from 0, but it starts from 10. How can i make the logic ladder?
Sat Dec 10 2016, 12:07:26
(no subject) (by Alex)

ladder:

|| ||
|| X1 Cnew ||
||-------] [----------[CTR 10:0]----||
|| ||
|| ||
|| X2 Cnew ||
||-------] [----------[CTC 0:10]----||
|| ||
|| ||
|| ||
||------[END]-----------------------||
|| ||
|| ||
Sat Dec 10 2016, 12:08:42
(no subject) (by MGP)
Use the ADD and SUB instructions, not the circulair up and down counters.

Remember that they are circulair!
Sat Dec 10 2016, 15:48:59
(no subject) (by Alex)
yeah, it worked, thanks a lot :)
Sat Dec 10 2016, 21:15:10
(no subject) (by Ihor Nehrutsa)
In fact, the use of counter is intuitive to the user and the processor uses less memory.
Mon Dec 19 2016, 10:25:42, download attachment ctc_vs_add.ld
(no subject) (by MGP)
Yes, it uses less memory, but he needed a up/down counter with the same variable name as far as I have understood his question.

With a circulair counter you can't do this.
Mon Dec 19 2016, 13:39:53, download attachment up-down_exemple.ld
(no subject) (by Alex)
yeah, one of the advantage of ldmicro is that it is intuitive to the user, the first idea i got for a 0-10 counter and vice versa was using counters(CTC , CTR), but it always started in 10, i could make an arrangement to make it start in 0 as ldmicro is intuitive, finally using the add sub as MGP told me it worked ok
Mon Dec 19 2016, 14:24:09, download attachment counter_add_sub.ld
(no subject) (by Alex)
this is the first attempt with CTC and CTR
Mon Dec 19 2016, 14:34:10, download attachment counter_CTC_CTR_exmaple.ld
(no subject) (by Alex)
this is with CTC and CTR with arrangement
Mon Dec 19 2016, 14:35:01, download attachment counter_CTC_CTR_exmaple(arrengement).ld
(no subject) (by Ihor Nehrutsa)
this is with CTC and CTR (CTU, CTD) with init
Tue Dec 20 2016, 04:56:39, download attachment counter_CTC_CTR_exmaplearrengement_2.ld
(no subject) (by Alex)
yeah many ways with ldmicro, then so Counters use less memory for the processors or ADD/SUB with MOVE?
Mon Jan 9 2017, 12:26:25
(no subject) (by Ihor Nehrutsa)
You are free to conduct research, which of the equivalent operations takes less memory.

The numbers in left side of ladder diagram is
- rung number,
- number of internal operations,
- number of ASM/HEX operations. <- compare these numbers for different rungs.
Tue Jan 10 2017, 03:55:11, download attachment Rung asm hex numbers.JPG
(no subject) (by Alex)
I see Ihor, thanks for your reply
Tue Jan 10 2017, 08:12:06
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):