LDmicro with 999 rung support

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.

Download link:
Explore posts in the same categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: