A
Just to start out, below is a first idea about general data types - just to simplify interchange.
/*
* File: DATA_TYPES.H
* LinuxPLC basic data types
*
* History:
* 06Jan00 AA 01 First pass - based on other modern standards
*/
typedef BOOLEAN unsigned char; /* 0 = false, 0xFF = true */
typedef INT8 char; /* 8-bit signed integer */
typedef INT16 short int; /* 16-bit signed integer */
typedef INT32 long int; /* 32-bit signed integer */
typedef UINT8 unsigned char; /* 8-bit unsigned integer */
typedef UINT16 unsigned short int; /* 16-bit unsigned integer */
typedef UINT32 unsigned long int; /* 32-bit unsigned integer */
typedef FP32 float; /* 32-bit IEEE floating point */
typedef FP64 double; /* 64-bit double-prec IEEE floating
point */
/* is there an ASNI standard (or need?) for 64-bit ints? */
/* typedef INT64 ??; ?* 64-bit signed integer */
/* typedef UINT64 ??; ?* 64-bit unsigned integer */
typedef struct t_str32 { /* string, len first, max 31 char
(with null-term) */
UINT8 length; /* why len? to simplify variable
sized headers */
UINT8 str[32];
} STRING32;
typedef struct t_vis_str { /* printable string, len first, max
255 char */
UINT8 length; /* why len? to simplify variable
sized headers */
UINT8 first_char; /* nothing stops you from using
null-term strings elsewhere */
} VISIBLE_STRING;
typedef struct t_oct_str { /* binary 'string', len first */
UINT32 length;
UINT8 first_octet;
} OCTET_STRING;
typedef struct t_date {
UINT16 year;
UINT8 month;
UINT8 day;
UINT8 day_of_week;
} DATE;
typedef struct t_time {
UINT8 hour;
UINT8 minute;
UINT8 second;
UINT16 hundred_micro_sec;
} TIME;
/* we should also have a "packed timestamp" type with date & time and
* a "time_since_01-Jan-2000" type for rapid time period calcs
* - suggestions? */
/* other complex objects (analog in etc) should be a different header file
* this header is for the basic 'elemental' data types
*/
August Albert
[email protected]
Singapore
_______________________________________________
LinuxPLC mailing list
[email protected]
http://linuxplc.org/mailman/listinfo/linuxplc
/*
* File: DATA_TYPES.H
* LinuxPLC basic data types
*
* History:
* 06Jan00 AA 01 First pass - based on other modern standards
*/
typedef BOOLEAN unsigned char; /* 0 = false, 0xFF = true */
typedef INT8 char; /* 8-bit signed integer */
typedef INT16 short int; /* 16-bit signed integer */
typedef INT32 long int; /* 32-bit signed integer */
typedef UINT8 unsigned char; /* 8-bit unsigned integer */
typedef UINT16 unsigned short int; /* 16-bit unsigned integer */
typedef UINT32 unsigned long int; /* 32-bit unsigned integer */
typedef FP32 float; /* 32-bit IEEE floating point */
typedef FP64 double; /* 64-bit double-prec IEEE floating
point */
/* is there an ASNI standard (or need?) for 64-bit ints? */
/* typedef INT64 ??; ?* 64-bit signed integer */
/* typedef UINT64 ??; ?* 64-bit unsigned integer */
typedef struct t_str32 { /* string, len first, max 31 char
(with null-term) */
UINT8 length; /* why len? to simplify variable
sized headers */
UINT8 str[32];
} STRING32;
typedef struct t_vis_str { /* printable string, len first, max
255 char */
UINT8 length; /* why len? to simplify variable
sized headers */
UINT8 first_char; /* nothing stops you from using
null-term strings elsewhere */
} VISIBLE_STRING;
typedef struct t_oct_str { /* binary 'string', len first */
UINT32 length;
UINT8 first_octet;
} OCTET_STRING;
typedef struct t_date {
UINT16 year;
UINT8 month;
UINT8 day;
UINT8 day_of_week;
} DATE;
typedef struct t_time {
UINT8 hour;
UINT8 minute;
UINT8 second;
UINT16 hundred_micro_sec;
} TIME;
/* we should also have a "packed timestamp" type with date & time and
* a "time_since_01-Jan-2000" type for rapid time period calcs
* - suggestions? */
/* other complex objects (analog in etc) should be a different header file
* this header is for the basic 'elemental' data types
*/
August Albert
[email protected]
Singapore
_______________________________________________
LinuxPLC mailing list
[email protected]
http://linuxplc.org/mailman/listinfo/linuxplc