LDmicro to Arduino program only partially working. Please help!

Hello,
I have been trying for weeks to build a program to exercise a pump. I started out trying to program in Arduino IDE, and then realized I was in way over my head. So I turned to the ladder

logic program LDmicro. I have a decent amount of ladder logic experience, and was able to write the program in a couple of minutes.

This is where it goes down hill. I compiled the program in LDmirco to C and then generated the .H file with this website: [Ladder Gen](http://adam.horcica.cz/tools/ladder-

gen/) . I have been trying to get this program to run ever since, and am ready to throw this thing against the wall.

The pump I am trying to control is a Diesel powered high pressure chemical pump. It’s really old, but was designed to be left alone in a field somewhere so it already has hardwired
shutdowns for things like water temp, water level, and oil pressure. This pump rarely gets used, and when we do need it I have to work on it for 2 days to get it running correctly again.

So I thought with an Arduino I could just program the pump to exercise once a week for 10 minutes or so. I figured I needed 4 outputs. Buzzer (audible alarm the thing is about to start), Bypass switch (to bypass the existing low oil pressure shutdown until the pump runs), Start, and Run. It would try to crank 3 times for x number of seconds, and if failed it wouldn’t try to exercise again until someone cycled the power on the Arduino box.

There is also an LED that blinks every 5 seconds (pin 13, and it is blinking correctly), and a shutdown LED. I was going to use an oil pressure switch as an input to let the Arduino know it’s running.

I am also using a relay shield by seeed studio… v1.3. I do not get any errors compiling or uploading the program. I know the program is running and timing correctly because the power light blinks every 5 seconds. I loaded the test program into the arduino to test the seeed shield, and it works correctly. I just cannot get the relays to do anything with my program. I am using an Arduino UNO.

Pump_Test.ld (2.55 KB)

ladder.h (1.57 KB)

ladder.cpp (21.4 KB)

Working_Test.ino (386 Bytes)

ladder.h

  pinMode(4, OUTPUT);

/* Individual pins (this code is used in ladder.cpp) */

inline BOOL Read_U_b_Yd4(void)
{
    return digitalRead(4);
}

Is that going to be a problem?

(I vote for the line-breaks too. You can edit your post by clicking on "modify" )

/* Individual pins (this code is used in ladder.cpp) */

inline extern BOOL Read_U_b_Xd12(void)
{
    return digitalRead(12);
}

inline BOOL Read_U_b_Yd4(void)
{
    return digitalRead(4);
}

inline void Write_U_b_Yd4(BOOL v)
{
    digitalWrite(4, v);
}

inline BOOL Read_U_b_Yd5(void)
{
    return digitalRead(5);
}

inline void Write_U_b_Yd5(BOOL v)
{
    digitalWrite(5, v);
}

I'm sorry but I do not follow. It seems that every pin has a digital read and write associated with it. Is that what you are referring to?