tests/plc.c
author lbessard
Mon, 19 May 2008 14:07:31 +0200
changeset 121 9e8ce092e169
parent 57 db9cadaab2ea
child 132 39f88c3d803d
permissions -rw-r--r--
Adding support for POU struct definition in POUS.h
Adding program instanciated in configuration definition into VARIABLE.h
57
db9cadaab2ea Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff changeset
     1
#include "iec_std_lib.h"
db9cadaab2ea Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff changeset
     2
#include <stdio.h>
db9cadaab2ea Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff changeset
     3
db9cadaab2ea Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff changeset
     4
/*
db9cadaab2ea Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff changeset
     5
 * Functions and variables provied by generated C softPLC
db9cadaab2ea Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff changeset
     6
 **/ 
db9cadaab2ea Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff changeset
     7
void config_run__(int tick);
db9cadaab2ea Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff changeset
     8
void config_init__(void);
db9cadaab2ea Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff changeset
     9
db9cadaab2ea Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff changeset
    10
/*
db9cadaab2ea Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff changeset
    11
 *  Functions and variables to export to generated C softPLC
db9cadaab2ea Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff changeset
    12
 **/
db9cadaab2ea Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff changeset
    13
 
db9cadaab2ea Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff changeset
    14
TIME __CURRENT_TIME;
db9cadaab2ea Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff changeset
    15
db9cadaab2ea Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff changeset
    16
#define __LOCATED_VAR(type, name, ...) type name;
db9cadaab2ea Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff changeset
    17
#include "LOCATED_VARIABLES.h"
db9cadaab2ea Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff changeset
    18
#undef __LOCATED_VAR
db9cadaab2ea Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff changeset
    19
db9cadaab2ea Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff changeset
    20
static int tick = 0;
db9cadaab2ea Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff changeset
    21
db9cadaab2ea Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff changeset
    22
void run()
db9cadaab2ea Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff changeset
    23
{
db9cadaab2ea Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff changeset
    24
    printf("Tick %d\n",tick);
db9cadaab2ea Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff changeset
    25
    config_run__(tick++);
db9cadaab2ea Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff changeset
    26
    printf("  Located variables : \n");
db9cadaab2ea Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff changeset
    27
#define __LOCATED_VAR(type, name,...) __print_##type(name);
db9cadaab2ea Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff changeset
    28
#include "LOCATED_VARIABLES.h"
db9cadaab2ea Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff changeset
    29
#undef __LOCATED_VAR
db9cadaab2ea Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff changeset
    30
}
db9cadaab2ea Now generated SoftPLC compiles with mingw32 and run windows.
etisserant
parents:
diff changeset
    31