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 - LDmicro with 999 rung support

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

LDmicro with 999 rung support (by asc)
Hit the 99 rung limitation, the ld file when compiled still fit the 40 pin pics. So I needed to find a way to increase the amount of rungs supported.

Could not get LDmicro to compile using the 2003 Platform SDK download. The sdk did not include cl.exe for x86.

Finally got LDmicro to build using UnixTools, Strawberry Pearl and Visual C++ 2010 Express by going to Visual Studio Command Prompt 2010, cd to the ldmicro-rel2.2\ldmicro folder and type make.

I increased the rungs to 999 by changing the following line in ldmicro.h
#define MAX_RUNGS 999

This alone seems to work but the rung numbers on the left side of the screen print as two characters. To fix that, draw_outputdev.cpp needs to be changed.

comment all the instructions in the following if statement
if(rung < 10) {

and add the following lines below

char r[3] = { (rung / 100) + '0', (rung - (rung / 100) * 100)/10 + '0' , (rung % 10) + '0' };
TextOut(Hdc, 5, yp, r, 3); // 5 used to be 8

To get the export as text function displaying 3 character rung numbers, comment all the instruction in the following if statement
if((i + 1) < 10) {

and add the following lines below

ExportBuffer[cy+1][2] = '0' + ((i + 1) % 10);
ExportBuffer[cy+1][1] = '0' + ((i+1) - ((i+1) / 100) * 100)/10;
ExportBuffer[cy+1][0] = '0' + ((i + 1) / 100);

find the line
ExportBuffer[i] = (char *)CheckMalloc(l);

and change to
ExportBuffer[i] = (char *)CheckMalloc(l+1); // added 3 char rungs

This seems to work fine. The hex files produced by this modified version match the test files supplied with the sources.

Attached is a file with the files that have been modified and a compiled ldmicro.

-asc
Fri Dec 30 2011, 20:18:25, download attachment ldmicro-999rungs.zip
(no subject) (by David R)
Hi ASC
Thanks vary much this has always been A limitation which forces me to program in sub elements and limit the amount of comment.
Regards
David.
Sun Jan 1 2012, 19:37:42
(no subject) (by asc)
Turns out, I started getting errors in line 844 of draw.cpp when the ladder logic file started getting complicated.

The following defines need to be changed from their initial values of 16 and 512 to support the 999 rungs.

#define MAX_ELEMENTS_IN_SUBCKT 256
#define DISPLAY_MATRIX_Y_SIZE 2048


The attached file includes all the modified files and a compiled ldmicro. I have included a test file that shows the new maximums
that can be handled:

15 contacts in series and a coil in a rung
999 rungs

-asc
Sun Jan 1 2012, 21:33:03, download attachment ldmicro-999rungs.zip
LDmicro with 999 rung support (by Olivier)
Hi asc,

Good enhancement for LD !
I've tested your first mods yesterday and have the same bug as you (error in draw.cpp);
Added your last mods, and works well !

Many thanks !


Olivier
Sun Jan 1 2012, 22:00:06
999 canot compile (by chaminda prasad)
hi all
this program canot 999 rung
only 256 rung
plz check this program

thanks
Sat Sep 8 2012, 03:57:44
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):