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 - GOTO instruction

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

GOTO instruction (by Ihor Nehrutsa)
Fri Apr 21 2017, 09:13:15
(no subject) (by MGP)
Usefull with the instructions #TRISB and #PORTB for high speed byte transfer if I'm think correctly..
Fri Apr 21 2017, 13:31:44
(no subject) (by bfwolf)
To Ihor: Brilliant idea! ;-)
Even better: Perhaps you sometimes implement GOSUB, RETURN and LABEL instruction. This would give some kind of 'function-blocks' - especially if there would be the possibility of exporting a selection (of rungs) and later importing (them) at before/after a rung at the cursor-position. ;-)
LABEL instruction could be useful for the GOTO instruction, too!
(GOTO label_name / GOSUB label_name)
Parameter-passing to 'sub-programs' could be done with variables (MOVE ...)

Thank you, again, Ihor! ;)
Sat Apr 22 2017, 12:10:15
(no subject) (by Ihor Nehrutsa)
I foresee big problems with simulation.
we have:
Simulate
Simulate single cycle

but this we need too:
Simulate one rung
Step over ( execute subroutine as single step )
Step into ( cursor must go inside the subroutine )

Without simulation will be too hard /:(
Sat Apr 22 2017, 13:23:16
(no subject) (by bfwolf)
To Ihor:

Maybe, you are right ;-)
I don't have the deep-insight-view, as you have...

But i suppose, that GOSUB and RETURN would'nt make a big difference to GOTO (beside the use of a call-stack).
All instructions (GOTO/GOSUB/RETURN) change the linear program flow...

Having a step-over option in simulation would be great, but not really a MUST... ;-)
Sat Apr 22 2017, 15:56:26
(no subject) (by MGP)
@bfwolf, I'm using the Master Control Relay for this.

It is not a complete GOSUB routine but a very useful one because LDmicro's cycletime is a big GOSUB or GOTO.

I think that GOTO is already over the edge, but it is easy to handle because he uses rung numbers.

That's my opinion. ;)
Sun Apr 23 2017, 02:03:52
(no subject) (by bfwolf)
To Ihor:

Thank you for your idea with Master-Control-Relays around 'sub-programs' - yes, they could be called from different places, if you enable them there in different cycles... :-)
...as they are executed only once/cycle...

Anyway - having 'real-sub-programs' would be great at somday! ;)
Sun Apr 23 2017, 05:11:38
(no subject) (by Ihor Nehrutsa)
Fri Apr 28 2017, 13:19:50
(no subject) (by MGP)
Great, the start of a SPI instruction, sending 1 byte to a 4094 or 74165 at high speed. ;-)
Sat Apr 29 2017, 08:40:29
SUBPROG, ENDSUB and GOSUB instruction (by Ihor Nehrutsa)
Sat Apr 29 2017, 19:09:22
(no subject) (by bfwolf)
To Ihor:

...Seems, that it wasn't that difficult as expected xD
Looks very promising! ;-)

Thank you very much!!!

If there would be the possibility to save selections to a export-file and reimport the exports at a selected rung, we could build a library of sub-programs for certain jobs ;-)

Happy weekend and May,1st ;-)
Sun Apr 30 2017, 15:51:54
(no subject) (by Ihor Nehrutsa)
You can use Copy/Paste to copy rungs from one LD to another.

You can select several rungs in source LD
(press Shift key on keyboard and move the kursor by Up/Down keys, the '*' simbol will marks the selected rungs).
Then Copy Rungs (Ctrl+Insert), the selected rungs will be saved in temp.ld.
Then open/select the destination LD file
and Pate Rungs (Shift+Insert), the rungs from the temp.ld file will be inserted into the current(destination) LD file.

(!!! There are some bugs with the insertion when kursor at COMMENT or the inserted rungs include the COMMENTs. This is not a critical bug).

to bfwolf: thanks, I zharil shashlik today ;-)
Sun Apr 30 2017, 18:12:48
(no subject) (by bfwolf)
Hello Ihor,

thank you for your hint with the usage of Copy+Paste and the undocumented 'temp.ld' ;-)

So we could copy the temp.ld file away and if we use different filenames (rename the temp.ld eg to temp_counter.ld) and later copy them back to temp.ld and re-import them by Paste. :-)
This would be a workaround for a real export/import.
Or perhaps we have 2 instances of ldmicro.exe running at the same time and use 1 of them for saving/loading the 'paste-buffer' (temp.ld) to real files. :-)

Enjoy your shashlik today ;-)
...it's rainy here in the black-forest... :(

Some question: why are the instructions
UART_Transmit(I_i_charToUart);
and
I_b_scratch = UART_Transmit_Ready();
still commented out with // in the generatet c-source?
If there would be local macros with #ifndef around for them, we could have them activated and a full function - am i wrong? ;-)
Mon May 1 2017, 04:44:10
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):