Thanks, I could compile it successfully, but let me ask another question. I'm trying to run that OpenPLC "hello world" example, using OpenPLC, Simlink and a Simulink application on the same computer. I start OpenPLC normally, but when I start SimLink, it shows random data (analog and digital) for 5 stations (values for pump, tank, valve, pressure) even after I changed the interface.cfg file in order to use only station0 and just one digital input and one digital output. My interface.cfg file is:
num_stations = "1"
comm_delay = "100"
# ------------
# SIMULINK
# ------------
simulink.ip = "localhost"
# ------------
# STATION 0
# ------------
station0.ip = "localhost"
station0.add(digital_in) = "10001"
station0.add(digital_out) = "10002"
All other lines are commented. I also tried to change the main code (simlink.cpp), by commenting all the printf lines of the main loop that don't refer to station0 but it also didn't work and I still can't get appropriate data for the digital in and out that I want to use. I changed the main loop to:
while(1)
{
pthread_mutex_lock(&bufferLock);
printf("Station 1\nDigIn: %d\tDigOut: %d\n", stations_data[0].digitalIn[0], stations_data[0].digitalOut[0]);
//printf("Station 2\nPressure: %d\t\t\tPump: %d\t\tValve: %d\n", stations_data[1].analogIn[0], stations_data[1].digitalOut[0], stations_data[1].digitalOut[1]);
//printf("Station 3\nPressure: %d\t\t\tPump: %d\t\tValve: %d\n", stations_data[2].analogIn[0], stations_data[2].digitalOut[0], stations_data[2].digitalOut[1]);
//printf("Station 4\nPressure: %d\t\t\tPump: %d\t\tValve: %d\n", stations_data[3].analogIn[0], stations_data[3].digitalOut[0], stations_data[3].digitalOut[1]);
//printf("Station 5\nPressure: %d\tTank: %d\t\tPump: %d\t\tValve: %d\n\n", stations_data[4].analogIn[0], stations_data[4].analogIn[1], stations_data[4].digitalOut[0], stations_data[4].digitalOut[1]);
pthread_mutex_unlock(&bufferLock);
sleep_ms(3000);
}
Any suggestions to solve this problem?