Home

EzCore API

image

Contents

1. Property Register number Register type Description Button Up gt Mno On 101 M Button click Mno On gt DisableActiveX 201 M Disable enable button Property Register number Register type Description Button Up gt Mno On 102 M Button click Mno On gt DisableActiveX 202 M Disable enable button Property Register number Register type Description Button Up gt Mno On 103 M Button click Mno On gt DisableActiveX 203 M Disable enable button Label 1 MINTTable Property Select MSG AI AO D F D Register MSG AI AO D Fno gt Label 1 Label 2 Interrupt Count Property Select MSG AI AO D F D Register MSG AI AO D Fno gt Label 2 Label 3 Property Select MSG AI AO D F MSG Register MSG AI AO D Fno gt Label 2 Label 4 Property Select MSG AI AO D F MSG Register MSG AI AO D Fno gt Label 1 bg Erre aL SOS ast lal include include BYTE MSlot 1 long ret STEP 1 module Declare a motion interrupt callback function HEO for the i8094A H void INTE MOTION WORD MINTTable STEP 2 Declare a user thread callback function unsigned long USER_RUN7 void BOOL CEZDEMOA_8094A_InterruptDlg OnInitDialog ED ako qi guek ERT e Vy See cie lecon for chile ebiela The framework does this automatically when the application s main window is not a dialo
2. Parameter Range Description MSGno 1 249 MSG register number non volatile UMSG 30 Pointer to a Unicode Unicode character array receiving characters array the text string Return Value Description 0 Execution was successful Nonzero Error consult the error table at the appendix Example continuation of the previous example wchar_t UMSG 30 RET GET _MSGF 0 UMSG CString CS UMSG Determines the system language setting and copies the message with the identifier 0 from the system language text file to the array UMSG If the sytem language is set to English SET_D 8000 0 the message Initialization succeeded will be copied from the MLO txt to the UMSG array 2 3 9 System protection with AES EzCore provides functions which allows the system developer to protect its software from illegal use The functions make use of the Advanced Encryption Standard AES To generate a registration key for the end user the program developer has to specify a random 16 character product key The encryption engine of the EzConfig utility generates a registration key by using the hardware serial number of the PAC and the product key The product key is only known to the system developer and should not be disclosed Product Key only known to the system developer AES encryption machine PAC hardware serial number I Registration Key
3. SET_M 200 true System initial ok SET_RTSR 0 amp pt TSRFunc TSR_RUN 1000 JA Starts the RTSR START_RTSR 0 number 0 triggering at the set time interval Display the following message on Label 2 SIE IMSS il WG AU ege EEE Ole Vp MessageBox TEXT Start ENGINE NG TEXT n Please check TEXT EzCore Engine MB_OK MB_ICONERROR else MessageBox TEXT Load ALL Device Data NG TEXT n Please check n Please Rescan IO RREAN YE zCone Engine MB_OK MB_ICONERROR return TRUE return TRUE unless you set the focus to a Lf Control void CEzZDEMO2_RTSRD1g OnClose TODO Add your message handler code here and or call f f ceraint SCAN_ENGINE_STOP Stop the EzCore scan engine CDialog s0aClose e 3 3 Interrupt service routine ISR The PAC device can be equipped with eight hardware interrupt channels by plugging the I 8048 digital input module into the first slot of the PAC The hardware interrupt has got the highest priority and immediately interrupts the execution of other tasks like for example RTSR or user thread To guarantee a deterministic and real time behavior of the RTSR and to ensure that every interrupt is processed it is absolute necessary to make sure that the execution time of the interrupt function is very short Thus the number of execution commands has to be low and no
4. PAAR A RA a eee Stop Interrupt Main property settings of the EZHMI objects Property Register number Register type Description Button Up gt Mno On 120 M Button click Mno On gt DisableActiveX 130 M Disable enable button Property Register number Register type Description Button Up gt Mno On 121 M Button click Mno On gt DisableActiveX 131 M Disable enable button Label 1 Number of interrupts Property Select MSG AI AO D F D Register MSG AI AO D Fno gt Label 1 Label 2 Time in milliseconds Property Select MSG AI AO D F D Register MSG AI AO D Fno gt Label 10 Label 3 Interrupt setting Property Select MSG AI AO D F MSG Register MSG AI AO D Fno gt Label 1 wauiocuLincls Jazza la Declare a callback function called by the interrupt service routine ISR void INTP_RUNO Declare a callback function for the user thread unsigned long USER_RUN7 void BOOL CEzDEMO5_InterruptDlg OnInitDialog SEa sOnlnmictDialoc I Bet the deem for tale halot The framework does this automatically when the application s main window is not a dialog SetIcon m_hIcon TRUE A Set big ican SetIcon m_hIcon FALSE dd Sert erei dieza CenterWindow GetDesktopWindow center to the hpc screen i LOD OF izke extra aberatza en ize on Mei
5. This function reads the negated digital output data from the digital output Y register Parameter Range Description Local DO 0 to 777 Digital output Y register number base 8 FRNet DO 1000 to 7777 number DOno Note These numbers are octal numbers Octal number are indicated in c with a preceding zero e g 01 02 etc Return Value Description false Current register status ON true Current register status OFF 2 3 1 4 Read digital input bool IN_Xa WORD DIno This function reads digital input data from the digital input X register Parameter Range Description Local DI 0 to 777 Digital input X register number base 8 FRNet DI 1000 to 7777 number DIno Note These numbers are octal numbers Octal number are indicated in c witha preceding zero e g 01 02 etc Return Value Description true Current register status ON false Current register status OFF 2 3 1 5 Read digital input negated bool IN_Xb WORD DIno This function returns the negated digital input data from the digital input X register Parameter Range Description Local DI 0 to 777 Digital input X register number base 8 FRNet DI 1000 to 7777 number DIno Note these numbers are octal numbers Octal number are indicated in c with a preceding zero e g 01 02 etc Return Value Description false C
6. The following registers are already reserved for multi language and virtual keyboard support Register Type Register Number Note D 8000 Multilanguage selection Enabling or disabling virtual keyboard 10000 support for the ColorEdit Control Table 3 Registers reserved for the EzCore 2 Setting the EzCore Engine 2 1 EzCore initialization 2 1 1 Hardware initialization long DEVICE_INITIAL WORD Paral WORD Para2 WORD RunMode This function loads the program reads and writes IO data Parameter Range Description Paral 0 OUTPUT Clear Sets all DO and AO to zero 1 OUTPUT_Now After loading the program the default initial values are written to the DO and AO Para2 0 IO_MODE_Direct DIO and AIO are directly accessed 1 IO_MODE_AutoScan The DIO and AIO are scanned at fixed time intervals RunMode 1 RUN_PRG MODE Run program mode Return Value Description 0 Execution was successful Nonzero Error consult the error table at the appendix Example long ret ret DEVICE_INITIAL OUTPUT_Now 0 RUN_PRG_MODE if ret _NO_ERROR ret SCAN_ENGINE_START if ret _NO_ERROR SET_M 200 true System initial ok else MessageBox TEXT Starting the EzCore engine failed TEXT EzCore Engine MB_OK MB_ICONERROR else MessageBox TEXT Loading device data faile
7. 3 4 2 Enable motion card interrupt long MOTION_ENABLE_INT BYTE Slot The hardware interrupt of the motion card has to be activated before any motion interrupt function can be used This function enables the hardware interrupt of the motion cards in the specified slot Only motion cards in slot 1 slot 2 and slot 3 can be enabled for hardware interrupt Parameter Range Description Slot number Only the first three slots Slot 1 3 support hardware interrupt for motion cards Return Value Description 0 Execution was successful Nonzero Error consult the error table at the appendix Example see chapter 3 4 6 3 4 3 Disable motion card interrupt long MOTION _DISABLE_INT BYTE Slot This function disables the hardware interrupt of the motion cards in the specified slot Parameter Range Description Slot number Only the first three slots Slot 1 3 support hardware interrupt for motion cards Return Value Description 0 Execution was successful Nonzero Error consult the error table at the appendix 3 4 4 Enable motion card interrupt for specific axis long MOTION_START_INT BYTE Slot WORD Axis This function enables the hardware interrupt of a specific axis of the motion card The MOTION_ENABLE_INT function has to be called prior Parameter Range Description Slot number Only the first three slots Slo
8. Label 1 Loop count Property Select MSG AI AO D F D Register MSG AI AO D Fno gt Label 1 Label 2 Time in milliseconds Property Select MSG AI AO D F D Register MSG AI AO D Fno gt Label 10 Label 3 User thread and RTSR status Property Select MSG AI AO D F MSG Register MSG AI AO D Fno gt Label 1 Faumellinels WmsaCeieS gla Function which will be called in the new thread user thread callback function unsigned long USER_RUN void The D register number 1 stores the loop counts Set it to zero GIT EIA ZUe while true Count the number of loops Side EIA ae _ ID aL ar IL e Sleep 500 Bxit the while loop after the Stop User Run button Button 2 has been clicked if GET_Ma 111 break Reset the Stop User Run button Button 2 event flag to indicate that the button event has been processed and to enable the button to create a new event SET_M 111 false Display the following message on Label 3 SLMS E AUE CUS E RUIN EEE REDD ibe the user thread number Or END_USER_THREAD 0 Inform the EzCore engine that the user thread has reached its end geeen Die Click Button 1 to start the user thread Implement an RTSR function RTSR callback functioy void
9. TSR_RUN Display the number of milliseconds on Label 2 SEPID 2 Cet reCkeounEe Iy ie Button has been eizi zizel starei ehernnser ehread if GET _Ma 110 Reset the button Button 1 event flag to indicate that the button event has been processed and to enable the button to create a new event flag Slat Mi LO relse Stace the User Ehread number and call the function USER_RUN in the new thread long RET START_USER_THREAD 0 USER_RUN Display the following message on Label 3 SETEMSC IP TEX USER RUN START GUI Ko BOOL CEzDEMO4_USERD1g OnInitDialog CDialogs 0atrnictcDialoc h y M Set thie eon ror cale bhelocsa masa zerutar Coes cmila automatically when the application s main window is not a dialog SetIcon m_hIcon TRUE fi Set big seein SetIcon m_hIcon FALSE Ser ertz dieza CenterWindow GetDesktopWindow center to the hpc screen ZE OD OF dk exierant Nizan ize EzCore initialization lome reep ret DEVICE_INITIAL OUTPUT_Now IO_MODE_AutoScan RUN PRG MODE if ret _NO_ERROR ret SCAN_ENGINE_START if ret _NO_ERROR SEREM 200P eik deke ekua Eak SET_RTSR 0 amp pt TSRFunc TSR_RUN 1000 START RTSR 0 Starts RTSR thread execution Display the following message on Label 3 SUE IMSS iL WG WY ege E IIS Ole MELD else MessageBox TEXT S
10. following system support three language settings English Spanish Chinese STEP 1 Assign a language index to each language English Language 0 gt MLO txt Spanish Language 1 gt MLI1 txt Chinese Language 2 gt ML2 txt The language switching during runtime is done by choosing the index of the corresponding language STEP 2 Enter the following messages in the three message text files English gt MLO txt 0 Initialization succeeded 1 Login succeeded Spanish gt ML1 txt 0 Inicializacion del xito 1 Login de xito Chinese gt ML2 txt 0 GS OK L RHEA I B MLO txt Notepad OK File Edit Format View Help The MLO txt file contains messages for the first language In this example it is English 0 Initialization succeeded 1 Login succeeded E ML1 txt Notepad Silt File Edit Format View Help The ML1 txt file lists messages 0 Inicializacion del xito p ee enguags c3 1 Login de xito In this example it is Spanish E ML2 txt Notepad DIS File Edit Format View Help The ML2 txt file lists the messages for the 3 language 0 RETA OK 1 In this example it is Chinese LR BEARD STEP 3 Make sure that these files are saved as Unicode text OML E MLO bet i E ML1 bxt My Recent E ML2 bet Documents Desktop My Documents My Computer My Network Places File name MLO tet Save as type Text Docu
11. number Mode INTP_MODE_Rising 1 interrupt triggering mode falling or INTP_MODE_Falling 2 rising edge Slot 1 Only the first slot is supported Return Value Description 0 Execution was successful Nonzero Error consult the error table at the appendix Example see chapter 3 3 5 3 3 3 Disable ISR long STOP_INT BYTE Channel BYTE Slot This function disables the interrupt service routine The current ISR will continue executing its procedure to the end but no new ISR can be called A new interrupt signal from the specified channel will not generate an ISR event Parameter Range Description Channel 0 7 ISR channel number Slot 1 Only the first slot is supported Return Value Description 0 Execution was successful Nonzero Error consult the error table at the appendix Example see chapter 3 3 5 3 3 4 ISR execution time long GET_INT_TIME BYTE Channel BYTE Slot This function determines the ISR execution time of the specified interrupt channel Parameter Range Description Channel 0 7 ISR channel number Slot 1 Only the first slot is supported Return Value Description 0 Execution was successful Nonzero Error consult the error table at the appendix Example see chapter 3 3 5 3 3 5 ISR example EzDEMO5_Interrupt EO DAS CO LTD FABRA RA KA le DAS CO LTD
12. of logical real Description 2 i 8094 F position counter is smaller than that of COMP register P lt C Interrupt occurs once the value of logical real position counter is smaller than that of COMP register P gt C Interrupt occurs once the value of logical real position counter is larger than or equal to that of COMP register C END Interrupt occurs at the end of the constant speed drive or completion of Acceleration Offset Pulse output C STA Interrupt occurs at the start of the constant speed drive or begin of Acceleration Offset Pulse output D END Interrupt occurs when the driving is finished Table 4 Interrupt factors for module i 8092F The 18094F manual chapter 6 5 describes the supported eight interrupt factors The first eight bits of the MINTTab1e parameter indicates the interrupt types Bit dez Description 0 PULSE Interrupt occurs when pulse is up Interrupt occurs once the value of logical real 1 P gt C position counter is larger than or equal to that of COMP register Interrupt occurs once the value of logical real 2 P lt C position counter is smaller than that of COMP register Interrupt occurs once the value of logical real 3 P lt C position counter is smaller than that of COMP register Interrupt occurs once the value of logical real 4 P gt C position counter is larger than
13. or equal to that of COMP register Interrupt occurs at the end of the constant speed 5 C END drive or completion of Acceleration Offset Pulse output 6 C STA Interrupt occurs at the start of the constant speed drive or begin of Acceleration Offset Pulse output T D END Interrupt occurs when the driving is finished Table 5 Interrupt factors for module i 8094F i 8094A H The 18094H manual chapter 6 3 7 describes the supported eight interrupt factors The first eight bits of the MINTTab1e parameter indicates the interrupt types Bit Description 0 0x01 Line Scan finished 1 0x02 Macro Program finished 2 0x04 User defined interrupt RINT finished being interrupted when execute a continuous SEE interpolation 4 0x10 5 0x20 Reserved 6 0x40 Axes Error 7 0x80 Module Error Table 6 Interrupt factors for module i 8094A H Example MOTION_ENABLE_INT MSlot MOTION_SET_ ZO rrera Dee tumecietotn void INTP_MOTION WORD MINTTable INT MSlot AXIS_X amp ptM_ INTPFunc INTP_MOTION switch MINTTable case 002 nn ET_D 1 MI EEE Ere BEE 2 srl n ET_MSG 2 break case 0x04 S S SETT MSG 2 b default ET _D 1 MI ERE D2 ET D 2 NTTable IKO TEXT Macro Program Maxey OY Fini SASAE NTTable 1 Tay IRA INGE finished TE
14. the time register before the timer can be started again Parameter Range Description Tno 1 299 Timer T register number true Starts the timer Flag E false Stops the timer ms 1 4 294 967 295 ms count down time milliseconds Kd a d Current timer value DWORD GET _T BYTE Tno This function reads the remaining count down time in milliseconds Parameter Range Description Tno 1 299 Timer T register number Return Value Description 1 aa 4 294 967 295 timer count down value milliseconds 2 3 2 3 Timer status bool GET TR BYTE Tno This function checks whether the timer is active or switched off Parameter Range Description Tno 1 299 Timer T register number Return Value Description true Current timer status ON false Current timer status OFF 2 3 2 4 Negated timer status bool GET TR BYTE Tno This function checks whether the timer is active or switched off and returns the negated result Parameter Range Description Tno 1 299 Timer T register number Return Value Description true Current timer status OFF false Current timer status ON 2 3 3 Counter 2 3 3 1 Set counter void SET_C WOR D Cno bool Flag DWORD COUNT This function starts the count down or continues to count down The counter stops once it h
15. CAT OMG UG 5 as coccade dataset tonntdeey hen saaebeeesteyatestuoalinasaaedated meopngesdadabapnanens 8 2 3 USETE aA EEE 10 2 3 1 Digital and analog register AAA 10 dd Eka EEaren 15 2 3 3 EO gane a E a S EE i t EESE 17 2 3 4 SSCP adaki ateta a EEE E 20 230 Software M AAA 22 2 3 6 Register for standard data types x 2 2 4 3 s9ssgecspceasctesaede haoedotagovaeartee cadences 24 Seg Bit manipulation in the DB GOIE 30 2 3 8 Text message OA EG AA Ku Ea 35 2 3 9 System protection with AES a EE darea 42 EzCore application programming a e a aa a aa 45 3 1 User thread EAE 45 3 1 1 Execution of a user defined threads AA 45 3 1 2 Closing flag a user defined thread AEA 46 SE Hidalga Bea A 48 3 2 Real time service routine UK ISE aa 52 3 2 1 BOEN Oka ak katak Eat 52 3 2 2 Epable R EAEE 53 3 2 3 Disable Ta Ea AAO 54 3 2 4 RTSR ex cution tme eiiean e ap E EEEE SY 54 325 UA KS a eu AAE 55 3 3 Interr ptservic ro tme Ski aA 58 3 3 1 UKB OROREN 58 3 3 2 Epable KEA 59 3 3 3 Disable KE 59 3 3 4 ISR EO DOE a 60 3 3 5 ISR eau UNEA 61 SA Moton AINGEMUPE AAE 66 3 4 1 Motion card ISR initialization rrua 66 3 4 2 Enable motion card blue a 69 3 4 3 Disable motion card interrupt rra 70 3 4 4 Enable motion card interrupt for specific GRIS 70 3 4 5 Disable motion card interrupt for specific GRIS 71 3 4 6 Motion ISR EUD agata EE 12 Sag aN 79 4 1 USS 79 1 Introduction 1 1 EzCore API The EzProg I framework is running on the EzCore platform The relationshi
16. Description 1 6999 M flag register number volatile 8192 15999 M flag register number non volatile Mno 16000 Reserved for enabling and disabling the virtual keyboard of the EZHMI ColorEdit objects true ON GE false OFF 2 3 5 2 Read M flag status bool GET_Ma WORD Mno This function reads the status of an M flag register Parameter Range Description 1 6999 M flag register number volatile 8192 15999 M flag register number non volatile Mno 16000 Reserved for enabling and disabling the virtual keyboard of the EZHMI ColorEdit objects Return Value Description true Current M flag status ON false Current M flag status OFF 2 3 5 3 Read negated M flag status bool GET_Mb WORD Mno This function returns the negated status of an M flag register Parameter Range Description 1 6999 M flag register number volatile 8192 15999 M flag register number non volatile Mno 16000 Reserved for enabling and disabling the virtual keyboard of the EZHMI ColorEdit objects Return Value Description false Current M flag status ON true Current M flag status OFF 2 3 6 Register for standard data types 2 3 6 1 D register type long integer Each D register consists of four bytes and stores values in the range from 2 147 483 648 to 2 147 483 647 2 3 6 1 1 Write D register void SET
17. E DBno BYTE Shift This function shifts the bits of a DB register a specified number of positions to the right E 3 6 S04 3 2 8 Parameter Range Description DBno 1 49 DB register number Shift 1 128 The number of position to shift to the right 2 3 8 Text message register MSG The text message register can be accessed via EZHMI objects or by using the EzCore functions described in this chapter 2 3 8 1 Write MSG register long SET_MSG WORD MSGno wchar_t UMSG 30 This function assigns a text string to a MSG register Parameter Range Description 1 244 MSG register number non volatile MSGno 245 249 MSG register number non volatile reserved for passwords UMSG 30 Pointer to a Unicode Unicode character array storing the characters array Message Return Value Description 0 Execution was successful Nonzero Error consult the error table at the appendix Example RET SET_MSG 100 1 Write a UNICODE character string to MSG register number 100 TCPDAS Into 2 or use a CStringW CStringW CS LIT GE wchar_t UMSG 30 DAS Into Copy the CStringW message to the UMSG array Sswprintf UMSG CS UMSG RET SET_MSG 101 CEZLIB EzLIB wchar_t tcTime 15 3 Add a time label to the message 10 20 55 ICPDAS Info EzLIB Get_Time tcTime CStringW
18. EzCore API User Manual Version 4 3 EzProag C KO ICP DAS CO LTD Warranty All products manufactured by ICPDAS Inc are warranted against defective materials for a period of one year from the date of delivery to the original purchaser Warning ICPDAS Inc assumes no liability for damages consequent to the use of this product ICPDAS Inc reserves the right to change this manual at any time without notice The information furnished by ICPDAS Inc is believed to be accurate and reliable However no responsibility is assumed by ICPDAS Inc for its use or for any infringements of patents or other rights of third parties resulting from its use Copyright Copyright 1997 2009 by ICPDAS Inc LTD All rights reserved worldwide Trademark The names used for identification only maybe registered trademarks of their respective companies License The user can use modify and backup this software on a single machine The user may not reproduce transfer or distribute this software or any copy in whole or in part Technical Support If you have problems about using the product please contact ICP DAS Product Support Email Service icpdas com EzCore API 1 2 Fit CUCULON AAA 4 1 1 EZ Core MAREA 4 Setune the SEARA Enoe AAO 7 Dak JESARRI Ea AAA 7 2 1 1 Hardware Am LLALTZ ALL OM arata ar A chase aate Ee 7 2 2 LOTE Engine Start and Stops iiss gaa aika atata ter 8 22 1 Start SCAT engine kaietan ereitera 8 222 Stop S
19. HMSm tcTime CStringW CS L ICPDAS Info CS HMSm CS wchar_t UMSG 30 swprintf UMSG CS ret SET_MSG 102 UMSG 4 Add a date tag to the message 2007 04 26 ICPDAS Info wchar_t tcDate 15 EzLIB Get_Date tcDate CStringW YMD tcDate CStringW CS1 L ICPDAS Info CS1 YMD CS1 wchar_t UMSG1 30 swprintf UMSG1 CS1 ret SET_MSG 103 UMSG1 5 Add a date and time tag to the message 2007 04 26 10 20 55 ICPDAS Info wchar_t tcDT 30 EzLIB Get_DT tcDT true true false true true true true CStringW YMWDHMSm tcDT CStringW CS2 L LCPDAS Into CS2 YMWDHMSm CS2 wchar_t UMSG2 30 swprintf UMSG2 CS2 ret SET_MSG 104 UMSG2 2 3 8 2 Read MSG register long GET_MSG WORD MSGno wchar_t UMSG 30 This function reads the message stored in the MSG register and writes it to a Unicode character array Parameter Range Description DWno 1 4095 DW register number volatile 4096 8191 DW register number non volatile Parameter Range Description MSGno 1 244 MSG register number non volatile 245 249 MSG register number non volatile reserved for passwords UMSG 30 Pointer to a Unicode Unicode character array receiving the text characters array string Return Value Description 0 Execution was successful N
20. XYZU 0 Set the speed of all axis to 2000 PPS i8094H_SET_V MSlot AXIS_XYZU 2000 Set the accelleration of all axis to 1000 PPS sec 18094H SET A MSlot AXIS_XYZU 3000 Set the starting velocity to 2000PPS i8094H_SET_SV MSlot AXIS_XYZU 1000 Set the remaining offset pulses to 0 i8094H_SET_AO MSlot AXIS_XYZU 0 Hf Ceulil imetexcte MEDOM i8094H_ MP CALL MSlot MP50 M SBOE OE macro UMERI 18094H_MP_CLOSE MSlot dt ZG Download the macro MP50 to the i8094H motion module Sissi Om izera m st 18094H_MP_ CREATE MSlot MP50 i8094H MP_SET_VAR MSlot VARI 0 VAR1 0 Move all axis 5000 pulses i8094H_FIXED_MOVE MSlot AXIS_XYZU 5000 18094H MP _STOP_WAIT MSlot AXIS_XYZU ff Wael Cie gotan IMS S50 s 18094H_MP_CLOSE MSlot GO SET_M 200 true disable Button 0 sar M 201 false 7 eneole EURIE Zek 2 SET_M 202 true disable Button 2 SET_M 203 false enable Button 3 SEEMS Gi eg Ui in tee teta Upe Se ite EAEaren ORERE ZZEE Button 1 has been clicked if GET_Ma 101 SE GET_Ma 200 SEREM ONOI kra lse SET M 201 true disable Button 1 SHIM 2020 r an e eneble Button 2 Active all interrupt for the x axis MOTION START _INT MSlot AXIS_X SETEMSC il TEXT Onte rr rupt rteak tl IS If Butt
21. _D WORD Dno long Val This function assigns a value to the D register Parameter Range Description 1 1023 D register number volatile Dno 1024 1999 D register number non volatile 8000 Reserved for multi language setting 8100 FRAM W R ERROR Val 2 147 483 648 to 2 147 483 647 2 3 6 1 2 Read D register long GET D WORD DNo This function returns the value stored in the D register Parameter Range Description 1 1023 D register number volatile Dno 1024 1999 D register number non volatile 8000 Reserved for multi language setting 8100 FRAM W R ERROR Return Value Description 2 147 483 648 D register value to 2 147 483 647 2 3 6 2 B register type unsigned char The B register has a size of one byte and stores positive values in the range from 0 to 255 2 3 6 2 1 Write B register void SET_B WORD Bno BYTE data This function assigns a value to the B register Parameter Range Description Sac 1 699 B register number volatile 1024 2047 B register number non volatile data 0 to 255 2 3 6 2 2 Read B register BYTE GET_B WORD Bno This function returns the value stored in the B register Parameter Range Description Bno 1 699 B register number volatile 1024 2047 B register number non volatile Return V
22. alue 2 3 7 6 Read an array of 16 bits WORD WORD DB _GETx16 BYTE DBno BYTE Num This function reads two bytes from the specified position of the DB register Parameter Range Description DBno 1 49 DB register number Num 0 7 WORD position Return Value Description 0 65 535 WORD value E ete Set an array of 32 bits DWORD void DB SETx32 BYTE DBno BYTE Num DWORD data This function writes four bytes at the specified position of the DB register Parameter Range Description DBno 1 49 DB register number Num 0 3 DWORD position data 0 4 294 967 295 DWORD value 2 3 7 8 Read an array of 32 bits DWORD DWORD DB_GETx32 BYTE DBno BYTE Num This function reads four bytes from the specified position of the DB register Parameter Range Description DBno 1 49 DB register number Num 0 3 DWORD position Return Value Description 0 4 294 967 295 DWORD value 2 3 19 Logical left shift void DB_SL BYTE DBno BYTE Shift This function shifts the bits of a DB register a specified number of positions to the left E A 7 65 dd 3 2 1 0 ARAK SR GK AIK AK GR MAL e Parameter Range Description DBno 1 49 DB register number Shift 1 128 The number of positions to shift to the left 2 3 7 10 Logical right shift void DB_SR BYT
23. alue Description 0 to 255 B register value 2 3 6 3 W register type unsigned short The W register has a size of two bytes and stores positive values in the range from 0 to 65535 2 3 6 3 1 Write W register void SET _W WORD Wno WORD data This function assigns a positive value to the W register Parameter Range Description Wno 1 1023 W register number volatile 1024 1999 W register number non volatile data 0 to 65535 2 3 6 3 2 Read W register WORD GET _W WORD Wno This function returns the value stored in the W register Parameter Range Description Wno 1 1023 W register number volatile 1024 1999 W register number non volatile Return Value Description 0 to 65535 W register value 2 3 6 4 DW register type unsigned long The DW register has a size of four bytes and stores positive values in the range from 0 to 4 294 967 295 2 3 6 4 1 Write DW register void SET D WORD DWno DWORD data This function assigns a positive value to the DW register Parameter Range Description DWno 1 4095 DW register number volatile 4096 8191 DW register number non volatile data 0 to 4 294 967 295 2 3 6 4 2 Read DW register DWORD GET _DW WORD DWno This function returns the value stored in the DW register Parameter R
24. ange Description DWno 1 4095 DW register number volatile 4096 8191 DW register number non volatile Return Value Description 0 to E 4 294 967 295 DW register value 2 3 6 5 F register type float The F register type has a size of four bytes and stores float values in the range of 3 4E 38 2 3 6 5 1 Write F register void SET _F WORD Fno float data This function assigns a float value to an F register Parameter Range Description Fn 1 1899 F register number volatile 2048 3999 F register number non volatile data 3 4E 38 2 3 6 5 2 Read F register float GET_F WORD Fno This function returns the float value stored in an F register Parameter Range Description Fn 1 1899 F register number volatile 2048 3999 F register number non volatile Return Value Description 3 4E 38 F register value 2 3 7 Bit manipulation in the DB register The DB register type has a size of 16 bytes 128 bits EzCore provides several functions to access or manipulate specific bits in the register ar bes 425 424f123 122 424 420 119 n18 a17 baskoa bua bu 410 109 108 107 406 105 104 103 102404 100 99 Tos 97 96 4 0 BYTE 13 MORO WORD 6 DWORD BYTE 12 2 3 7 1 Set a single bit void DB SETx1 BYTE DBno BYTE Num bool data This function sets one bit at
25. arameter Range Description RTSRno 0 7 RTSR thread to start Return Value Description 0 Execution was successful Nonzero Error consult the error table at the appendix Example see chapter 3 2 5 3 2 3 Disable RTSR void STOP_RTSR BYTE RTSRno This function stops the triggering the RTSR event at fixed time intervals The current RTSR task will continue executing its code until it returns but the RTSR task will not be called again Parameter Range Description RTSRno 0 7 RTSR thread to stop Example see chapter 3 2 5 3 2 4 RTSR execution time long GET_RTSR_TIME BYTE RTSRno This function returns the execution of the specified RTSR Parameter Range Description RTSRno 0 7 RTSR thread number Return Value Description Execution time in milliseconds Example see chapter 3 2 5 3 2 5 RTSR example EzDEMO2_RTSR OK ers ICP DAS CO LTD BAAS FL AR ARAYA IR 2 3 A jaz A start RTSR OK Main property settings of the EZHMI projects Property Register number Register type Description Button Up gt Mno On 100 M Button click Label 1 Time in milliseconds Property Select MSG AI AO D F D Register MSG AI AO D Fno gt Label 1 Label 2 RTSR status Property Select MSG AI AO D F MSG Register MSG AI AO D Fno gt Labe
26. as reached zero In this case the RESET_C WORD Cno function has to be called to prepare the counter for the next count down Parameter Range Description Cno None retain 1 511 Counter C register number volatile Retain 512 1023 Counter C register number non volatile Flag true Start the counter false Stop the counter COUNT 1 4 294 967 295 Number from which to start the count down 2 3 3 2 Reset counter void RESET_C WOR D Cno This function resets the counter so that it can be used for the next count down procedure Parameter Range Description Co 1 511 Counter C register number volatile 512 1023 Counter C register number non volatile deka Current counter value bool GET _Ca WORD Cno B This function reads the current count down value Parameter Range Description Gas 1 511 Counter C register number volatile 512 1023 Counter C register number non volatile Return Value Description UEa Za 4 294 967 295 Count down value milliseconds 2 3 3 4 Counter status bool GET _Ca WORD Cno This function checks whether the counter is enabled or disabled Parameter Range Description Gas 1 511 Counter C register number volatile 512 1023 Counter C register number non volatile Return Value Description true Current counter status ON
27. d TEXT n Use EzConfig utility to rescan the slot modules TEXT EzCore Engine MB_OK MB_ICONERROR 2 2 EzCore Engine Start and Stop 2 2 1 Start scan engine long SCAN_ENGINE_START This function starts the scanning process Return Value Description 0 Execution was successful Nonzero Error consult the error table at the appendix Example See chapter 2 1 1 2 2 2 Stop scan engine long SCAN_ENGINE_STOP This function stops the EzCore scan engine Return Value Description 0 Execution was successful Nonzero Error consult the error table at the appendix Example See chapter 2 1 1 2 3 IO and Register APIs EzCore provides basically three kinds of registers types Registers which are directly mapped to I O ports with the EzConfig utility These register stores data of their corresponding I O channels Every millisecond the input registers are updated with data of the corresponding digital and analog input channels and in the same cycle data stored in the output register are written to the output channels Counter timer and step register Register representing c language data types e g bit Byte integer etc They can be accessed by every thread and function The EZHMI objects make extensive use of these registers 2 3 1 Digital and analog register Before calling an EzCore fu
28. d procedure to start the EzCore engine is as follows long ret ret DEVICE_INITIAL OUTPUT_Now IO_MODE_AutoScan RUN_PRG_MODE if ret _NO_ERROR EzCore initialization was successful ret SCAN ENGINE START if ret _NO_ERROR Scan engine start was successful Scan engine start FAILED else EzCore initialization ERROR 3 2 1 RTSR initialization void SET_RTSR BYTE RTSRno ptTSRFunc SRF WORI D msInterval This function opens an RTSR thread with a specific priority sets the triggering time interval and determines the function to be executed in the RTSR Parameter Range Description RTSRno 0 7 This parameter identifies the RTSR and specifies its priority It is not allowed to run two RTSR with the same number priority at the same time O highest priority 7 lowest priority SRS Pointer to the Name of the function to be called in the CALLBACK function RTSR Note The prototype of the CALLBACK function looks like this VOdERTSRIOF The callback function has got no parameter and a void return type The callback function may have any name msInterval 2 60000 milliseconds RTSR cycle interval calling interval of the RTSR Example see chapter 3 1 3 3 2 2 Enable RTS R long START_RTSR BYTE RTSRno This function starts triggering the event of the specified RTSR at fixed time intervals P
29. false Current counter status OFF dedika Negated counter status bool GET_Cb WORD Cno This function checks whether the counter is enabled or disabled and returns the negated result Parameter Range Description Cno 1 511 Counter C register number volatile 512 1023 Counter C register number non volatile Return Value Description true Current counter status OFF false Current counter status ON 2 3 4 Step 2 3 4 1 Set Step void SET_S WORD Sno This function sets the flag of the Step register to true ON Parameter Range Description Sno 1 8191 Step S register number 2 3 4 2 Reset Step void RST_S WORD Sno This function sets the flag of the Step register to false OFF Parameter Range Description Sno 1 8191 Step S register number 2 3 4 3 Read Step flag status bool GET_S WORD Sno This function reads the current flag status of the Step register Parameter Range Description Sno 1 8191 Step S register number Return Value Description true Current Step flag ON false Current Step flag OFF 2 3 5 Software M flag functions d Set M flag value void SET_M WORD Mno bool Flag This function sets the flag of an M register to true or false Parameter Range
30. for the end customer 2 3 9 1 Read registration key long REGISTRY_KEY wchar_t REG 20 This function reads the registration key entered by the user for example via an EzHMI ColorEdit box Parameter Range Description 1 pointer to an Unicode 16 character registration key provided by the character array which program distributor contains a 16 character REG 20 registration key EzConfig Edit Encrypt gt Registry codeGenerator 2 L MSGO The register name and number which L MSGI contains the registration key string L MSG249 For example 1 If the registration key is stored in the MSG register number 1 then the following string has to be used as parameter L MSGI1 Return Value Description 0 Execution was successful Nonzero Error consult the error table at the appendix Example REGISTRY_KEY L 05386f8e9a7b6fa7 REGISTRY_KEY L MSG249 2 3 9 2 Read registration key from AES text file long REGISTRY_FILE This function reads the registration key from the AES txt file located at the following PAC directory for WinCon CompactFlash EzProg I EzConfig for MPac System_Disk EzProg NEzConfig Return Value Description 0 Execution was successful Nonzero Error consult the error table at the appendix Example REGISTRY _FILE 2 3 9 3 Registration ke
31. g SetIcon m_hIcon TRUE fi Set big igon SetIcon m_hIcon FALSE eert ertz icon CenterWindow GetDesktopWindow center to the hpc screen GE TODOR Add exera imiti l izae Oni Dere long ret BzCore initialization ret DEVICE_INITIAL OUTPUT_Now IO MODE _AutoScan RUN_PRG MODE if ret _NO_ERROR ret SCAN_ENGINE_START if ret _NO_ERROR ERIEN true System initial ok Moisanen NBU TEON OA EO ret MOTION_ ENABLE _INT MSlot ret MOTION_SET_INT MSlot AXIS_x amp PtM_INTPFunc INTP_MOTION if ret 0 SET_M 200 false enable Button 0 SEMEN OIMECUS eisalole Bueicom 17 BODA e true e ai digi ereite EGUES ES 27 SET_M 203 true disable Button 3 else SET_M 200 true disable Button 0 SETEM 201m erue disable Meuieieoim i SET_M 202 true disabl Kee ERE ESE 24 Sigil IM 2ZO03 termes s calseisl SENEN Se Start executing the user thread number 7 long RET START_USER_THREAD 7 USER_RUN7 d BUE RESA DEE A eize E SIE OT iz UEN e SET_MSG 2 TEST UI GARE else MessageBox TEXT Start ENGINE NG Wace UT ai Rase elusele AI TEXT EzCore Engine MB_OK MB_ICONERROR else MessageBox TEXT Load ALL Device Data NG TEXT n Please check n Please Rescan TEXT EzCore Engine TO IIa MB_OK MB_ICONERROR mee ibheig INO F Control return TRUE u
32. ine SYSTEM_VERSION_ERROR define DEVICE CHECK ERROR define DEVICE NOT_INIT define DEVICE _NOT_WinCon define AES REGCODE_LENTH_ERROR define AES REGMSG_NO_ERROR File is not open define _FILE_NOT_OPEN Read from file error define READ FILE ERROR Write to file error define _WRITE_FILE_ERROR define _ETHERNET_CONNECTION_ERROR define ALREADY _RUN_WARNING define BATTERY1 LEVEL_WARNING define BATTERY2_LEVEL_WARNING for 18094H A define _I8094H_TIMEOUT_ERROR for 18092 F 18094 F 18094H A define MOTION_NO_REG_ERROR for 18094 F define MOTION_OPENCONFIG_ERROR for 18092 F i8094 F 18094H A define NON _MOTION_ERROR define MOTION_INTP_ALREADY_RUN define SYSTEM_NOT_READY 200 201 202 203 250 251 300 310 320 10 21 22 50 51 52 53 54 100
33. l 1 Hne lude Uger JU Callback function RTSR callback function ss running in the RTSR void TSR_RUN thread Display the number of milliseconds on Labell Sint Dy CL Geir igen GUN I Button 1 has been clicked stop the RTSR if GET_Ma 100 Stops the triggering of STOP_RTSR 0 the RTSR event Reset the button Button 1 event flag dde gien Sg itehicie mele Dutton eventi has been processed and to enable the button to create a new event flag SET_M 100 false Display the following message on Label 2 Slat MISE il War URIS IR SAO EHUK Ue BOOL CEzDEMO2_RTSRD1g OnInitDialog CDialogs s OmlaicDialoc h p Ml See cas leon cor cole dialog Mis frameworks Coes cals automatically when the application s main window is not a dialog SetIcon m_hIcon TRUE RES SetIcon m_hIcon FALSE I Ser amall icon CenterWindow GetDesktopWindow center to the hpc screen TODO Ada extra aberatz abei aiez aze here EzCore initialization long ret ret DEVICE_INITIAL OUTPUT_Now IO_MODE_AutoScan RUN_PRG MODE if ret _NO_ERROR Creates a RTSR thread with the highest RTSR priority 0 and sets the scan time to 1000 milliseconds The TSR_RUN function will be called within the RTSR thread ret SCAN_ENGINE_START if ret _NO_ERROR
34. lag SET_M 130 true disable Button 1 131 false enable Button 2 Initialize the ISR of channel 0 and assign the callback function INTP_RUNO to the ISR RET SET_INT 0 amp pt TSRFunc INTP_RUNO Enable the ISR RET START_INT 0 INTP_MODE_Rising Display the following text on Label 3 SET_MSG 1 TEXT Interrupt Enable If Button 2 has been clicked disable the interrupt if GET_Ma 121 SEDEM Gin e deiez reset OE Eee i ei diek fella BOUEN GIRS HIP erue elizegi EGUES GEO SET_M 130 false enable Button 2 Disable the ISR RET STOP_INT 0 Display the following text on Label 3 SHAMS GiGi TEXN AEren pts Eiz ziba HEU Sleep 999 SETOM GOOM Eea iSe Display the following text on Label 3 EAE RE UN e IEC USI FRUNS TORR SET D 1 0 Inform the EzCore that the user thread execution has finished END_USER_THREAD 7 return 0 default void CEzZDEMO5_InterruptDlg OnClose TODO Add your message handler code her SCAN_ENGINE_STOP Cpa leo m ONCOS ENE and or call 3 4 Motion interrupt EzProg I supports hardware interrupt from the following motion control modules 18092F 18094 i8094F 18094A i8094H The APIs provided for setting and controlling these motion modules are described in detail in their manuals Only m
35. large loops or sleep commands are allowed inside an interrupt function 3 3 1 ISR initialization long SET_INT BYTE Channel ptTSRFunc SRF BYTE Slot This function assigns a function to a specific interrupt service routine ISR In case of an interrupt this ISR executes the assigned function Parameter Range Description Channel The 1 8048 module provides 8 interrupt channels These interrupt channels have different priorities The first channels 0 has the highest followed by channel 1 and so forth O e channel 0 highest interrupt priority 7 channel 7 lowest interrupt priority SRF Pointer to the CALLBACK function Name of the function to be called in the ISR Note The prototype of the CALLBACK function looks like this void INTP_RUN The callback function has got no parameter and a void return type The callback function may have any name Slot Only the first slot of the PAC is supported Return Value Description 0 Execution was successful Nonzero Error consult the error table at the appendix Example see chapter 3 3 5 3 3 2 Enable ISR long START_INT BYTE Channel BYTE Mode BYTE Slot This function assigns a function to a specific interrupt service routine ISR In case of an interrupt this ISR executes the assigned function Parameter Range Description Channel 0 7 channel
36. me of the function to be called in case CALLBACK function of an interrupt Note The CALLBACK function must be of the following prototype int INTP_MOTION WORD MINTTable It must have one WoRD parameter and an int return type Return Value Description 0 Execution was successful Nonzero Error consult the error table at the appendix Example see chapter 3 4 6 3 4 1 1 ISR callback function typedef int ptM_INTPFunc WORD MINTTable The function pointer is declared in the EzCore header file and points to a function which takes only one WORD and returns an integer Thus the callback function must have the same number of parameter parameter type and return type The callback function parameter MINTTab1e contains the interrupt factor Each interrupt factor is represented by a specified bit position in the WORD parameter When an interrupt happens the bit representing the interrupt factor becomes 1 The following describes the interrupt factors supported by the motion cards of ICPDAS 1 i 8092F i 8092 The 18092F manual chapter 6 4 describes the supported eight interrupt factors The first eight bits of the MINTTab1le parameter indicates the interrupt types Interrupt SO factors 0 Interrupt occurs once the value of the logical real 1 P gt C position counter is larger than or equal to that of COMP register 2 P lt C Interrupt occurs once the value
37. ments i PO Encoding STEP 4 Download these text files to the following directory on the PAC for WinCon CompactFlash EzProg I EZHMI ML for MPac System_Disk EzProg EZHMI ML 2 3 8 3 1 Copy message from a multi language text file toa MSG register long SET_MSGF WORD MSGno WORD MSGFno This function reads the message from the message text file and copies it to a MSG register Parameter Range Description MSGno 1 249 MSG register number non volatile MSGFno 0 999 Message identifier in the message text file Return Value Description 0 Execution was successful Nonzero Error consult the error table at the appendix Example continuation of the previous example RET SET_MSGF 100 0 and the Determines the system language setting copies the messag from the system language text file to the MSG register number 100 I the sytem language is set to English ZZ SET_D 8000 0 7 message Initialization succeeded will be copied from the MLO txt to the MSG register number 100 with the identifier 0 2 3 8 3 2 Copy message from a multi language text file to an array long GET_MSGF WORD MSGFno wchar_t UMSG 30 This function reads the message from the message text file and copies it to a Unicode character array
38. nctions it is necessary to map each individual digital and analog channel to a register by using the EzConfig utility The EzConfig utility automatically detects all the modules in the PAC device and assigns each channel to a register number of the corresponding register type The programmer can access these register by calling the API for this register type together with the register number see Table 2 2 3 1 1 Writing digital output void OUT_Y WORD DOno bool Flag This function writes digital output data to the digital output Y register Parameter Range Description Local DO 0 to 777 Digital output Y register number base 8 FRNet DO 1000 to 7777 number DOno Note These numbers are octal numbers Octal number are indicated in c with a preceding zero e g 01 02 etc Flag true ON or OFF false 2 3 1 2 Read digital output bool GET_Ya WORD DOno This function reads digital output data from the digital output Y register Parameter Range Description Local DO 0 to 777 Digital output Y register number base 8 FRNet DO 1000 to 7777 number DOno Note These numbers are octal numbers Octal number are indicated in c witha preceding zero e g 01 02 etc Return Value Description true Current register status ON false Current register status OFF 2 31 3 Read digital output negated bool GET_Yb WORD DOno
39. nless you set the focus to a motion interrupt callback function implementation i8094A H void INTP_MOTION WORD MINTTable switch MINTTable Check whether the macro program has finished Case 2 iezaguk bile Sem See Egiz EO SET_D 1 MINTTable Ship 2 Chl pio 1 SEEMS CIC US Eee Eeen aeta JAIO break Check whether the user defined interrupt RINT has finished case Gs ariete DIE erez SET_D 1 MINTTable Shieh Chien aly SET_MSG 2 TEXT RINT break default break see Table 6 diezte UM hs user thread callback function unsigned long USER_RUN7 void alone LP long RET SET D 1 0 while true T Button 0 has been clicked and the initialization of the EzCore scan engine was succesful if GET_Ma 100 amp amp GET_Mb 200 SEM relse d diez thae UE Uitte Onm QY Gyvent Uf Dovnload the macro MP4 to the 18094 ale deia GE SO Clee giei eien rl ez A dE eee QE amacro VMBI Wg i8094H_MP_CREATE MSlot MP41 Set the logical position of all axis to zero 18094H_SET_LP MSlot AXIS_XYZU 0 The force the motion card to send an interrupt see table 3 Bit number 2 18094H_MP_SET_RINT MSlot set the maximum velocity to 20000 PPS i8094H_ SET MAX V MSlot AXIS_XYZU 20000 Meer alil Torr eede co evine cie Ee EE ae TO 0OAHINORMATTSPEED MS Kot AXIS_
40. on 2 has been clicked if GET_Ma 102 amp amp GET Ma 200 SET_M 102 false SET_M 202 true disable Button 2 SET_M 201 false enable Button 1 Deactive all interrupt for the x axis MOTION STOP_INT MSlot AXIS_X IEE IMSG il Lae ince Seo fl a Te Buttons hes been eitzie if GET_Ma 103 USE INDA GO Sr relase y Execute the downloaded macro MP41 i8094H MP CALL MSlot MP41 Sleep 99 EIE MCL a deiez a IND_USER_THREAD 7 Tt JMISIE a TEIN CHIUISNIRY TRUN Syrowey AD Ue LD EES GO GO E DO be EI ZO FaN Die 4 Appendix 4 1 Error table define NO ERROR define EXEC ERROR define _OPENFILE_ERROR define _SETUP_ERROR define FRAM_INIT_ERROR define REGISTER ERROR define INNONE_MAOS_ERROR define _INCORECT_RUN_MODE define _DIVIDE_ZERO_ERROR define _SET_Interrupt_ERROR define 18048 _ERROR_NO_MODULE define 18048_ERROR_OPEN_DEVICE define 18048 ERROR_INVALID_PARAMETER define 18048 ERROK INN ALD HANDLE define 18048 ERROR_CALL_IOCTL define 18048 ERROK GEI ISI ENEN define IN USE ERROK define NO USE ERROK define OUT_OF_RANGE_ERROR define AES NOT SEIREN ERROR define AES CHECK ERROR define CREATE_THREAD_ERROR define INOUT_ERROR define STP PARAME TIEK ERROR d 2 3 4 E 6 10 20 31 32 33 34 35 36 50 51 52 80 81 90 100 150 def
41. onzero Error consult the error table at the appendix Example wchar_t UM Copy the SG 30 RET GET_MSG 100 UMSG text from the array to a CStringW CStringW CS UMSG 2 3 8 3 Accessing multi language message files EzProg I supports text messages for eight languages and provides for each language a separate text file The messages used for the program have to be added together with a unique message identifier to the text files Identical messages in the different language files have to use the same identifier A message is not allowed to exceed 30 characters The number of messages are restricted to 1000 identifier 0 to 999 per text file The text files themselves can be created on the PC by using Notepad The messages have to be saved as UNICODE text files The text file names are predefined MLO txt ML7 txt and must be strictly adhered to The MLO txt file contains the messages of the first system language the ML1 txt file represents the second system language etc The text files have to be downloaded to the following PAC directory for WinCon CompactFlash EzProg EZHMI ML for MPac System_Disk EzProg I EZHMI ML The D register number 8000 is reserved for language setting It enables the user to switch the language setting during runtime The first language in the list is represented by the value 0 in the D 8000 register and the eighth language by the value 7 Example The
42. otion cards in slot 1 slot 2 and slot 3 supports hardware interrupt As described in the previous chapter it very important to ensure a short execution time in the interrupt service routine to guarantee a deterministic and real time behavior of the control program This is being done by avoiding large loops sleep commands and lengthy mathematical calculations Note The interrupt of the motion control modules all have the same priority Therefore the ISR of the interrupt which happened first will be executed first The interrupt priority of the motion control cards however is higher than that of the I 8048 digital input module 3 4 1 Motion card ISR initialization long MOTION_SET_INT BYTE Slot WOR EEK D Axis INTPFunc SRF This function links a callback function ISR to an interrupts of a specific axis Example The 18094 card is a four axis motion controller Each of its axes can generate several interrupt signals The function MOTION_SET_INT links all the interrupt of an axis to one callback function interrupts can be processed Inside the callback function the different Parameter Range Description Slot number Only the first three slots Slot 1 3 support hardware interrupt for motion cards ASIS A 0x1 Motion control axis AXIS_Y 0x2 18092F AXIS_X AXIS_Y Axis AXIS_Z 0x4 18094 F AXIS_X AXIS_Y AXIS_Z AXIS_U 0x8 AXIS_U 18094A H AXIS_X SRF Pointer to the Na
43. p between the EzCore and its APIs is shown on the following figure Interrupt E RTSR b USER Figure 1 APIs and threads supported by EzCore This manual introduces and describes the EzCore APIs provided for the EzProg I programmer Currently the following devices are supported by the APIs 18000 series http www icpdas com products motion EzProg I_i8K htm Motion control modules http www icpdas com products motion motion_I8K_Guide htm EzProg1 has a section of memory called Register where bit integer floating point and string values can be stored and accessed The EzCore engine scans every millisecond all digital and analog input modules to update the X AI registers and writes digital and analog data from the Y AO registers to the output modules Specification egister number Data type Size Range Diatalinput Local DI EE Gb SE FRNet DI d EO Local DO Analog Output eiza Ea zien zez Feo see 8 long integer EA Slot Device Register Software Register Special Type DB Message Table 1 Register types and register numbers supported by EzCore To access a register you must specify the register type X Y etc and the register number are a0 er errez Sd d bue ru fg erare rei E Ee er o errez reei E E errez rezi E Ee onono e rre rre Prot e errez errezi EO Message MSG ZEGO SET_MSG MSG_RegisterNo TCHAR UMSG 30 Table 2 APIs to access the registers
44. se Long ret ret DEVICE_INITIAL OUTPUT_Now IO_MODE_AutoScan RUN _PRG MODE if ret _NO_ERROR ret SCAN_ENGINE_START if ret _NO_ERROR Select language 0 as HMI language OT EASO d DIO e SET_M 200 true System initial ok Call the USER_RUN7 function in the user thread number 7 long RET START_USER_THREAD 7 USER_RUN7 Display the following text on Label 3 IEE IMIS il ar A siceucic USI INUIN 7 OR LUM is SET_M 131 true disable Button 2 SET_M 130 false enable Button 1 else MessageBox TEXT Start ENGINE NG apc GU uzi Please Gaec Ua TEXT EzCore Engine MB_OK MB_ICONERROR else MessageBox TEXT Load ALL Device Data NG TEXT n Please check n Please Rescan IO IMac A gizate girar IUa MB_OK MB_ICONERROR return TRUE return TRUE unless you set the focus to a control Interrupt callback function void INTE RUNO Count the number of interrupts and display it on Label 1 BUE ID CAL Sia _ID 4 EE User thread callback function unsigned long USER_RUN7 void long RET SIH IY PONE while true Display the tickcount value on Label 2 SEED I a Ee EUTG ZESG REO E UIS If Button 1 has been clicked enable the interrupt if GET_Ma 120 120 eie e reset Button 1 click f
45. t have only one void parameter and an unsigned long return type Return Value Description 0 Execution was successful Nonzero Error consult the error table at the appendix Example see chapter 3 1 3 3 1 2 Closing flag a user defined thread long END_USER_THREAD BYTE USERno This function indicates to the START_USER_THREAD function that the specified user thread has finished executing The START_USER_THREAD function can only open a new thread when the previous thread of the same number has ended with the END_USER_THREAD call Therefore it is important to call END USER_THREAD at the end of each user thread Parameter Range Description USERno 0 7 The thread number to close Return Value Description 0 Execution was successful Nonzero Error consult the error table at the appendix Example see chapter 3 1 3 3 1 3 User thread example EzDEMO4_USER ICP DAS CO LTD BM AE ARAYA GZ ICP DAS CO LTD GAURGERO Main property setting of the EZHMI objects Property Register number Register type Description Button Up gt Mno On 110 M Button click Mno On gt DisableActiveX 200 M Disable enable button po Button Property Register number Register type Description Button Up gt Mno On 111 M Button click Mno On gt DisableActiveX 201 M Disable enable button
46. t 1 3 support hardware interrupt for motion cards AXIS A Ox1 Motion control axis AXIS_Y 0x2 18092F AXIS_X AXIS_Y Axis AXIS_Z 0x4 18094 F AXIS_X AXIS_Y AXIS d AXIS_U 0x8 AXIS_U 18094A H AXIS_X Return Value Description 0 Execution was successful Nonzero Error consult the error table at the appendix Example see chapter 3 4 6 3 4 5 Disable motion card interrupt for specific axis long MOTION_STOP_INT BYTE Slot WORD Axis This function disables the motion hardware interrupt of a specific axis Parameter Range Description Slot number Only the first three slots Slot 1 3 support hardware interrupt for motion cards AXIS A Ox1 Motion control axis AXIS_Y 0x2 18092F AXIS_X AXIS_Y Axis AXIS_Z Ox4 18094 F AXIS_X AXIS_Y AXIS_Z AXIS_U Ox8 AXIS_U i8094A H AXIS_X Return Value Description 0 Execution was successful Nonzero Error consult the error table at the appendix Example see chapter 3 4 6 3 4 6 Motion ISR example CO LTD RARAS i8094A H SETUP AS CO LTD AE PLAY ME A IB 2 gt 3 Interrupt Start Call MP 41 yee ice DAS CO ce GKE did HEI FT Label 2 Interrupt count Label 4 Main property setting of the EZHMI objects Property Register number Register type Description Button Up gt Mno On 100 M Button click Mno On gt DisableActiveX 200 M Disable enable button
47. t priority A user thread can be called anywhere in the program by calling the START_USER_THREAD function 3 1 1 Execution of a user defined thread long START_USER_THREAD BYTE USERno LPTHREAI D_START_ROUTINE lpStartAddress This function creates a new thread with the specified priority and executes the assigned user defined function in this new thread At most eight threads can be created The EzCore does not allow two user threads with identical priority levels to run simultaneously Therefore once a user thread with a certain priority is running it is not possible to add another user thread with the same priority to the EzCore platform A new thread of the same priority can only be created once the existing thread has called the END_USER_THREAD function Parameter Range Description At most eight threads can be created 0 to 7 The thread number indicates the USERno 0 7 threads name and its priority It is not allowed to create two threads with the same number priority at the same time O highest priority 7 lowest priority 0 4 Soft Real Time 5 7 Non Real Time MFC Class lpStartAddress Pointer to the user defined thread function Name of the function to be called in the thread Note The prototype of the CALLBACK function looks like this unsigned long USER_THREAD void The callback function may have any name The callback function mus
48. tart ENGINE NG nPlease check TEXT EzCore Engine MB_OK MB_ICONERROR else MessageBox TEXT Load ALL Device Data NG USUE Gane Pilkeasemechecku a Please Rescan I0 Yh TEXT EzCore Engine MB_OK MB_ICONERROR return TRUE return TRUE unless you set the focus toa GA gerere void CEzZDEMO4_USERD1g OnClose TODO Add your message handler code here and or call Gu derant SCAN_ENGINE_STOP Stop the EzCore scan engine CDitallogrtJOnelese Ua 3 2 Real time service routine RTSR RTSR are functions which are being called at a set time interval by the EzCore engine RTSR enables the developer to create a real time and deterministic control program Eight functions with different priority levels are provided The priority level of each RTSR is fixed and can not be changed but the scan interval of the RTSR can be set by changing the default function call interval To ensure deterministic behavior of the RTSR it is important to make sure that the code in the RTSR is executed within the set time scan interval Therefore no sleep or indefinite loops are allowed inside the RTSR functions The EzCore engine must be initialized and started before any other RTSR operation is performed This requires the following two function calls STEP 1 DEVICE_INITIAL OUTPUT_Now IO_MODE_AutoScan RUN_PRG_MODE STEP 2 SCAN_ENGINE_START The main comman
49. the specified position of the DB register Parameter Range Description DBno 1 49 DB register number Num 0 127 Bit position data Oor 1 2 5 1 2 Read a single bit bool DB_GETx1 BYTE DBno BYTE Num This function reads one bit from the specified position of the DB register Parameter Range Description DBno 1 49 DB register number Num 0 127 Bit position Return Value Description 1 Bit is set 0 Bit is not set 2 3 7 3 Set an array of 8 bits void DB SETx8 BYTE DBno BYTE Num BYTE data This function writes one byte at the specified position of the DB register Parameter Range Description DBno 1 49 DB register number Num 0 15 Byte position data 0 255 Byte value 2 3 7 4 Read an array of 8 bits BYTE DB _GETx8 BYTE DBno BYTE Num This function reads one byte from the specified position of the DB register Parameter Range Description DBno 1 49 DB register number Num 0 15 Byte position Return Value Description 0 255 Byte value 2 3 7 5 Set an array of 16 bits WORD void DB_SETx16 BYTE DBno BYTE Num WORD data B This function writes two bytes at the specified position of the DB register Parameter Range Description DBno 1 49 DB register number Num 0 7 WORD position data 0 65 535 WORD v
50. urrent register status ON true Current register status OFF 2 3 1 6 Write analog output void OUT_AO WORD AOno float Vout This function writes analog output data to the analog output AO register Parameter Range Description AOno Local AO 0 to 511 Analog output AO register number Vout 3 4E 38 Analog output value 2 3 1 7 Read analog output float GET_AO WORD AOno This function reads the analog output data from the analog output AO register Parameter Range Description AOno Local AO 0 to 511 Analog output AO register number Return Value Description float value Analog output value 2 3 1 8 Read analog input float IN_AI WORD AIno This function reads the analog input data from the analog input AJ register Parameter Range Description AIno Local AI 0 to 511 Analog input AI register number Return Value Description float value Analog input value 2 0 2 Timer pm Set timer void SET_T BYTE Tno bool Flag DWORD ms This function starts and stops the timer count down The timer counts down the value entered for the ms parameter The timer stops once it has reached zero In this case the Flag parameter has to be set to false to prepare the time register for the next count down As a general rule it is always necessary to rest Flag false
51. y validation long CHECK _KEY wchar_t AES _KEY 20 This function uses the registration key entered by the user for example via an EzHMI ColorEdit box to calculate the developer product key and compares this key with the valid product key AES_KEY If both are identical the function returns true Parameter Range Description AES KEY 20 1 pointer to an Unicode character array which contains a 16 character product key The real product key This key should not be revealed to the end user EzConfig Edit Encrypt gt Key code Input Return Value Description 0 The registration key is valid Nonzero Error consult the error table at the appendix Example long RET CHECK_KEY L 1234567812345678 3 EzCore application programming 3 1 User thread The user thread allows the programmer to write low priority code like updating the user interface or other none time critical operation Eight user threads 0 to 7 can be used simultaneously each with a different priority The thread priority is set by assigning a number 0 to 7 when a new thread is being called It is not possible to run two different threads with identical priority at the same time The first thread has to be terminated before a second thread with the same priority can be created The priority level decreases with increasing thread number Thread number 0 has the highest and thread number 7 the lowes

Download Pdf Manuals

image

Related Search

Related Contents

Parler à une personne malentendante  Transearch 3.2 User Manual  GCU 102 - Arizona State University  

Copyright © All rights reserved.
Failed to retrieve file