epec mini display moduleepec.planeetta.com › public › manuals › codesys_23_2029 › ... ·...
TRANSCRIPT
© Epec Oy
Epec Mini Display Module Programming Manual
Document: PM2029.doc Updated: 12.9.2006
Epec CAN Module Family
Mini Display Module Programming Manual
2/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
DOCUMENT VERSION HISTORY Date Notes
4.5.2006 First released version
12.9.2006 Updated LCD_PRINT_UINT and LCD_PRINT_INT
Epec CAN Module Family
Mini Display Module Programming Manual
3/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
TABLE OF CONTENTS
1 PURPOSE OF THIS DOCUMENT...................................................................................5
2 MINI DISPLAY MODULE GENERAL DESCRIPTION...............................................5 2.1 Memory Allocation Table............................................................................................. 5 2.2 Comparing Byte, Word and Double-Word Access to same Address............................ 6 2.3 Comparing Bit and Word Access to same Address ...................................................... 6
3 INTERNAL FUNCTIONS..................................................................................................7 3.1 PWM Output Configuration ......................................................................................... 7 3.2 Configuration information ........................................................................................... 7
4 FUNCTION SPECIFICATIONS .......................................................................................8 4.1 CAN LIBRARY.............................................................................................................. 8
4.1.1 CAN_INIT......................................................................................................... 8 4.1.2 CAN_OBJ_RX ................................................................................................ 10 4.1.3 CAN_OBJ_RX_INIT....................................................................................... 12 4.1.4 CAN_OBJ_TX................................................................................................. 13 4.1.5 CAN_OBJ_TX_INIT ....................................................................................... 15 4.1.6 CAN_RTR ....................................................................................................... 16 4.1.7 CAN_TX.......................................................................................................... 17
4.2 EEPROM LIBRARY ................................................................................................... 19 4.2.1 EEPROM_READ............................................................................................ 19 4.2.2 EEPROM_WRITE .......................................................................................... 20
4.3 ANALOG I/O LIBRARY.............................................................................................. 22 4.3.1 AI_CONF_FB................................................................................................. 22
4.4 SERIAL LIBRARY....................................................................................................... 23 4.4.1 INIT_COM...................................................................................................... 23 4.4.2 WRITE_COM ................................................................................................. 25 4.4.3 READ_COM ................................................................................................... 26 4.4.4 CLOSE_COM ................................................................................................. 27
4.5 PLCopen Graphics Interface...................................................................................... 28 4.5.1 Graphic Function Usage in OpenPLC Application ....................................... 28 4.5.2 LCD_DRAWBITMAP ..................................................................................... 28 4.5.3 LCD_PRINT ................................................................................................... 29 4.5.4 LCD_PRINT_UINT ........................................................................................ 30 4.5.5 LCD_PRINT_INT ........................................................................................... 31 4.5.6 LCD_RECTANGLE........................................................................................ 32 4.5.7 LCD_FILLRECTANGLE................................................................................ 33 4.5.8 LCD_CLRSCR................................................................................................ 34 4.5.9 LCD_INIT....................................................................................................... 35 4.5.10 LCD_DRAWBYID .......................................................................................... 36 4.5.11 LCD_SETPIXEL............................................................................................. 37 4.5.12 LCD_CLEARPIXEL ....................................................................................... 38
Epec CAN Module Family
Mini Display Module Programming Manual
4/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
4.5.13 LCD_PUTPIXEL............................................................................................ 39 4.5.14 LCD_LINE...................................................................................................... 40 4.5.15 LCD_CIRCLE................................................................................................. 41 4.5.16 LCD_FILLCIRCLE ........................................................................................ 42
APPENDIX A Example of CAN library usage (3 pages)
Epec CAN Module Family
Mini Display Module Programming Manual
5/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
1 PURPOSE OF THIS DOCUMENT This document works as a programming manual for programmers who work with Epec PLCopen programmable modules. This document describes the basic function library features used in Mini Display Module. In Mini Display Module, the CAN bus protocol is not considered as a “higher level” protocol. However, CAN is suitable for smaller CAN implementations and special features (for example engine control and transmission).
2 MINI DISPLAY MODULE GENERAL DESCRIPTION The Mini Display Module is part of the Epec CAN Module Family. The display module is equipped with some input and output pins such as PWM outputs for proportional controls and feedback input for better accuracy of proportional controls. Versatile analog inputs can be used for example for joystick connection. In addition, the display module has some digital inputs and outputs for digital controlling. There are digital inputs which can be used as analog inputs and counterwise by the means of user application program. The display module is used in CAN bus based control systems as a multifunction controller with different kinds of sensors and actuators. It can be used also as an independent controller due to the digital and analog I/O capabilities. Furthermore, it is possible to connect control buttons to the display module. The display module has also a serial interface available. The Mini Display Module can be used in some lighter control applications in which some I/Os and visual information are both required at the same time. The I/O capabilities are moderate compared to the original Mini PLC Module as the LCD display requires some capacity too. The display module can be nicely used e.g. controlling secondary joystick functions and visually presenting the engine speed and other parameters on the graphical LCD. In addition, there are possibilities to include some buttons, switches and on/off sensors. For more information about the hardware part of the Mini Display Module, please consult the distinct Mini Display Module data sheet.
2.1 Memory Allocation Table Description Memory size Program memory (FLASH) Code 24 kB Global data 256 B Flag memory 128 B Graphics library 8 kB Reserved for fonts and bitmaps 12 kB Nonvolatile memory (EEPROM) Internal data for runtime 16 B User data 2032 B
Epec CAN Module Family
Mini Display Module Programming Manual
6/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
2.2 Comparing Byte, Word and Double-Word Access to same Address MSB LSBMB8 7 MB8 0
Most significant byte Least significant byte MSB LSB MW4 15 MB8 8 7 MB9 0
MSB LSBMD2 31 MB8 24 23 MB9 16 15 MB10 8 7 MB11 0
MSB = most significant bit LSB = least significant bit
2.3 Comparing Bit and Word Access to same Address Most significant byte Least significant byte MSB LSB MW4 15 MB8 8 7 MB9 0
MX4.0
MX4.15 MSB = most significant bit LSB = least significant bit
Epec CAN Module Family
Mini Display Module Programming Manual
7/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
3 INTERNAL FUNCTIONS
3.1 PWM Output Configuration Pin number / Function Address XM1.3 MX63.9 XM1.4 MX63.10 LCD Contrast Control MX63.8 LCD Back Light Control MX63.11
When address is set as “1”, the pin in question is used as PWM output. If address is set as “0”, pin is used as digital output.
3.2 Configuration information With IB6 you can read factory configuration information. Input byte Comment IB6.0 0 = No display
1 = LCD display is installed IB6.1 0 = X1/20 function is input
1 = X1/20 function is output In Mini Display, configuration is fixed as “0”
IB6.2 0 = Codesys interface is serial port 1 = Codesys interface is CAN bus
IB6.3 Reserved for future use IB6.4 Reserved for future use IB6.5 Reserved for future use IB6.6 Reserved for future use IB6.7 Reserved for future use
Epec CAN Module Family
Mini Display Module Programming Manual
8/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
4 FUNCTION SPECIFICATIONS
4.1 CAN LIBRARY For closer description of CAN, please refer to ISO standard 11898-2: “Road vehicles - Controller area network (CAN) - Part 2: High-speed medium access unit“.
4.1.1 CAN_INIT Description: This is the first function to use to get CAN system up and running. This initializes CAN buffers and prepares CAN network, thus enabling the first steps for successful CAN operation. CAN_INIT function initializes CAN bus and creates foundation for CAN message transmission. When Codesys is connected by CAN:
• Do not use CAN_INIT function block, use only when connected via RS port. • Baud rate is 250 kbit/s • Do not uses object number 0...1, they are reserved for runtime.
Library: CAN.LIB Symbol:
Inputs: Name Data type Data range Description ENABLE BOOL 0, 1 (TRUE/FALSE) TRUE enables function BRP BYTE 0…63 Baud rate prescaler SJW BYTE 0...3 Re-synchronization Jump Width PRS BYTE 0...7 Programming Time Segment PHS1 BYTE 0...7 Phase Segment 1 PHS2 BYTE 0...7 Phase Segment 2 CANX2 BYTE 0, 1 CAN clock
Outputs:
Name Data type Description ERROR BYTE 0 if configuration is ok
Epec CAN Module Family
Mini Display Module Programming Manual
9/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
Example: A Simple CAN initialization. INIT function is called in main program. Baud rate kbit/s
BRP SJW PRS PHS1 PHS2 CANX2
10 49 0 7 7 2 1 20 49 0 7 7 2 0 50 24 0 5 6 1 0 125 9 0 5 6 1 0 250 4 0 5 6 1 0 500 1 0 7 7 2 0 800 4 0 1 0 0 0 1000 0 0 5 7 4 0
Epec CAN Module Family
Mini Display Module Programming Manual
10/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
4.1.2 CAN_OBJ_RX Description: This function is used to receive CAN bus message objects. Function input OBJN specifies which message object identifier is received. DATA lines out will present message data which is received. OBJ input is an object defined in CAN_OBJ_RX_INIT initializations. Library: CAN.LIB Symbol:
Inputs:
Name Data type Data range Description OBJN BYTE 0…14 Receive object number
Epec CAN Module Family
Mini Display Module Programming Manual
11/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
Outputs:
Name Data type Data range Description ID DWORD 11 or 29 bit Message ID EXTENDED BOOL 0, 1 (FALSE, TRUE) If TRUE, message has extended id-
frame DLC BYTE 1…8 Data Length Code DATA1 BYTE 0…255 Message Data DATA2 BYTE 0…255 Message Data DATA3 BYTE 0…255 Message Data DATA4 BYTE 0…255 Message Data DATA5 BYTE 0…255 Message Data DATA6 BYTE 0…255 Message Data DATA7 BYTE 0…255 Message Data DATA8 BYTE 0…255 Message Data NEW_DATA BOOL 0, 1 (FALSE, TRUE) TRUE indicates that there is new
data in buffer. Output will return FALSE if data is read from buffer, and the buffer is empty.
ERROR BYTE 0… Returns >0 if function fails Example:
Epec CAN Module Family
Mini Display Module Programming Manual
12/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
4.1.3 CAN_OBJ_RX_INIT Description: This function is used to initialize CAN receive object. Function block CAN_INIT must be called before trying to initialize CAN receive object. Message masks can be defined with ID_TAG and ID_MASK inputs. See also CAN_OBJ_RX. Library: CAN.LIB Symbol:
Inputs:
Name Data type Data range Description ENABLE BOOL 0, 1 (TRUE/FALSE) TRUE enables function OBJN BYTE 0…14 Receive object number EXTENDED BOOL 0, 1 (TRUE/FALSE) If TRUE, message has
extended id-frame (29 bit) ID_TAG DWORD 11 or 29 bit ID_MASK DWORD 11 or 29 bit
Outputs:
Name Data type Description ERROR BYTE Function returns 0 if configuration is ok
Epec CAN Module Family
Mini Display Module Programming Manual
13/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
Example:
4.1.4 CAN_OBJ_TX Description: This function is used to send CAN object via CAN. Function is enabled with Boolean ENABLE input and OBJ input. OBJ input is an object defined in CAN_OBJ_TX_INIT initializations. Library: CAN.LIB Symbol:
Epec CAN Module Family
Mini Display Module Programming Manual
14/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
Inputs:
Name Data type Data range Description ENABLE BOOL 0, 1 (TRUE/FALSE) TRUE enables function OBJN BYTE 0…14 Transmit object number DLC BYTE 0…8 Data Length Code DATA1 BYTE 0…255 Message Data DATA2 BYTE 0…255 Message Data DATA3 BYTE 0…255 Message Data DATA4 BYTE 0…255 Message Data DATA5 BYTE 0…255 Message Data DATA6 BYTE 0…255 Message Data DATA7 BYTE 0…255 Message Data DATA8 BYTE 0…255 Message Data
Outputs:
Name Data type Description ERROR BYTE Returns 0 if function configuration is ok
Example:
Epec CAN Module Family
Mini Display Module Programming Manual
15/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
4.1.5 CAN_OBJ_TX_INIT Description: This function is used to initialize a CAN object to be sent. See also CAN_OBJ_TX. Library: CAN.LIB Symbol:
Inputs:
Name Data type Data range Description ENABLE BOOL 0, 1 (TRUE/FALSE) TRUE enables function OBJN BYTE 0…14 Transmit object number EXTENDED BOOL 0, 1 (TRUE/FALSE) If TRUE, message has extended
id-frame ID DWORD 11 or 29 bit Message ID
Outputs:
Name Data type Description ERROR BYTE Returns >0 if function fails
Example:
Epec CAN Module Family
Mini Display Module Programming Manual
16/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
4.1.6 CAN_RTR Description: This function is used to send remote transmission request via CAN. Library: CAN.LIB Symbol:
Inputs:
Name Data type Data range Description ENABLE BYTE 0, 1 (TRUE/FALSE) TRUE enables function OBJN BYTE 0...14 Receive object number
Outputs:
Name Data type Description ERROR BYTE Returns >0 if function fails
Example:
Epec CAN Module Family
Mini Display Module Programming Manual
17/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
4.1.7 CAN_TX Description: This function is used to transmit certain CAN message. Function starts to send data which is defined in inputs DATA1...DATA8, when input ENABLE is set TRUE. EXTENDED input defines if message identifier frame is 11bit or extended 29bit. Message is identified with ID input. Library: CAN.LIB Symbol:
Inputs:
Name Data type Data range Description ENABLE BOOL 0, 1 (TRUE/FALSE) TRUE enables function OBJN BYTE 0...14 Object number ID DWORD 11 or 29 bit Message ID EXTENDED BOOL 0, 1 (TRUE/FALSE) If TRUE, message ID is extended 29 bit DLC BYTE 0…8 Data Length Code DATA1 BYTE 0…255 Message Data DATA2 BYTE 0…255 Message Data DATA3 BYTE 0…255 Message Data DATA4 BYTE 0…255 Message Data DATA5 BYTE 0…255 Message Data DATA6 BYTE 0…255 Message Data DATA7 BYTE 0…255 Message Data DATA8 BYTE 0…255 Message Data
Outputs:
Name Data type Description ERROR BOOL Returns >0 if function fails
Epec CAN Module Family
Mini Display Module Programming Manual
18/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
Example:
NOTE! In appendix A is presented an example of CAN library usage.
Epec CAN Module Family
Mini Display Module Programming Manual
19/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
4.2 EEPROM LIBRARY
4.2.1 EEPROM_READ Description: This function is used to read data from EEPROM. The 2-kbyte on-chip EEPROM memory block is located at offset 0 to 2047. Library: EEPROM.LIB Symbol:
Inputs:
Name Data type Data range Description OFFSET WORD 0…2047 Offset within EEPROM to read ADDRESS WORD Valid memory address Destination memory address SIZE BYTE Size of destination data type Byte count to read
Outputs:
Name Data type Data range Description ERROR BYTE 0 = No error
1 = Offset/Size error (Offset + Size > memory size)
Example:
Epec CAN Module Family
Mini Display Module Programming Manual
20/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
4.2.2 EEPROM_WRITE Description: This function is used to write data to EEPROM. The 2-kbyte on-chip EEPROM memory block is located at offset 0 to 2047. Function must be called with Enable = True until Written = Size or Error > 0. NOTE! Write Cycle count max. 100000. Possible EEPROM wearing is indicated by Retry output. Library: EEPROM.LIB Symbol:
Inputs:
Name Data type Data range Description Enable BOOL 0, 1 (TRUE/FALSE) TRUE enables function Offset WORD 16…2047 Offset within EEPROM to write
(0..15 is reserved for runtime) Address WORD Valid memory address Source memory address Size BYTE Size of source data
type Byte count to write
Outputs:
Name Data type Data range Description Error BYTE 0 … 2 0 = No error
1 = Address/Offset error (Offset + Size > memory size) 2 = Write error
Written BYTE 0 … Size Byte count actually written Retry BYTE 0 … 6 0 = Data was same in EEPROM
1 = Data written to EEPROM >1 = Retry in write (max. 5 times)
Epec CAN Module Family
Mini Display Module Programming Manual
21/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
Example:
Epec CAN Module Family
Mini Display Module Programming Manual
22/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
4.3 ANALOG I/O LIBRARY
4.3.1 AI_CONF_FB Description: This function is used to configure analog I/O pin type for those modules where it’s possible. NOTE! Check module data sheet if the configuration is possible. If not, don’t use this library. Library: CONF.LIB Symbol:
Inputs:
Name Data type Data range Description X1_10_17 BYTE 0, 1 Select X1.10 and X1.17 pin type
0 = Current 1 = Voltage
X1_20_21 BYTE 0, 1 Select X1.20 and X1.21 pin type 0 = Current 1 = Voltage
X1_22_23 BYTE 0, 1 Select X1.22 and X1.23 pin type 0 = Current 1 = Voltage
Outputs:
Name Data type Data range Description - - - -
Epec CAN Module Family
Mini Display Module Programming Manual
23/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
Example:
4.4 SERIAL LIBRARY
4.4.1 INIT_COM Description: This function is used to initialize serial communication port. Library: SERINT.LIB Symbol:
Inputs:
Name Data type Data range Description ENABLE BOOL 0, 1 (TRUE/FALSE) TRUE enables function BAUDRATE WORD 0…FFFF Baud rate constant BYTESIZE BYTE 0, 1 Byte size
0 = 7 1 = 8
PARITY BYTE 0, 2 Parity 0 = none 2 = even
STOPBITS BYTE 0 (0 = 1) Stop bits
Epec CAN Module Family
Mini Display Module Programming Manual
24/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
Outputs:
Name Data type Data range Description ERROR BYTE 0 ... 2 0 = No error
1 = Initializing not allowed 2 = Incompatible runtime version
Baud rate bits/s Baud rate constant 110 0xE9CE 300 0xF7DD 600 0xFBEE 1200 0xFDF7 2400 0xFFFC 4800 0xFF7E 9600 0xFFC0 14400 0xFFD5 19200 0xFFDF 38400 0xFFF0 56000 0xFFF5 57600 0xFFF5
Example:
Epec CAN Module Family
Mini Display Module Programming Manual
25/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
4.4.2 WRITE_COM Description: This function is used to transmit serial messages. Library: SERINT.LIB Symbol:
Inputs:
Name Data type Data range Description ENABLE BOOL 0, 1 (TRUE/FALSE) TRUE enables function BUFF WORD Valid memory address Address of buffer NUMBERBYTES BYTE 1… Byte count to write
Outputs:
Name Data type Data range Description BYTESSEND BYTE 0…NUMBERBYTES Actual bytes send ERROR BYTE 0...2 0 = No error
1 = Write not allowed 2 = Incompatible runtime version
Example:
Epec CAN Module Family
Mini Display Module Programming Manual
26/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
4.4.3 READ_COM Description: This function is used to read serial messages. Library: SERINT.LIB Symbol:
Inputs:
Name Data type Data range Description ENABLE BOOL 0, 1 (TRUE/FALSE) TRUE enables function BUFF WORD Valid memory address Address of buffer NUMBEROFBYTES BYTE 1… Number of bytes to receive
Outputs:
Name Data type Data range Description BYTESREAD BYTE 0 … NUMBEROFBYTES Receive count ERROR BYTE 0 … 2 0 = No error
1 = Read not allowed 2 = Incompatible runtime version
Example:
Epec CAN Module Family
Mini Display Module Programming Manual
27/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
4.4.4 CLOSE_COM Description: This function is used to close serial communication port. Library: SERINT.LIB Symbol:
Inputs:
Name Data type Data range Description ENABLE BOOL 0, 1 (TRUE/FALSE) TRUE enables function
Outputs:
Name Data type Data range Description ERROR BYTE 0, 1 0 = No error
1 = Close not allowed
Epec CAN Module Family
Mini Display Module Programming Manual
28/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
4.5 PLCopen Graphics Interface PLCopen application and graphics library communicate through library functions. Graphics library and resource file can be loaded by ETools.
4.5.1 Graphic Function Usage in OpenPLC Application LCD library is included to CoDeSys with Library Manager. After this, eleven function blocks are available.
4.5.2 LCD_DRAWBITMAP Description: Prints image in resource based on image ID. Library: LCD.LIB Symbol:
Inputs:
Name Data type Data range Description X BYTE 0…127 X coordinate Y BYTE 0…63 Y coordinate ID BYTE 0… Image ID number MODE BYTE 0, 1 0 = not reversed, 1 = reversed ENABLE BOOL 0, 1 1 = execute, 0 = do not execute
NOTE! Maximum image id number depends on resource file. Resource file must be loaded.
Epec CAN Module Family
Mini Display Module Programming Manual
29/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
4.5.3 LCD_PRINT Description: Prints string. Library: LCD.LIB Symbol:
Inputs:
Name Data type Data range Description X BYTE 0…127 X coordinate Y BYTE 0…63 Y coordinate FONT BYTE 0 … Font type MODE BYTE 0, 1 0 = not reversed, 1 = reversed STR WORD Valid memory address Pointer to string ENABLE BOOL 0, 1 1 = execute, 0 = do not execute
NOTE! Maximum font type depends on resource file. If resource file not loaded then font type is default (same as type 0, Helvetica 10).
Epec CAN Module Family
Mini Display Module Programming Manual
30/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
4.5.4 LCD_PRINT_UINT Description: Prints 16bit unsigned number. Library: LCD.LIB Symbol:
Inputs:
Name Data type Data range Description X BYTE 0…127 X coordinate Y BYTE 0…63 Y coordinate FONT BYTE 0 … Font type MODE BYTE 0, 1 0 = not reversed, 1 = reversed IN UINT 0…65535 Printed number LENGTH BYTE 1…6 Length of the value area ALIGN BYTE 0, 1 0 = right align, 1 = left align ENABLE BOOL 0, 1 1 = execute, 0 = do not execute
NOTE! Maximum font type depends on resource file. If resource file not loaded then font type is default (same as type 0, Helvetica 10).
Epec CAN Module Family
Mini Display Module Programming Manual
31/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
4.5.5 LCD_PRINT_INT Description: Prints 16bit signed number. Library: LCD.LIB Symbol:
Inputs:
Name Data type Data range Description X BYTE 0…127 X coordinate Y BYTE 0…63 Y coordinate FONT BYTE 0 … Font type MODE BYTE 0, 1 0 = not reversed, 1 = reversed IN INT -32768…+32767 Printed number LENGTH BYTE 2…6 Length of the value area ALIGN BYTE 0, 1 0 = right align, 1 = left align ENABLE BOOL 0, 1 1 = execute, 0 = do not execute
NOTE! Maximum font type depends on resource file. If resource file not loaded then font type is default (same as type 0, Helvetica 10).
Epec CAN Module Family
Mini Display Module Programming Manual
32/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
4.5.6 LCD_RECTANGLE Description: Draws rectangle. Library: LCD.LIB Symbol:
Inputs:
Name Data type Data range Description X1 BYTE 0…127 X coordinate, left up Y1 BYTE 0…63 Y coordinate, left up X2 BYTE 0…127 X coordinate, right down Y2 BYTE 0…63 Y coordinate, right down MODE BYTE 0, 1, 2 0 = not reversed, 1 = reversed, 2 = XOR ENABLE BOOL 0, 1 1 = execute, 0 = do not execute
Epec CAN Module Family
Mini Display Module Programming Manual
33/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
4.5.7 LCD_FILLRECTANGLE Description: Draws filled rectangle. The left up values must be smaller than the right down values. Library: LCD.lib Symbol:
Inputs:
Name Data type Data range Description X1 BYTE 0…127 X coordinate, left up Y1 BYTE 0…63 Y coordinate, left up X2 BYTE 0…127 X coordinate, right down Y2 BYTE 0…63 Y coordinate, right down MODE BYTE 0, 1, 2 0 = not reversed, 1 = reversed, 2 = XOR ENABLE BOOL 0, 1 1 = execute, 0 = do not execute
Epec CAN Module Family
Mini Display Module Programming Manual
34/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
4.5.8 LCD_CLRSCR Description: Clears display. Library: LCD.LIB Symbol:
Inputs:
Name Data type Data range Description ENABLE BOOL 0, 1 1 = execute, 0 = do not execute
Epec CAN Module Family
Mini Display Module Programming Manual
35/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
4.5.9 LCD_INIT Description: Initializes display. Library: LCD.LIB Symbol:
Example:
Epec CAN Module Family
Mini Display Module Programming Manual
36/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
4.5.10 LCD_DRAWBYID Description: Draws object defined in resources. Library: LCD.LIB Symbol:
Inputs:
Name Data type Data range Description ID BYTE 0… Resource ID number ENABLE BOOL 0, 1 1 = execute, 0 = do not execute
NOTE! Maximum resource number depends on resource file. Resource file must be loaded.
Epec CAN Module Family
Mini Display Module Programming Manual
37/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
4.5.11 LCD_SETPIXEL Description: Sets pixel. Library: LCD.LIB Symbol:
Inputs:
Name Data type Data range Description X BYTE 0…127 X coordinate Y BYTE 0…63 Y coordinate ENABLE BOOL 0, 1 1 = execute, 0 = do not execute
Epec CAN Module Family
Mini Display Module Programming Manual
38/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
4.5.12 LCD_CLEARPIXEL Description: Clears pixel. Library: LCD.LIB Symbol:
Inputs:
Name Data type Data range Description X BYTE 0…127 X coordinate Y BYTE 0…63 Y coordinate ENABLE BOOL 0, 1 1 = execute, 0 = do not execute
Epec CAN Module Family
Mini Display Module Programming Manual
39/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
4.5.13 LCD_PUTPIXEL Description Put pixel. Library: LCD.LIB Symbol:
Inputs:
Name Data type Data range Description X BYTE 0…127 X coordinate Y BYTE 0…63 Y coordinate MODE BYTE 0, 1, 2 0 = not reversed, 1 = reversed, 2 = XOR ENABLE BOOL 0, 1 1 = execute, 0 = do not execute
Epec CAN Module Family
Mini Display Module Programming Manual
40/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
4.5.14 LCD_LINE Description: Draws line. Library: LCD.LIB Symbol:
Inputs:
Name Data type Data range Description X1 BYTE 0…127 X coordinate origin Y1 BYTE 0…63 Y coordinate origin X2 BYTE 0…127 X coordinate end point Y2 BYTE 0…63 Y coordinate end point MODE BYTE 0, 1, 2 0 = not reversed, 1 = reversed, 2 = XOR ENABLE BOOL 0, 1 1 = execute, 0 = do not execute
Epec CAN Module Family
Mini Display Module Programming Manual
41/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
4.5.15 LCD_CIRCLE Description: Draws circle. Library: LCD.LIB Symbol:
Inputs:
Name Data type Data range Description X BYTE 0…127 X coordinate origin Y BYTE 0…63 Y coordinate origin RADIUS BYTE 0… Radius MODE BYTE 0, 1, 2 0 = not reversed, 1 = reversed, 2 = XOR ENABLE BOOL 0, 1 1 = execute, 0 = do not execute
Epec CAN Module Family
Mini Display Module Programming Manual
42/4212.9.2006
PM2029.doc
Epec Oy reserves all rights for modifications without prior notice Epec Oy Postiosoite/Postal address Puhelin/Phone Fax Internet Matinkatu 6 PL/P.O.Box 194 +358-(0)6-2170 111 +358-(0)6-2170 110 www.epec.fi FIN-60100 Seinäjoki FIN-60101 Seinäjoki, Finland +358-(0)6-2170 120
4.5.16 LCD_FILLCIRCLE Description: Draws filled circle. Library: LCD.LIB Symbol:
Inputs:
Name Data type Data range Description X BYTE 0…127 X coordinate origin Y BYTE 0…63 Y coordinate origin RADIUS BYTE 0… Radius MODE BYTE 0, 1, 2 0 = not reversed, 1 = reversed, 2 = XOR ENABLE BOOL 0, 1 1 = execute, 0 = do not execute
0001 PROGRAM PLC_PRG0002 VAR0003 start: BOOL:=TRUE;0004 RPDO1_init: CAN_OBJ_RX_INIT;0005 RPDO2_init: CAN_OBJ_RX_INIT;0006 TPDO1_init: CAN_OBJ_TX_INIT;0007 TPDO2_init: CAN_OBJ_TX_INIT;0008 RPDO1: CAN_OBJ_RX;0009 RPDO2: CAN_OBJ_RX;0010 TPDO1: CAN_OBJ_TX;0011 TPDO2: CAN_OBJ_TX;0012 EpecBeat_init: CAN_OBJ_TX_INIT;0013 epecbeat: BOOL;0014 t1: TON;0015 trg: W_TRIG;0016 t2: TON;0017 btrg1: B_TRIG;0018 btrg2: B_TRIG;0019 btrg3: B_TRIG;0020 END_VAR0001
CAN_OBJ_RX_INIT
RPDO1_init
ENABLEOBJNEXTENDEDID_TAGID_MASK
ERRORstart3
FALSE16#18116#7FF
Initializing Receive PDO 1
0002
CAN_OBJ_RX_INIT
RPDO2_init
ENABLEOBJNEXTENDEDID_TAGID_MASK
ERRORstart4
FALSE16#28116#7FF
Initializing Receive PDO 2
0003
CAN_OBJ_TX_INIT
TPDO1_init
ENABLEOBJNEXTENDEDID
ERRORstart5
FALSE16#201
Initializing Transmit PDO 1
0004
CAN_OBJ_TX_INIT
TPDO2_init
ENABLEOBJNEXTENDEDID
ERRORstart6
FALSE16#301
Initializing Transmit PDO 2
0005
startFALSE
Initializing done
0006
CAN_OBJ_TX
TPDO1
ENABLEOBJNDLCDATA1DATA2DATA3DATA4DATA5DATA6DATA7DATA8
ERROR58
%IB0%IB1%IB2
0000
OR
t1.Q
B_TRIG
btrg1
CLK Q%IB0
B_TRIG
btrg2
CLK Q%IB1
B_TRIG
btrg3
CLK Q%IB2
BOOL_TO_BYTEepecbeat
Send Transmit PDO 1
0007
CAN_OBJ_TX
TPDO2
ENABLEOBJNDLCDATA1DATA2DATA3DATA4DATA5DATA6DATA7DATA8
ERROR62
000000
OR
t2.Q
W_TRIG
trg
CLK QAI_X1_22
WORD_TO_BYTEAI_X1_22
WORD_TO_BYTESHRAI_X1_22
8
Send Transmit PDO 2 when AI_X1_22 change or minium once per second
0008
CAN_OBJ_RX
RPDO1
OBJN IDEXTENDED
DLCDATA1DATA2DATA3DATA4DATA5DATA6DATA7DATA8
NEW_DATAERROR
%QB0
3
Read Receive PDO 1
0009
CAN_OBJ_RX
RPDO2
OBJN IDEXTENDED
DLCDATA1DATA2DATA3DATA4DATA5DATA6DATA7DATA8
NEW_DATAERROR
PWM_X1_01PWM_X1_03PWM_X1_04PWM_X1_07PWM_X1_08
4
Read Receive PDO 2
0010
TON
t1
INPT
QET
t1.QT#300ms
0011
epecbeatXOR
t1.Qepecbeat
When time has run out complement "epecbeat" variable
0012
TON
t2
INPT
QET
t2.QT#1s