Giter Site home page Giter Site logo

ldmicro / ldmicro Goto Github PK

View Code? Open in Web Editor NEW
132.0 132.0 71.0 8.81 MB

This is LDmicro support repository

Home Page: http://cq.cx/ladder.pl

License: GNU General Public License v3.0

C++ 74.00% C 23.79% Makefile 0.12% Perl 0.36% Batchfile 0.79% Shell 0.03% Python 0.12% CMake 0.50% Assembly 0.30%

ldmicro's Introduction

LDmicro

LDmicro is a program for creating, developing and editing ladder diagrams, simulation of a ladder diagram work and the compilation of ladder diagrams into the native hexadecimal firmware code of the Atmel AVR and Microchip PIC controllers.

Official LDmicro Ladder Logic for PIC and AVR Home Page
Official LDmicro Forum
Actual manual.txt

Download executable binaries buildXXXX.zip from the Latest release
You probably need to install the Microsoft Visual C ++ Redistributable Package if Visual C ++ is not installed in your operating system. See MSVCP100.dll is missing error

Read Ldmicro Wiki and HOW TO:

Building LDmicro

Building with make

LDmicro is built using the Microsoft Visual C++ compiler. If that is installed correctly, then you should be able to just run

make.bat

and see everything build.

Various source and header files are generated automatically. The perl scripts to do this are included with this distribution, but it's necessary to have a perl.exe in your path somewhere.

The makefile accepts an argument, D=LANG_XX, where XX is the language code. make.bat supplies that argument automatically, as LANG_EN (English).

Building with Cmake

For building LDmicro with Cmake you need Cmake itself, Perl interpreter and C++11 compiler.

You should use out-of-source-tree builds, so create e.g. a directory build in the main ldmicro directory. (If you choose to build in other directory, replace the .. in the following instructions with path pointing to the root/ldmicro directory.)

To build with MSYS + mingw-w64 + Make:

$ mkdir build
$ cd build
$ cmake -G "MSYS Makefiles" ..
$ make

To build with MSYS + mingw-w64 + Ninja:

$ mkdir build
$ cd build
$ cmake -G "Ninja" ..
$ ninja

To build within MSYS2, make sure you have these MSYS2 packages installed:

  • make
  • mingw-w64-i686-gcc, mingw-w64-i686-cmake

Build with Microsoft Visual Studio 2017

Visual Studio 2017 supports CMake build system, so you may just follow these instructions.

  1. Start Visual Studio 2017.
  2. In menu File, choose submenu Open and Folder.
  3. In the open dialog, navigate to LDmicro/ldmicro folder and open it.
  4. In menu CMake, choose to Build all.

Build with Older Version of Microsoft Visual Studio

To build with older Microsoft Visual Studio 2013 or 2015, you have to generate project files manually:

$ mkdir build
$ cd build
$ cmake -G "Visual Studio 12 2013" ..           # MSVC 2013, 32-bit build
$ cmake -G "Visual Studio 12 2013 Win64" ..     # MSVC 2013, 64-bit build
$ cmake -G "Visual Studio 14 2015" ..           # MSVC 2015, 32-bit build
$ cmake -G "Visual Studio 14 2015 Win64" ..     # MSVC 2015, 64-bit build
$ cmake -G "Visual Studio 15 2017" ..           # MSVC 2017, 32-bit build
$ cmake -G "Visual Studio 15 2017 Win64" ..     # MSVC 2017, 64-bit build
$ cmake -G "Visual Studio 16 2019" ..           # MSVC 2019, 32-bit build
$ cmake -G "Visual Studio 16 2019 Win64" ..     # MSVC 2019, 64-bit build

Then open the generated solution file build/ldmicro.sln in Visual Studio and build the target ALL_BUILD.

You can also choose LDmicro language. For that, you should set LDLANG variable for Cmake. LDLANG can be one of those values: EN, DE, ES, FR, IT, PT, TR, RU, JA or ALL.

cmake -G "Ninja" -DLDLANG=DE ..

ldmicro's People

Contributors

f1oat avatar ihornehrutsa avatar joegil95 avatar ldmicrogithub avatar slyshyko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ldmicro's Issues

Formatted String Over UART has an error.

This error is SELF-starting of "Formatted String Over UART" instruction.
It's displayed in LDmicro simulation mode.
image
It is visible if microcontroller are programmed and connected to a COM port of a computer.
"Formatted String Over UART" start to sending a string every time after reset.
image
Correct operation in this case is: no characters should not be sent to the UART port.

Fixed in release 3.1.1

ldmicro compiles sketch for arduino even if i selected pic mcu

i am using ldmicro 4.3.9.5v, i made a simple button led ladder, when i compiled it with pic MCU selected ldmicro created sketch for arduino, if i´d made it on purpose i think ldmicro should warn us when we are trying to compile sketch for arduino with pic mcu selected, see image please:
pic_compiledarduino

LDmicro goes into an endless loop if you try to display the dialog to set the DELAY delay when the mcu is not set to either AVR or PIC

Test case to demonstrate this issue:
Start the current version of LDmicro version 4.3.8.2
Create a simple program that has a single rung with the single instruction DELAY

  • Menu: Operations that change the course of the program -> Insert Delay(us)
    Double click on the DELAY instruction to open the dialog box for setting the delay time.
  • The delay dialog box does not open
  • LDmicro becomes unresponsive. On my 2-core Win7 laptop Task Manager shows LDmicro using 50% of the CPU. After about 5 seconds if you switch to another window and then switch back to LDmicro Win7 has updated the LDmicro window title to add "(Not Responding)". You can still click the close button and Windows will prompt you to "Check for a solution, Close the program or Wait for the program to respond".

My investigation into the reason for this behaviour:
The function ShowDelayDialog() in file simpledialog.cpp has the following loop:
for(i = 0; ; i++) {
if(Prog.mcu) {
if(Prog.mcu->whichIsa == ISA_AVR) {
T = i * 1000000 / Prog.mcuClock;
} else if(Prog.mcu->whichIsa == ISA_PIC16) {
T = i * 4000000 / Prog.mcuClock;
}
if(T != T0) {
T0 = T;
sprintf(s, "%lld, ", T);
strcat(buf1, s);
n++;
if(n >= 5) break;
}
}

The only break from the loop is inside the block "if(Prog.mcu) {} code" and only if the mcu is an AVR or a PIC. If the mcu is set to "(no microcontroller)" or "Controllino Maxi / Ext bytecode" then there is no exit from this loop.

Workaround for this issue:
If you are working with either "(no microcontroller)" or "Controllino Maxi / Ext bytecode" then the workaround for this bug is to set a AVR or PIC mcu, set the delay time and then set the mcu back to "(no microcontroller)" or "Controllino Maxi / Ext bytecode"

Test bit with arduino

Using ldmicro v442
If the program contains test bit instructions (if set bit) , it could not be compiled sketch to arduino.

Good morning, this program in ldmicro works in simulation but it gives error (int-2001) when compiling for arduino, is it wrong how to do the program?

Speed.txt Good morning, this program in ldmicro works in simulation but it gives error (int-2001) when compiling for arduino, is it wrong how to do the program?

Do you want to request a feature or report a bug?

What is the actual behavior?

If the actual behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via Google Drive(https://drive.google.com) or similar.

What is the expected behavior?

Which versions of LDmicro, and which OS are affected by this issue? Did this work in previous versions of LDmicro?

AVR calibration value

http://cq.cx/ladder-forum.pl?action=viewthread&parent=7350&tt=1526769469
(no subject) (by Ziggy)
A bit more on Baud rates and ATmega processors ( I know nothing about PICs)...
It is possible to based on a reference frequency adjust a variable which controls the free running onboard clock to be a bit more precise than the factory supplied configuration.

I use an STK500 and AVRstudio 4 ( yes old and familiar ). This combination offers a utility which calculates the required value to adjust the clock.

How to use this calibration value within LD micro if at all possible?

re-enable ansi C compilation with no MCU

It's not possible since some releases including v4.3.9.4 to generate generic ANSI-C code by selecting
"Settings-Microcontroller-(no microcontroller)"
as is was possible before! :-(
v4.3.9.4 throws an error-dialogue (see attached JPG),
v4.3.9 crashed, as i remember right... :-(

I used the hello.ld sample for testing...

Could you please re-enable this feature? ;-)

Thanx in advance... ;-)

http://cq.cx/ladder-forum.pl?action=viewthread&parent=7336&tt=1526547419

The code generated by "Compile ANSIC" for the PWM function does not appear to be able to work.

The generated code only passes one parameter the the pwm function, the duty cycle variable. The PWM frequency and PWM resolution are not passed to the PWM function.
The value in the PWM duty cycle variable is being overwritten by the value of the PWM frequency.

Test case to demonstrate this issue:
Start the current version of LDmicro version 4.3.8.3
Create a simple program that has two rungs
The first rung has a single MOV instruction that assigns the value "50" to the variable "duty_cycle"
-Menu: Instruction -> Signed variable operations -> Insert MOV (Move)
Double-click on the MOV instruction to display the Move dialog

  • Set the destination to the variable "duty_cycle" and the source to the value "50"
    The second rung has a singe PWM instruction
  • Menu: Edit -> Insert Rung After
  • Move to the second rung
  • Menu: Instruction -> Insert Set PWM Output
    Double-click on the PWM instruction to display the Set PWM Duty Cycle dialog
  • Accept all the default values. The "Duty Cycle" field is the variable "duty_cycle", The "Frequency (HZ)" field is the constant "1000" and the "Resolution" field is the value "0-100% (6.7 bits)"
    Compile to ANSI C
  • Menu: Compile -> Compile ANSIC
    The "Compile To" dialog is displayed. Accept the default filename new.c and click "Save".

Open the file new.c.
This is the code generated for Rung 2:

// ======= START RUNG 2 =======
LabelRung2:;
Write_Ib_rung_top(1);
// start series [
// ELEM_SET_PWM
if(Read_Ib_rung_top()) {
    Ui_duty_cycle = 1000;
    Write_Ub_PWMoutpin(Ui_duty_cycle);
    Write_Ib_PWMoutpin(1);
}
// ] finish series

In the line "Ui_duty_cycle = 1000;" the value of the PWM frequency "1000" has been assigned to the variable "duty_cycle", overwriting the value of "50" that we set it to in Rung 1.
In the the line "Write_Ub_PWMoutpin(Ui_duty_cycle);" only one parameter, the duty cycle variable, is passed to the PWM function. The PWM frequency and resolution values are not passed to the PWM function. The PWM frequency and resolution values are not declared anywhere else in the generated code so the PWM function can not know what these values are.

Ldmicro forum offline

The forum is offline, probably for maintenance, it's not the first time, so don't worry.
If it remains offline maybe we can continue here.

LDmicro for ESP8266

develop ldmicro for esp8266. It will be so great work to compile ladder logic in esp8266

TODO: CTC need upgrading!

I propose to move an element CTC count from EndOFRung to LeafOfRung. After the counter overflow CTC must generate OSR at its output.

This will create Rung following: see
new_ctc.txt

Error When Compiling

1
2

When i used latest version of LDmicro (build 421) there were some errors occured when compliling, but it's okay in the previous version (build 400).

PIC16F819 compile error

Do you want to request a feature or report a bug?

Bug

What is the actual behavior?

Every time I try to compile a code for 16F819, I get an "Internal error at line 6115 file 'pic16.cpp'"

This error seems to be code indipendent, I get the same error with a minimal code of one input and one output. Compiling same code for another processor (I tried only 16F628) ends done.

Which versions of LDmicro, and which OS are affected by this issue? Did this work in previous versions of LDmicro?

I got this error on build 4.3.8. I have tried the 4.3.7 receiving also an error, but in a different line of pic16.cpp.

OS is Windows 7. I've tried to run LDMicro as administrator with same results.

Stack overflow

В Visual C++ 2010 Express IDE
В ветке develop
First-chance exception at 0x00444033 in ldmicro.exe: 0xC00000FD: Stack overflow.
В режиме симуляции F7, F8 после double-click на елементе CONTACT

В Visual C++ 2010 Express IDE
В ветке master Ok

Без IDE
В ветке develop Ok

GEQ.zip

PIC 16F628

Do you want to request a feature or report a bug? YES

**What is the actual behavior?**ERROR DURING COMPILING ''INTERNAL ERROR AT LINE 2390 FILE PIC16.CPP"

If the actual behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via Google Drive(https://drive.google.com) or similar.

What is the expected behavior?

**Which versions of LDmicro, and which OS are affected by this issue? Did this work in previous versions of LDmicro?**VER 4.3.9.2

DE lang LDmicro

Do not close the issue!
to all

  1. Please translate to the German Language
    lang-de-diffs.txt like the lang-de.txt

  2. Please update the manual-de.txt according to the manual.txt

  3. Please screenshot the LDmicro Help-F1 window inside the LDmicro.
    I'm interested in how the umlaut symbols look.
    default

  4. Also, you can add/edit the manual.txt
    lang-sort.zip

PWM no longer possible on 16F628a

V4.3.8.3
You can no longer use the PWM instruction on a 16F628a, in V434 we can.

On a 16F876a you can only use 1 PWM channel.
In version V4.3.4 you can use 2 pwm pins.

problem "persist" arduino mega

I have been programming PLC for over 20 years and I can say that LDmicro is
a program at the highest professional level, really fantastic!
i using arduino mega 2560 ..I want to report the following problem :
Persist does not work ..I have identified the problem , the generate code from ldmicro is:
if(Read_Ib_rung_top()) {
if(!Read_Ib_once_4_PERSIST_variabile_sp_minuti()) {
Write_Ib_scratch(0);
Write1_Ib_scratch(); // EEPROM is ready
if(!Read_Ib_scratch()) {
Write_Ib_once_4_PERSIST_variabile_sp_minuti(1);
Ui_variabile_sp_minuti = EEPROM_read(0) + (EEPROM_read(1) << 8);
}
} else {
Write_Ib_scratch(0);
Write1_Ib_scratch(); // EEPROM is ready
if(!Read_Ib_scratch()) {
Ii_tmpVar24bit = EEPROM_read(0) + (EEPROM_read(1) << 8);
if(Ii_tmpVar24bit == Ui_variabile_sp_minuti) {
} else {
EEPROM_write(0, Ui_variabile_sp_minuti & 0xFF);
EEPROM_write(1, Ui_variabile_sp_minuti >> 8);
}
}
}
}
it does not work

I modified it as follows
if(Read_Ib_rung_top()) {
if(!Read_Ib_once_4_PERSIST_variabile_sp_minuti()) {
Write_Ib_scratch(0);
// Write1_Ib_scratch(); // EEPROM is ready
if(!Read_Ib_scratch()) {
Write_Ib_once_4_PERSIST_variabile_sp_minuti(1);
Ui_variabile_sp_minuti = EEPROM_read(0) + (EEPROM_read(1) << 8);
}
} else {
Write_Ib_scratch(0);
// Write1_Ib_scratch(); // EEPROM is ready
if(!Read_Ib_scratch()) {
Ii_tmpVar24bit = EEPROM_read(0) + (EEPROM_read(1) << 8);
if(Ii_tmpVar24bit == Ui_variabile_sp_minuti) {
} else {
EEPROM_write(0, Ui_variabile_sp_minuti & 0xFF);
EEPROM_write(1, Ui_variabile_sp_minuti >> 8);
}
}
}
}
it works properly
Release 4.3.9.0

Bug Report - Unclosed Rung - LDmicro Release 4.3.8, built 22:38:10 Feb 8 2018

When editing a simple rung, including an Input Contact and a CTC, the rung remains unclosed on the screen. See 'My Screen Capture.png' in attachment.
It seems that this is just a visual issue. For example, the simulation works fine.
The export in simple text format looks like good too.

I am expecting the rung is presented closed on the screen. See 'Expected Result.jpeg' in attachment.

I am testing LDmicro 4.3.8 under W7 Pro, on a 64 bits machine. Regarding that the 'Manual' file and the 'LDmicro Tutorial' file as well, are displaying correct look, I do believe it was fine with previous versions.

68cme

PS: Thanks a lot for providing this free software. I am using ladder diagrams in professional context, and feel very, very happy to have LDmicro for private use. Great job, really.

180327 - web - my screen capture

180327 - web - expected result

"Compile ANSIC" always generates a delay of 0 us no matter what delay value has been set for the DELAY instruction

Test case to demonstrate this issue:
Create a simple program that has a single rung with the single instruction DELAY
Menu: Operations that change the course of the program -> Insert Delay(us)

Set the mcu to any AVR or PIC microcontroller (to avoid the bug reported in issue #53)
Menu: Settings -> Microcontroller -> Atmel AVR ATmega2560 100-TQFP

Double click on the DELAY instruction to open the dialog box for setting the delay time.
Set a delay of 25

Compile to ANSI C
Menu: Compile -> Compile ANSIC
The "Compile To" dialog is displayed. Accept the default filename new.c

Examine the file new.ld
The DELAY instruction has 25 for the delay value.

Examine the file new.pl
The DELAY instruction has 0 for the delay value.

Examine the file new.c
The delay function calls for all the different C compilers each have 0 for the delay value.

My investigation into the reason for this behaviour:
In the file intcode.cpp in the function IntCodeFromCircuit() the case ELEM_DELAY calls the Op() function to create the entry in the IntCode[] array for the DELAY element. It only passes the value of the timer.name to the Op() function. It does not pass the value of the timer.delay to the Op() function so the literal field in the IntCode[] array element is not set and will always be the inital value of 0.

In the file ansic.cpp in the function GenerateAnsiC() the case case INT_DELAY writes the delay function calls for all the different C compilers using IntCode[i].literal as the delay value.

In the file intcode.cpp in the function IntDumpListing() the case ELEM_DELAY writes the DELAY instruction to the .pl file using IntCode[i].literal as the delay value.

In file simpledialog.cpp the function ShowDelayDialog() only includes the variable timer.name. The variable timer.delay is not passed to the delay dialog so the updated value of the delay does not get passed back from the delay dialog to update the timer.delay value in the leaf element.

MOD - Compile HEX

  1. Modulo function is not work
  2. When i try to "save as" ld file to different folder then i open it, i got some error when "Compile HEX". Because hex file not saved in new folder, but in old folder.

Thanks for LDmicro 👍

lcd module

Hi,
I have a funduino lcm1602 lcd display and want to display characters on it.
Does anyone have a circuit diagram and sample code for ldmicro?
I will use a pic16f887 and do not know the baud rate i will be using.
I have a 20mhz crystal.
Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.