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 - Converting a Ladder .ld file into a C program !

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

Converting a Ladder .ld file into a C program ! (by José)
I'm working on a program designed to convert a .ld file into an equivalent C source file, with the help of a few external libraries.

Some may say that ldmicro still does the job... YES... except that C files generated by ldmicro are absolutely ugly, unreadable and unusable by human beings.

The C files I generate are easy to read and reflect the structure of the ladder. But there's a price to pay : resulting C files, and also hex files, will probably be bigger than the original ones.

As a compensation, this approach may easily enable the use of long variables, floating point ones, arrays of variables... in a ladder.

For the time being I'm testing it with my favorite STM32F4 target (with Jtag emulator), but then I'll deal with AVRs and PICs.

Let me know if ever you're interested in this project ?

José
Sun May 9 2021, 14:55:59
(no subject) (by OnosTech)
Hi José,

This is a great idea. At least the STM32 has enough memory to handle the bigger hex files.

I think this will be a very good improvement on LDmicro. I am very much interested in any improvement on LDmicro.

Onos
Sun May 9 2021, 16:38:45
(no subject) (by Paulino (Calubert))
Hola Jose parece bien si necesitas cualquier ayuda estoy disponible.
Saludos Paulino.

Hi Jose seems fine if you need any help I am available.
Greetings Paulino.

Salut Jose semble bien si vous avez besoin d'aide, je suis disponible.
Salutations Paulino
Mon May 10 2021, 05:40:30
(no subject) (by José)

That's nice to see that you're interested !

I may need help to test converted programs on some targets in the future.

You can compare in attached zip file C codes generated from the same ld file with ldmicro (v1) and with my soft (v2).

Best regards
José
Mon May 10 2021, 13:27:04, download attachment test.zip
(no subject) (by Paulino (Calubert))
Ok tu sais que nous sommes prêts
Tue May 11 2021, 06:23:01
(no subject) (by Ihor Nehrutsa)
to José
Dia José. Please tell me which STM32F4xx you are using.
I am trying to simulate STM32F401VE in Proteus(it has only stm32f103 and stm32f401) and have an issue with
MCU frequency.
stm32f401 max frequency is 84MHz(not 100MHz).
I comment
//SystemInit(); // initialize system clock at 100 MHz (F4) or 72 Mhz (F1)
and use default frequency 16MHz. In this case, I get the right PLC cycle period.
[email protected]
Thu May 13 2021, 13:38:36
(no subject) (by Andre)
very good to know that more people with knowledge can improve ldmicro.

google tradutor.
Thu May 13 2021, 15:50:56
(no subject) (by José)
To Ihor:

I have some STM32F407.

If you use the same libraries for your STM32F401, you can manage PLL frequencies in system_stm32f4xx.c and then call SystemInit().

BR
José
Fri May 14 2021, 03:35:11
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):