Home
WinPAC Standard API User Manual
Contents
1. Remarks The same as the pac_EnableWatchDog function the pac_GetWatchDogTime of hardware watchdog retrieves a value between 0 31 but millisecond WinPAC Standard API User Manual WinCE based eVC amp NET eo 5 5 pac _RefreshWatchDog This function refreshes the watchdog Syntax void pac_RefreshWatchDog int wat Parameters WDT in Specifies the Watchdog type WINpac_WDT_HW 0 WINpac_WDT_ OS 1 Return Values None Examples eVC pac_RefreshWatchDog WINpac_WDT_OS C WinPAC pac_RefreshWatchDog 1 WinPAC Standard API User Manual WinCE based eVC amp NET ee 5 6 pac_SetWatchDogTime This function specifies the watchdog time Syntax void pac_SetWatchDogTime int wat DWORD value Parameters WDT in Specifies the Watchdog type WINpac_WDT_HW WINpac_WDT_OS millisecond in Specifies the watchdog time Return Values None Examples eVC DWORD dwTime 1000 pac_SetWatchDogTime WINpac_WDT_OS dwTime C WinPAC Standard API User Manual WinCE based eVC amp NET 80 uint uTime 1000 WinPAC pac_SetWatchDogTime 1 uTime Remarks The same as the pac_EnableWatchDog function The hardware watchdog second Parameters is a value which is between 0 31 unit A unit is about 200 milliseconds 0 means the shortest timeout otherwise 31 is longest WinPAC Standard API User Manual WinCE based eVC amp NET 6 m
2. eVC char CPU 82 pac_GetCPUVersion CPU C string CPU CPU WinPAC pac_GetCPUVersion WinPAC Standard API User Manual WinCE based eVC amp NET eis 1 5 pac_GetEbootVersion This function retrieves the eboot version Syntax void pac_GetEbootVersion LPSTR eboot_version Parameters Fboot_version out Retrieves the Eboot version Return Values None Examples eVC char Eboot 32 pac_GetEbootVersion Eboot C string Eboot Eboot WinPAC pac_GetEbootVersion WinPAC Standard API User Manual WinCE based eVC amp NET vo em 1 6 pac_GetMacAddress This function retrieves the Mac address Syntax void pac_GetMacAddress BYTE LAN LPSTR MacAddr Parameters LAN in Specifies the LAN number MacAddr out Retrieves the MAC address of the specified LAN port Return Values None Examples eVC byte MAC 1 pac_GetMacAddress MAC WinPAC Standard API User Manual WinCE based eVC amp NET C byte MAC 1 String LAN LAN WinPac pac_GetMacAddress MAC WinPAC Standard API User Manual WinCE based eVC amp NET in 1 7 pac_GetMapCOM This function retrieves the index mapping of COM port Normal mode Backward Compatible mode Syntax int pac_GetMapCom int ndx WinPAC Standard API User Manual WinCE based eVC amp NET l Parameters ndx in Spec
3. pac_GetBackplanelD Backplane C string Backplane Backplane WinPAC pac_GetBackplanelD WinPAC Standard API User Manual WinCE based eVC amp NET 2 3 pac_GetBatteryLevel This function retrieves the backplane battery status i DE Syntax int pac_ GetBatteryLevel int nBattery Parameters nBattery in Specifies the index of battery 1 means first battery 2 means second battery WinPAC Standard API User Manual WinCE based eVC amp NET ese Return Values 1 means high voltage 2 means low voltage Examples feVC int nBattery int index 1 nBattery pac_GetBatteryLevel index C int nBattery int index 1 nBattery WinPAC pac_GetBatteryLevel index WinPAC Standard API User Manual WinCE based eVC amp NET WER 2 4 pac_GetDIPSwitch This function retrieves the dip switch Syntax int pac_GetDIPSwitch Parameters None Return Values Return Values of the DIP switch Examples eVC int iDipSwitch iDipSwitch pac_GetDIPSwitch C int iDipSwitch iDipSwitch WinPAC pac_GetDIPSwitch WinPAC Standard API User Manual WinCE based eVC amp NET 40 2 5 pac_GetSlotCount This function retrieves the number of slot Syntax WORD pac_GetSlotCount Parameters None Return Values Return the number of slots available Examples eVC WORD wSlot wolot pac_G
4. 0x41 buf 1 0x42 hPort uart_Open COMS8 9600 N 8 1 ret uart_BinSend hPort buf 2 uart_Close hPort C bool ret IntPtr hPort string buf AB hPort WinPAC uart_Open COM3 9600 N 8 1 ret WinPAC uart_BinSend hPort WinPAC AnsiString buf 2 WinPAC uart_Close hPort Remarks Note that this function is usually applied to communicate with the other device but not for ICPDAS DCON I 7000 8000 87K series modules This function will call PurgeComm to clear serial COM port output buffer WinPAC Standard API User Manual WinCE based eVC amp NET mem 8 3 uart BinSendCmd This function is used to Send binary command and receive binary data with the fixed length This function is a combination of uart_BinSend and uart_BinRecv The operation for sending a command is the same as uart_BinSend The operation for receiving a response is the same as uart_BinRecv Syntax bool uart_ BinSendCmd HANDLE hPort LPCSTR ByteCmd DWORD in Len LPSTR ByteResult DWORD out Len Parameters hPort in Handle to the open COM ByteCmd in A pointer to a command in_Len in The length of command string ByteResult out A pointer to a buffer that receives the data out Len in The length of result string WinPAC Standard API User Manual WinCE based eVC amp NET mian Return Values 1 indicates success O indicates failure Examples eVC bool ret HAN
5. WinPAC Standard API User Manual WinCE Based eVC amp NET G COP Version 2 0 0 September 2010 Service and usage information for WinPAC 8000 ViewPAC 2000 WinPAC 5000 Written by Sean Edited by Anna Huang Warranty All products manufactured by ICP DAS are under warranty regarding defective materials for a period of one year beginning from the date of delivery to the original purchaser Warning ICP DAS assumes no liability for any damage resulting from the use of this product ICP DAS reserves the right to change this manual at any time without notice The information furnished by ICP DAS is believed to be accurate and reliable However no responsibility is assumed by ICP DAS for its use not for any infringements of patents or other rights of third parties resulting from its use Copyright Copyright 2009 by ICP DAS Co Ltd All rights are reserved Trademark The names used for identification only may be registered trademarks of their respective companies Contact US lf you have any problem please feel free to contact us You can count on us for quick response Email service icpdas com WinPAC Standard API User Manual WinCE based eVC amp NET Contents Perface Overview of WinPAC API 1 System Information API a aCe Ee rel e e d UE 15 1 2 aC EIERE 16 Wes Dae ne CE D E 17 1 4 Pac Gei HllVereon 18 1 5 pac_GetEbootVersion cccceecccceecec
6. WinPAC Standard API User Manual WinCE based eVC amp NET e 3 8 pac_SetSlotinterruptPriority This function sets the priority for a real time thread on a thread by thread basis Syntax bool pac_SetSlotinterruptPriority BYTE slot int nPriority Parameters slot in Specify the index of slot to set priority nPriority in Priority to set for the thread This value can range from 0 through 255 with O as the highest priority Return Values Return true if success otherwise false Examples None WinPAC Standard API User Manual WinCE based eVC amp NET 3 9 pac_SetTriggerType This function can assign the pulse trigger type Syntax void pac_SetTriggerType int iType Parameters iType in Specify the pulse trigger type 0 Rising edge trigger default 1 Level trigger 2 Falling edge trigger Return Values None Examples None WinPAC Standard API User Manual WinCE based eVC amp NET WE 3 10 pac_UnregisterSlotinterrupt This function unregisters slot interrupt service route and diables a hardware interrupt as specified by its interrupt identifier Syntax bool pac_UnregisterSlotinterrupt BYTE slot Parameters slot in Specify the index of slot Return Values Return true if success otherwise false Examples WinPAC Standard API User Manual WinCE based eVC amp NET Tee eVC int slot 3 if slot is 3 int CALLBACK slot_callb
7. hPort WinPAC uart_Open COMO0 115200 N 8 1 byte iSlot 0 bool ret pac_ClearDILatch hPort iSlot WinPAC uart_Close hPort Remarks The function can support for Local or Remote When the module is local the second Parameters s range is from 0 to 7 If remote the second Parameters need use the macro pac REMOTE _ IO Address which Address is from 0 to 255 WinPAC Standard API User Manual WinCE based eVC amp NET 156 l 9 4 pac_ClearDlOLatch This function clears the latch values of DI and DO channels of the DIO module Syntax bool pac_ClearDIOLatch HANDLE hPort int slot Parameters hPort in the serial port HANDLE opened by uart_Open iSlot in The slot in which module is to receive the command Default is local lf the IO module is remote please use the macro pac_ REMOTE_IO 0 255 Return Values Return true if success otherwise false WinPAC Standard API User Manual WinCE based eVC amp NET TE Examples feVC HANDLE hPort hPort uart_Open COMO0 115200 N 8 1 BYTE iSlot 0 bool ret pac_ClearDIOLatch hPort iSlot uart_Close hPort C IntPtr hPort hPort WinPAC uart_Open COMO0 115200 N 8 1 byte iSlot 0 bool ret WinPAC pac_ClearDIOLatch hPort iSlot WinPAC uart_Close hPort Remarks The function can support for Local or Remote When the module is local the second Parameters s range is from 0 to 7 If remote the second
8. kKeyName in Specifics the path of registry key which you want to delete Return Values Return true if success otherwise false To get an error code call pac_GetLastError A nonzero error code defined in PACERROR h indicates failure To get a generic description of the error call pac_GetErrorMessage The message resource is optional therefore if you call pac_GetErrorMessage it could fail Examples eVC bool ret ret pac_RegDeleteKey TEXT HKEY_USERS myKey WinPAC Standard API User Manual WinCE based eVC amp NET eos C bool ret ret WinPAC pac_RegDeleteKey HKEY USERS myKey Remarks If you delete a key which doesn t exist nothing happen If the function succeeds the function will delete the specified key including all of its subkeys and values An application cannot call RegDeleteKey for a key that an application currently has open WinPAC Standard API User Manual WinCE based eVC amp NET eos 7 59 pac_RegDeleteValue This function removes a named value from the specified registry key Syntax bool pac_RegDeleteValue LPCTSTR KeyName Parameters kKeyName in Specifics the path of registry key which you want to delete Return Values Return true if success otherwise false To get an error code call pac_GetLastError A nonzero error code defined in PACERROR h indicates failure To get a generic description of the error call pac_GetErrorMessage T
9. result string str WinPAC WideString result Remarks In NET if we want to convert a Unicode string to ANSI or vice versa we should convert through byte array WinPAC Standard API User Manual WinCE based eVC amp NET peta Appendix A System Error Codes This following table provides a list of system error code There are turned by the pac_GetLastError function when many functions fail To retrieve the description text for the error in your application use the pac_GetErrorMessage function Error Code Error Message WinPAC Standard API User Manual WinCE based eVC amp NET WER WinPAC Standard API User Manual WinCE based eVC amp NET WER
10. amp NET Pies Examples eVC HANDLE hPort hPort uart_Open COMO0 115200 N 8 1 BYTE iSlot 0 int iChannel 2 int DI TotalCh 8 bool ret pac_ClearDICNT hPort iSlot iChannel iDI_ TotalCh uart_Close hPort C IntPtr hPort hPort WinPAC uart_Open COMO 115200 N 8 1 byte iSlot 0 int iChannel 2 int DI TotalCh 8 bool ret WinPAC pac_ClearDICNT hPort iSlot iChannel iDI_ TotalCh WinPAC uart_Close hPort Remarks The function can support for Local or Remote When the module is local the second Parameters s range is from 0 to 7 If remote the second Parameters need use the macro pac REMOTE _IO Address which Address is from 0 to 255 WinPAC Standard API User Manual WinCE based eVC amp NET 154 9 3 pac _ClearDiLatch This function clears the latch value of the DI module Syntax bool pac_ClearDILatch HANDLE hPort int slot Parameters hPort in the serial port HANDLE opened by uart_Open iSlot in The slot in which module is to receive the command Default is local lf the IO module is remote please use the macro pac_ REMOTE_IO 0 255 Return Values Return true if success otherwise false WinPAC Standard API User Manual WinCE based eVC amp NET 155 Examples feVC HANDLE hPort hPort uart_Open COMO0 115200 N 8 1 BYTE iSlot 0 bool ret pac_ClearDILatch hPort iSlot uart_Close hPort C IntPtr hPort
11. eVC int counter 0 TCHAR buf 10 bFlag true while bFlag pac_DoEvents sworintf buf TEXT d counter SetDigltemText IDC_EDIT1 buf counter WinPAC Standard API User Manual WinCE based eVC amp NET RS 12 4 pac_WideStringToAnsi This function can convert unicode string to ansi string Syntax void pac_WideString ToAnsi const TCHAR wett LPSTR astr Parameters wstr in A pointer to a buffer that stores unicode string astr in A pointer to a buffer that receives ansi string Return Values None Examples eVC TCHAR uniString 128 TEXT This is a unicode string char ansiString 128 pac_WideString ToAnsi uniString ansiString printf s ansiString The string This is a unicode string will show the console mode correctly WinPAC Standard API User Manual WinCE based eVC amp NET m Remarks Maximum string buffer size is 2 Kbytes WinPAC Standard API User Manual WinCE based eVC amp NET ek 12 5 WideString This function can convert ansi byte array to unicode string Syntax string WideString byte CharStr Parameters CharStr in A pointer to a buffer that stores ansi byte array Return Values Return unicode string Examples C byte result new byte 32 IntPtr hPort WinPAC uart_Open COM1 WinPAC pac_ChangeSlot Convert ToByte 1 WinPAC uart_SendCmd hPort WinPAC AnsiString 00M
12. APIs WinPAC Standard API User Manual WinCE based eVC amp NET emis PAC IO API Provides reference information for IO APIs including local and remote In additions no matter 8K or 87K modules use the same API Backplane timer API Provides hardware timerout timer tickcout functions Error Handling API Provides reference information for error handling WinPAC Standard API User Manual WinCE based eVC amp NET mn 1 System Information API System operations include basic operation such as reboot and changing slot and version display including OS Eboot SDK Serial Number and Mac address The following topics describe how you can show the system information or other basic operation programmatically using the system functions Supported Modules The following shows the overview of the system functions which are available with WinPAC Functions Models WP 8x4x WP 8x3x WP 8x5x WP 5xxx VP 25Wx VP 23Wx VH 25Wx pac_BackwardCompatible pac_ChangeSlot Y pac_EnableLED Y pac_GetCPUVersion Y pac_GetEbootVersion Y Y ES ER ES i ESES ESES py fete fe pac_GetMacAddress manos fv fe pac_GetModuleName pac_GetModuleType pac_GetOSVersion Y pac_GetRotaryID Y pac_GetSerialNumber Y Y Y Y Y Y Y Y Y Y Y pac_GetWinPacNetVersion Y Y pac_GetWinPacSDK Version Y Y Y Y pac_Reboot WinPAC Standard API User Manual WinCE based eVC amp NET miian Function List The following f
13. Parameters None Return Values The number of milliseconds indicates success Examples None WinPAC Standard API User Manual WinCE based eVC amp NET WER 10 2 pac_GetBPTimerTimeTick_us This function returns the number of microsecond since the device booted excluding any time that the system was suspended Syntax DWORD pac_GetBPTimerTimeTick_us void Parameters None Return Values The number of microseconds indicates success Examples None WinPAC Standard API User Manual WinCE based eVC amp NET mie J 10 3 pac_KillBPTimer This function kills the timer event identified by type set by an earlier call to pac_SetBP Timer Syntax void pac_KillBPTimer int type Parameters type in Two type timer 1 microsecond timer and 10 microsecond timer Return Values None Examples None WinPAC Standard API User Manual WinCE based eVC amp NET Tech 10 4 pac _SetBPTimer This function installs a hardware timer A time out value is specified and every time a time out occurs the system posts an interrupt signal to the system and the pass the message to an application defined callback function Syntax Bool pac_SetBPTimer int type unsigned int uElapse pac_TIMEROUT CALLBACK_FUNC f Parameters type in Two type timer 1 microsecond timer and 10 microseconds timer uElapse in Timer 1 Specifies the elapses time value for a timerout signal 0 65535 in microsecond
14. Parameters need use the macro pac REMOTE _IO Address which Address is from 0 to 255 WinPAC Standard API User Manual WinCE based eVC amp NET RE 9 5 pac _GetBit The function can retrieve the value which in specific bit Syntax pac_GetBit V ndx Parameters V Which IO result wants to get bit ndx Specific bit to retrieve Return Values The value of specific index Examples C bool bit bit WinPAC pac_GetBit Ox5A 0 WinPAC Standard API User Manual WinCE based eVC amp NET 159 Remarks The function is used the same as v amp 1 lt lt index If you use WinPacNet dll to develop the return value is on or off for the specifics bit WinPAC Standard API User Manual WinCE based eVC amp NET 160 9 6 pac_ReadAl This function reads the engineering mode Al value of the Al module Syntax bool pac_ReadAl HANDLE hPort int slot int Channel int A TotalCh float fValue Parameters hPort in the serial port HANDLE opened by uart_Open iSlot in The slot in which module is to receive the command Default is local lf the IO module is remote please use the macro pac_REMOTE_IO 0 255 iChannel in Read the Al value from the channel IAl_TotalCh in The total number of the Al channels of the Al module Value in The pointer to the Al value that is read back from the Al module Return Values Return true if success otherwise fals
15. Standard API User Manual WinCE based eVC amp NET e Return Values Return true if success otherwise false To get an error code call pac_GetLastError A nonzero error code defined in PACERROR h indicates failure To get a generic description of the error call pac_GetErrorMessage The message resource is optional therefore if you call pac_GetErrorMessage it could fail Examples eVC bool ret DWORD address 0 BYTE Buffer 2 Buffer O 10 Buffer 1 20 ret pac_WriteMemory address Buffer 2 WiNoac MEM SRAM C bool ret uint address 0 byte Buffer new byte 2 10 20 ret WinPAC pac_WriteMemory address Buffer 2 0 Remarks The input range size of EEPROM doesn t exceed 8K The architecture of EEPROM is as following O Ox1FFF 8k for users 0x2000 0x3FFF 8k for reserve The input range size of SRAM only 0 Ox6FFFF 448k Another 64K of SRAM is system reserved WinPAC Standard API User Manual WinCE based eVC amp NET Te 4 4 pac_EnableEEPROM This function turns on off EEPROM Syntax void pac_EnableEEPROM bool bEnable Parameters bEnable in To turn on or protect EEPROM True To turn on EEPROM False To protect EEPROM Return Values None WinPAC Standard API User Manual WinCE based eVC amp NET e Examples eVC int ret DWORD address 0 BYTE Buffer 2 Buffer 0 OxAB Buffer 1 OxCD pac_EnableEEPROM true ret
16. WinPAC Standard API User Manual WinCE based eVC amp NET m ng Remarks The uart_Open function does not open the specified COM port if the COM port has been opened Use I 811xW I 814xW series modules The COM port name is COM6 COM7 MSA1 MSB1 MSAx MSBx is an earlier old usage The new usage is COM x For example uart_Open COM6 9600 N 8 1 uart_Open MSA 1 9600 N 8 1 About how to set I 811xW I 814xW series modules Please refer to the manual below w1 007 1_how_to_set_up a_communication_module 8112_ 8114 8142 8144 us e COM _english pdf w1 007 2 how_to set up a _communication_module 8112_ 8114 8142 8144 us e MSA B _ english pdf Use I 87K series modules Only use COMO to communicate with I 87K series modules Please refer to Sec 8 UART API WinPAC Standard API User Manual WinCE based eVC amp NET er 8 9 uart Recv This function retrieves data through the COM port which have been opened This function will receive a string 0x0D Wait a character OxOD to mean the termination of a string And then if the checksum is enabled by the uart_EnableCheckSum function this function automatically check the two checksum bytes to the string This function will provides a string without the last byte OxOD Syntax bool uart_Recv HANDLE hPort LPCSTR buf Parameters hPort in Handle to the open COM port buf out A pointer to a buffer that receives the data Ret
17. based eVC amp NET are 7 9 pac_RegGetString This function retrieves value of the specified registry key Syntax bool pac_RegGetString LPCTSTR KeyName LPTSTR IpData DWORD dwLength Parameters KeyName in Specific the path of registry key loData out Pointer to a buffer that receives the value s data dwLength in Specific the size of data Return Values Return true if success otherwise false To get an error code call pac_GetLastError A nonzero error code defined in PACERROR h indicates failure To get a generic description of the error call pac_GetErrorMessage The message resource is optional therefore if you call pac_GetErrorMessage it could fail WinPAC Standard API User Manual WinCE based eVC amp NET mun Examples eVC bool ret TCHAR strName 10 ret pac_RegGetString TEXT HKEY USERS myKey value strName sizeot strName C bool ret string strName new Ging 10 ret WinPAC pac_RegGetString HKEY_USERS myKey value strName uint strName Length WinPAC Standard API User Manual WinCE based eVC amp NET se 7 10 pac_RegGetValueBylndex This function retrieves the value of specified index of registry key Syntax bool pac_RegGetValueByIndex LPCTSTR KeyName DWORD dwindex LPTSTR lpName Parameters kKeyName in Specific the path of registry key dwindex in Specific the index of value loName out Pointer to a
18. counter frequency module Return Values Return true if success otherwise false WinPAC Standard API User Manual WinCE based eVC amp NET sil Examples eVC HANDLE hPort hPort uart_Open COMO0 115200 N 8 1 BYTE iSlot 0 int iChannel 0 DWORD Counter_ Value bool ret pac_ReadCNT hPort iSlot iChannel amp lCounter_ Value uart_Close hPort C IntPtr hPort hPort WinPAC uart_Open COMo0 115200 N 8 1 byte iSlot 0 int iGhannel 0 uint Counter_ Value new uint bool ret WinPAC pac_ReadCNT hPort iSlot iChannel ref Counter_ Value WinPAC uart_Close hPort Remarks The function can support for Local or Remote When the module is local the second Parameters s range is from 0 to 7 If remote the second Parameters need use the macro pac REMOTE _IO Address which Address is from 0 to 255 WinPAC Standard API User Manual WinCE based eVC amp NET oo 9 12 pac_ReadCNTOverflow This function clears the counter overflow value of the counter frequency modules Syntax bool pac_ReadCNT Overflow HANDLE hPort int slot int Channel int iOverflow Parameters hPort in the serial port HANDLE opened by uart_Open iSlot in The slot in which module is to receive the command Default is local lf the IO module is remote please use the macro pac_REMOTE_IO 0 255 iChannel in The channel that reads the counter overflows value back from the counter f
19. loName out Assign a buffer to retrieves the specific the key name Return Values Return true if success otherwise false To get an error code call pac_GetLastError A nonzero error code defined in PACERROR h indicates failure To get a generic description of the error call pac_GetErrorMessage The message resource is optional therefore if you call pac_GetErrorMessage it could fail WinPAC Standard API User Manual WinCE based eVC amp NET ee Examples feVC bool ret DWORD index 0 TCHAR strName 10 ret pac_RegGetKeyBylndex TEXT HKEY USERS myKey index strName C bool ret uint index 0 string strName new String 0 10 ret WinPAC pac_RegGetKeyBylndex HKEY_USERS myKey index strName WinPAC Standard API User Manual WinCE based eVC amp NET eso 7 8 pac_RegGetKeylnfo This function retrieves the type of specified index of registry key Syntax DWORD pac_RegGetKeylnfo LPCTSTR KeyName Parameters kKeyName in Specific the path of registry key Return Values We define four types about the return value PKT NONE 0 PKT_KEY 1 PKT_ STRING 2 PKT_DWORD 3 Examples eVC DWORD dwType dwType pac_RegGetKeylnfo TEXT HKEY_USERS myKey value WinPAC Standard API User Manual WinCE based eVC amp NET roo C uint u Type uType WinPAC pac_RegGetKeyInfo HKEY_USERS myKey value WinPAC Standard API User Manual WinCE
20. pac_ReadMemory This function retrieves data from the specified memory pac_WriteMemory This function stores data in the specified memory pac_EnableEEPROM This function turns on off EEPROM WinPAC Standard API User Manual WinCE based eVC amp NET RSR 4 1 pac_GetMemorySize This function retrieves the size of the specified memory Syntax DWORD pac_GetMemorysize int mem_type Parameters mem_type in Handle to a currently type memory WINpac_MEM_SRAM 0 WINpac_MEM EEPROM 1 Note WP 5xxx series doesn t support SRAM Return Values The return value specifies the memory size Examples eVC DWORD mem size mem_size pac_GetMemorySize WINpac_MEM_ SRAM WinPAC Standard API User Manual WinCE based eVC amp NET eo C uint mem size mem_size WinPAC pac_GetMemorysize 0 WinPAC Standard API User Manual WinCE based eVC amp NET Te 4 2 pac_ReadMemory This function retrieves data from the specified memory Syntax bool pac_ReadMemory DWORD address LPBYTE lpBuffer DWORD dwLength int mem_type Parameters address in Specifies the memory address where read from loBuffer in A pointer to a buffer that receives the memory data dwLength in Number of characters to be read mem_type in Handle to a currently type memory WINpac_MEM_SRAM 0 WiNpoac MEM EEPROM 1 Note WP 5xxx series doesn t support SRAM WinPAC Standard API User Manual WinCE bas
21. pac_WriteMemory address Buffer 2 WINpbac_ MEM EEPROM pac_EnableEEPROM false C bool ret uint address 0 byte Buffer new byte 2 OxAB OxCD WinPAC pac_EnableEEPROM true ret WinPAC pac_WriteMemory address Buffer uint Buffer Length 0 WinPAC pac_EnableEEPROM false Remarks Before writing EEPROM you must enable the EEPROM first after written EEPROM you have to disable EEPROM WinPAC Standard API User Manual WinCE based eVC amp NET e 5 Watchdog API Watchdog operations include basic management operations such as turning on and refreshing The following topics describe how you can operate watchdog programmatically using the watchdog functions Supported Modules The following shows the overview of the watchdog functions which are available with WinPAC Functions Modules WP 8x4x WP 8x3x WP 8x5x WP 5xxx VP 25Wx VP 23Wx VH 25Wx pac_DisableWatchDog pac_EnableWatchDog pac_GetWatchdogTime pac_RefreshWatchDog pac_SetWatchDogTime WinPAC Standard API User Manual WinCE based eVC amp NET Te Function List The following functions are used to retrieve or set watchdog functions Function Description pac_DisableWatchDog This function turns off the watchdog operation pac_EnableWatchDog This function turns on the watchdog operation pac_GetWatchDogState This function retrieves the watchdog state pac_GetWatchdogTime This function retrieves the watchdog time p
22. such as reading from and writing to the registry The following topics describe how you can create delete or modify registry keys programmatically using the registry functions Supported Modules The following shows the overview of the registry functions which are available with WinPAC Functions Models WP 8x4x WP 8x3x WP 8x5x WP 5xxx VP 25Wx VP 23Wx VH 25Wx pac_RegCountKey Y pac_RegCountValue Y pac_RegCreateKey Y pac_RegDeleteKey Y pac_RegDeleteValue Y pac_RegGetDWORD Y pac_RegGetKeyBylndex Y pac_RegGetValueBylndex Y pac_RegKeyExist Y pac_RegSave Y pac_RegSetString Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y pac_RegSetDWORD Y WinPAC Standard API User Manual WinCE based eVC amp NET Cem Function List The following functions are used to retrieve or set registry information Function Description This function retrieves the specified registry key which has ac_RegCountKe GE d how many sub keys This function retrieves the specified registry key which has how many values pac_RegCreateKey This function creates the specified registry key This function deletes a named subkey from the specified registry key pac_RegCountValue pac_RegDeleteKey This function removes a named value from the specified registry key pac_RegGetDWORD This function retrieves value of the specified registry key This function retrieves the name of specified index of registry key pac_RegDeleteValu
23. this installation puts the header files libraries into the following public places so they are easily changed by update the WinPAC SDKs Header files C Program Files Windows CE Tools wce500 PAC270 Icpdas Include ARMV4 Libraries C Program Files Windows CE Tools wce500 PAC270 Icpdas Lib ARMV41 WinPAC Standard API User Manual WinCE based eVC amp NET mem Overview of WinPAC API The WinPAC API enables applications to exploit the power of WinPAC The WinPAC API consists of the following APIs and functional categories WatchDog system Information I Registry Backplane Timer UART system Operation a ye 4 so Remote I O Local I O WinPAC Standard API User Manual WinCE based eVC amp NET eo System Information API Provides reference information for the system status Backplane API Provides reference information for the backplane access APIs including Hot Plug and backplane information Interrupt API Provides reference information for the Interrupt APIs Memory Access API Provides reference information for the memory R W APIs including EEPROM and SRAM Watchdog API Provides reference information for the watchdog APIs including hardware watchdog and OS watchdog microSD Management API Provides reference information for the microSD Manager Registry API Provides reference information for the registry UART API Provides reference information for the Uart
24. 14 DAG Tal E E CH RE 177 9 19 DAG TASCA HAUG ME 179 HIEP TS AIO EE 181 9 17 pac_ReadDIlOLatch EE 183 9 18 poac Head 186 ONO AS VMI E 188 DR PE WEDO EE 190 92l p4 CRL E 192 10 Backplane timer API 10 1 pa Getb bfumerfmelck ms 196 10 2 pae GeEIBP Bian C ime WICK E 197 WO SDC IIMS Hin 198 10 4 Dae Set MICU aacatr entered crew catinesceaetecauenutererertnesveqtisi cneatecearctrenueuetverencetaasaeaves 199 TOS Dde En E ln ET 200 11 Error Handling API Tides CENONE SS ade E 202 WZ aC EE E Bi O reeeo A Ea EEE e EDEA 204 E TER E 0 ae E E E E E E E E ee 205 12 MISC API KEE 207 12 2 pac AneloWwieimmg 208 WinPAC Standard API User Manual WinCE based eVC amp NET mim 12 3 DAG DOEVEINS rsrsrs nerro Ner vere ranossenaneeveereeer axe aNe E ONTKETEN ENEN ENNE 210 124 DaC WdeSting IOAN EE 212 Teo 0 E SNO ener N ene Pe ee ee 214 Appendix A System Error Codes WinPAC Standard API User Manual WinCE based eVC amp NET Perface This guide introduces WinPAC Software Development Kit SDK It provides an overview of what you can do with the SDK and the technologies that are available to you through the SDK Software Development Tool Microsoft eMbedded Visual C Visual Basic net Visual C Requirements The WinPAC SDK only supports NET Framework 2 0 or above Installation Path After installing the WinPAC SDKs a number of functions can be installed on the Host PC and
25. C Standard API User Manual WinCE based eVC amp NET eres Examples feVC HANDLE hPort hPort uart_Open COMO0 115200 N 8 1 BYTE iSlot 0 float fValue 8 bool ret pac_ReadAlAll hPort iSlot fValue uart_Close hPort C IntPtr hPort hPort WinPAC uart_Open COMO0 115200 N 8 1 byte iSlot 1 float fValue new float 8 bool ret WinPAC pac_ReadAlAll hPort iSlot fValue WinPAC uart_Close hPort Remarks The function can support for Local or Remote When the module is local the second Parameters s range is from 0 to 7 If remote the second Parameters need use the macro pac REMOTE _IO Address which Address is from 0 to 255 WinPAC Standard API User Manual WinCE based eVC amp NET EZE 9 8 pac _ReadAlAllHex This function reads all the Al values of all channels in 2 s complement mode of the Al module Syntax bool pac_ReadAlAllHex HANDLE hPort int slot int iValue Parameters hPort in the serial port HANDLE opened by uart_Open iSlot in The slot in which module is to receive the command Default is local lf the IO module is remote please use the macro pac_REMOTE_IO 0 255 iValue out The array contains the Al values that read back from the Al module Return Values Return true if success otherwise false WinPAC Standard API User Manual WinCE based eVC amp NET 165 Examples feVC HANDLE hPort hPort uart_Op
26. CE based eVC amp NET min 8 8 uart_Open This function opens the COM port and specifies the baud rate parity bits data bits and stop bits Syntax HANDLE uart_Open LPCSTR ConnectionString Parameters ConnectionString in Specifies the COM port baud rate parity bits data bits and stop bits The default setting is COMO0 115200 N 8 1 The format of ConnectionString is as follow com_port baud_rate parity_bits data_bits stop bits Warning there is no blank space between each Parameters Com_port COMO COM baud_rate 9600 19200 38400 57600 115200 parity_bits N NOPARITY O ODDPARITY E EVENPARITY M MARKPARITY S SPACEPARITY Data_bits 5 6 7 8 Stop _ bits 1 ONESTOPBIT 2 TWOSTOPBITS 1 5 ONESSTOPBITS WinPAC Standard API User Manual WinCE based eVC amp NET mei Return Values A handle to the open COM port Nonzero indicates success If the function fails the return value is INVALID HANDLE Value INVALID HANDLE_ Value should beOxffffffff in eVC INVALID_ HANDLE_Value should be 1 in NET To get extended error information call GetLastError To get a generic description of the error call pac_GetErrorMessage The message resource is optional therefore if you call pac_GetErrorMessage it could fail Examples eVC HANDLE hPort hPort uart_Open COM2 9600 N 8 1 C IntPtr hPort hPort WinPAC uart_Open COM2 9600 N 8 1
27. DLE hPort char buf 2 char cmd 2 hPort uart_Open COM3 9600 N 8 1 cmd 0 0x41 cmd 1 0x42 ret uart_BinSendCmd hPort cmd 2 buf 2 uart_Close hPort C bool ret byte cmd new byte 2 IntPtr hPort byte buf new byte 2 cmd 0 0x41 cmd 1 0x42 hPort WinPAC uart_Open COM3 9600 N 8 1 ret WinPAC uart_BinSendCmd hPort cmd 2 buf 2 WinPAC uart_Close hPort Remarks This function will call PurgeComm to clear serial COM port output and input buffer WinPAC Standard API User Manual WinCE based eVC amp NET oe 8 4 uart Close This function closes the COM port which has been opened Syntax bool uart_Close HANDLE hPort Parameters hPort in Handle to the open COM port to close Return Values 1 indicates success O indicates failure Examples eVC bool ret HANDLE hPort hPort uart_Open COM2 9600 N 8 1 ret uart_Close hPort WinPAC Standard API User Manual WinCE based eVC amp NET RE C bool ret IntPtr hPort hPort WinPAC uart_Open COM2 9600 N 8 1 ret WinPAC uart_Close hPort Remarks The function for a specified COM port should not be used after it has been closed WinPAC Standard API User Manual WinCE based eVC amp NET 0125 8 5 uart_EnableCheckSum This function turns on the check sum or not Add two checksum bytes to the end of data which is used to produce ch
28. GetLastError Buffer MessageBox NULL Buffer L Error MB OK MB_ICONINFORMATION WinPAC Standard API User Manual WinCE based eVC amp NET WEEN 11 2 pac_GetLastError This function returns the last error code value Syntax DWORD pac_GetLastError Parameters None Return Values The Return Value section of each reference page notes the conditions under which the function sets the last error code Examples None Remarks You should call the pac_GetLastError function immediately when a function s return value indicates that such a call will return useful data That is because some functions call pac_SetLastError 0 when they succeed wiping out the error code set by the most recently failed function To obtain an error string for WinPac error codes use the pac_GetErrorMessage function For a complete list of error codes see Error Values or the SDK header file PACERROR H WinPAC Standard API User Manual WinCE based eVC amp NET 204 11 3 pac_SetLastError This function sets the last error code Syntax void pac_SetLastError DWORD errno Parameters errno in Specifies the last error code Return Values None Examples None Remarks Applications can retrieve the value saved by this function by using the pac_SetLastError function The use of pac_SetLastError is optional an application can call it to find out the specific reason for a function failure WinPAC
29. INTR_DONE D c Enablelotlnteruptioslot false pac_ UnregisterSlotinterrupt Slot WinPAC Standard API User Manual WinCE based eVC amp NET Supported Modules The following shows the overview of the interrupt functions which are available with WinPAC Functions Models WP 8x4x WP 8x3x WP 8x5x WP 5xxx VP 25Wx VP 23Wx VH 25Wx pac_EnableSlotinterrupt Y pac_GetSlotInterruptEvent Y pac_GetSlotlnterruptID Y pac_InterruptDone Y ES ES m pac_Interruptlnitialize Y po pac_RegisterSlotInterrupt k e pac_SetSlotInterruptEvent Y EN BER BER pac_SetSlotInterruptPriority Y pac_SetTriggerType Y Y Y Y Y Y Y Y Y Y Y pac_UnregisterSlotlnterrupt Y WinPAC Standard API User Manual WinCE based eVC amp NET A Function List The following functions are used to retrieve or set interrupt functions Function Description This function performs hardware operations necessary to enable the specified hardware interrupt This function performs hardware operations necessary to enable the specified hardware interrupt This function performs hardware operations necessary to enable the specified hardware interrupt This function performs hardware operations necessary to enable the specified hardware interrupt pac_EnableSlotlnterrupt This function retrieves the slot event handle which registered by pac_Interruptlnitialize pac_GetslotInterruptID This function retrieves the
30. Modules WP 8x4x WP 8x3x WP 8x5x WP 5xxx VP 25Wx VP 23Wx VH 25Wx pac_GetBPTimerTimeTick_ms pac_GetBPTimerTimeTick_us pac_SetBPTimer pac_SetBPTimerOut pete tye te rl Te ae Te PT eT Function List The following functions are used to retrieve or set backplane timer functions Function Description This function returns the number of milliseconds since pac_GetBPTimerTimeTick_ms the device booted excluding any time that the system was suspended This function returns the number of microsecond since pac_GetBPTimerTimeTick_us the device booted excluding any time that the system was suspended This function kills the timer event identified by type set ac_KillBPTimer ES by an earlier call to pac_SetBP Timer This function installs a hardware timer A time out value is specified and every time a time out occurs pac_SetBP Timer the system posts an interrupt signal to the system and the pass the message to an application defined callback function The timerout pin on each slot will be triggered while a timerout signal has been outputted The timeourput pin can be used to acquire the synchronized data on each slot pac_SetBPTimerOut WinPAC Standard API User Manual WinCE based eVC amp NET 195 10 1 pac _GetBPTimerTimeTick_ms This function returns the number of milliseconds since the device booted excluding any time that the system was suspended Syntax DWORD pac_GetBPTimerTimeTick_ms void
31. O_READ_TOTAL_TIMEOUT 2 CTO_WRITE_TOTAL_TIMEOUT 3 Return Values None WinPAC Standard API User Manual WinCE based eVC amp NET E Examples feVC HANDLE hPort DWORD mes hPort uart_Open COM3 9600 N 8 1 mes 300 uart_SetTimeOut hPort mes CTO_TIMEOUT ALL uart_Close hPort C IntPtr hPort uint mes hPort WinPAC uart_Open COM3 9600 N 8 1 mes 300 WinPAC uart_SetTimeOut hPort mes 0 WinPAC uart_Close hPort WinPAC Standard API User Manual WinCE based eVC amp NET TT Remarks CTO READ_TOTAL_TIMEOUT A constant used to calculate the total time out period for read operations in milliseconds A value of zero for the CTO READ TOTAL TIMEOUT indicates that total time outs are not used for read operations CTO WRITE TOTAL_TIMEOUT A constant used to calculate the total time out period for write operations in milliseconds A value of zero for the CTO WRITE TOTAL TIMEOUT indicates that total time outs are not used for write operations CTO _READ_RETRY_TIMEOUT A constant used to calculate the time out period for read operations in system tick count CTO_TIMEOUT_ALL A constant used to calculate the total time out period for write and read operations in milliseconds A value of zero for the CTO TIMEOUT ALL indicates that total time outs are not used for write and read operations WinPAC Standard API User Manual WinCE based eVC amp NET WER 9 PAC_IO API Ad
32. RD pac_RegCountValue LPCTSTR KeyName Parameters kKeyName in Specific the path of registry key which you want to count Return Values Return the number of values associated with the key Examples eVC DWORD i i pac_RegCountValue TEXT HKEY_USERS myKey C uint i i WinPAC pac_RegCountValue HKEY_USERS myKey WinPAC Standard API User Manual WinCE based eVC amp NET eso 7 3 pac_RegCreateKey This function creates the specified registry key Syntax bool pac_RegCreateKey LPCTSTR KeyName Parameters kKeyName in Specific the path of registry key which you want to create Return Values Return true if success otherwise false To get an error code call pac_GetLastError A nonzero error code defined in PACERROR h indicates failure To get a generic description of the error call pac_GetErrorMessage The message resource is optional therefore if you call pac_GetErrorMessage it could fail Examples eVC bool ret ret pac_RegCreateKey TEXT HKEY USERS myKey WinPAC Standard API User Manual WinCE based eVC amp NET E C bool ret ret WinPAC pac_RegCreateKey HKEY USERS myKey WinPAC Standard API User Manual WinCE based eVC amp NET CR 7 4 pac_RegDeleteKey This function deletes a named subkey from the specified registry key Syntax bool pac_RegDeleteKey LPCTSTR KeyName Parameters
33. Standard API User Manual WinCE based eVC amp NET 205 12 MISC API Supported Modules The following shows the overview of the misc functions which are available with WinPAC Functions Modules WP 8x4x WP 8x3x WP 8x5x WP 5xxx VP 25Wx VP 23Wx VH 25Wx m me E E Function List The following functions are used to retrieve or set misc functions Function Description AnsiString This function can convert unicode string to ansi byte array pac_AnsiToWideString This function can convert ansi string to unicode string pac_DoEvents This function marshals the case to handle the other events pac_WideString ToAnsi This function can convert ansi byte array to unicode string WideString This function can convert unicode string to ansi string WinPAC Standard API User Manual WinCE based eVC amp NET 206 12 1 AnsiString This function can convert unicode string to ansi byte array Syntax byte AnsiString in string str Parameters Str in A pointer to a buffer that stores unicode string Return Values Return ansi byte array Examples C byte result new byte 32 IntPtr hPort WinPAC uart_Open COM1 WinPAC pac_ChangeSlot Convert ToByte 1 WinPAC uart_SendCmd hPort WinPAC AnsiString 00M result string str WinPAC WideString result Remarks In NET if we want to convert a Unicode string to ANSI or vice versa we should convert through byte array WinPAC S
34. T HKEY USERS myKey WinPAC Standard API User Manual WinCE based eVC amp NET 106 C bool DE viet bExist WinPAC pac_RegKeyExist HKEY_ USERS myKey WinPAC Standard API User Manual WinCE based eVC amp NET ma 7 12 pac_RegSave This function writes all the attributes of the specified open registry key into the registry Syntax bool pac_RegSave LPCTSTR KeyName Parameters kKeyName in Handle to a currently open key or one of the following predefined reserved handle values HKEY_CLASSES_ROOT HKEY_CURRENT_USER HKEY LOCAL MACHINE HKEY_USERS Return Values Return true if success otherwise false To get an error code call pac_GetLastError A nonzero error code defined in PACERROR h indicates failure To get a generic description of the error call pac_GetErrorMessage The message resource is optional therefore if you call pac_GetErrorMessage it could fail WinPAC Standard API User Manual WinCE based eVC amp NET 108 Examples eVC bool ret ret pac_RegSave TEXT HKEY USERS C bool ret ret WinPAC pac_RegSave HKEY_ USERS WinPAC Standard API User Manual WinCE based eVC amp NET WER 7 13 pac_RegSetString This function assigns the specified registry key data whose type is string Syntax bool pac_RegsSetString LPCTSTR KeyName LPCTSTR assignStr DWORD dwLength Parameters KeyName in Specific the path of r
35. TimeOut This function sets the time out timer WinPAC Standard API User Manual WinCE based eVC amp NET mike 8 1 uart_BinRecv This function is applied to receive the fix length response The length of the receiving response is controlled by the Parameters in en The difference between this function and uart_Recv is that uart_BinRecv terminates the receiving process by the string length in_Len instead of the character CR Carry return Therefore this function can be used to receive the response string data with or without null character under the consideration of receiving length Besides because of this function without any error checking mechanism checksum CRC LRC etc users have to remove the error checking information from the raw data by themselves if communication checking system is used Syntax bool uart_BinRecv HANDLE hPort LPSTR buf DWORD in_Len Parameters hPort in Handle to the open COM port buf out A pointer to a buffer that receives the data in_Len in The length of result string Return Values 1 indicates success O indicates failure WinPAC Standard API User Manual WinCE based eVC amp NET iia Examples feVC bool ret HANDLE hPort char buf 2 hPort uart_Open COMS8 9600 N 8 1 ret uart_BinSend hPort AB 2 ret uart_BinRecv hPort buf 2 uart_Close hPort C bool ret IntPtr hPort byte buf new byte 100
36. a We ee le E 104 7 11 pa HReghevt viet 106 7 12 DAC ROO SAV 6 iwisiccicciedecinscactienetiacnieeinixeedncindaentxgndeaategndaeadecadecadagededadedeiecateamenntadeceasied 108 L e al 82 6 218 hoo ho e EE 110 Ken e ee RE 112 WinPAC Standard API User Manual WinCE based eVC amp NET 8 UART API 8 1 uart BINRECV 00 ccc ccccecccceceeceeeeeeeeeeeeeeeesueeeceeeeeeuueeeeeeneeneaeeeeeeusauaueaeeeeneeeeaesaes 118 8 2 uart A 0 eseneneneenenenernnnnnrnrnnrnrrrrnnnneninintentrintn rentrant nunun annene annuere nanana nenas 120 8 3 Uart BINS OM IG ME 122 oA Uan ge 124 8 5 uart Ee E ee TE EE 126 Oe Wear STA S12 E 128 8 7 art 210 BE NEE 130 Co CH dE ee E E 132 8 9 uart RECOV oo ccccccccccccccceceeeeseeeeeeeeeeeeeeeeeueneeueeeeeeegeeueaeeeeeeeeueaeeaeeeeeeuaueaeeeeeeeeeeaesass 135 8 10 uart Geng 137 od E CG EE 139 E gg Ed on Ur ro EE 141 8 13 Fm 129 16 1 0 Mapee rene re On ee ee ee eee 143 9 PAC_IO API Os MG IS ae EC HE 151 JePe I AICI A E 153 Jope Gor DILE EE 155 JAP lear IO ER 157 OD OAC GS IB EE 159 GE GING A d E 161 G ste Tel TH BEEN 163 9 8 pac_ReadAlAllHex ccccccscccsececsecenseseesecessecensesesesessesessesenesensusensesenseseneases 165 So i paG g 212 8 44 gt EE 167 Opa e TEE 169 WinPAC Standard API User Manual WinCE based eVC amp NET ee OFT 1s DAG TCG OG CN WE 171 O12 Dae REAUGN FOV SMIOW EE 173 Gab erte PROADA 175 O
37. ac_RefreshWatchDog This function refreshes the watchdog pac_SetWatchDogTime This function specifies the watchdog time WinPAC Standard API User Manual WinCE based eVC amp NET in 5 1 pac_DisableWatchDog This function turns off the watchdog operation Syntax void pac_DisableWatchDog int wat Parameters WDT in Specifies the Watchdog type WINpac_WDT_HW 0 WINpac_WDT_ OS 1 Return Values None Examples eVC pac_DisableWatchDog WINpac_WDT_ OS C WinPAC pac_DisableWatchDog 1 WinPAC Standard API User Manual WinCE based eVC amp NET EE 5 2 pac_EnableWatchDog This function turns on the watchdog operation Syntax bool pac_EnableWatchDog int wat DWORD value Parameters WDT in Specifies the Watchdog type WINpac_WDT_HW 0 WINpac_WDT_OS 1 millisecond in Specifies the watchdog time Return Values Return true if success otherwise false To get an error code call pac_GetLastError A nonzero error code defined in PACERROR h indicates failure To get a generic description of the error call pac_GetErrorMessage The message resource is optional therefore if you call pac_GetErrorMessage it could fail WinPAC Standard API User Manual WinCE based eVC amp NET iian Examples eVC DWORD millisecond 1000 bool ret ret pac_EnableWatchDog WINpac_WDT_ OS millisecond C uint millisecond 1000 bool ret_err ret_err WinPAC pa
38. ack_proc do something Pac_InterruptDone slot return 1 if return 0 SDK will do pac_InterruptDone automatically else return 1 users should do pac_InterruptDone by themselves if nedded void ClntrDig OnButton1 pac_RegisterSlotInterrupt slot slot_callback_proc pac_EnableSlotinterrupt slot true enable slot interrupt void ClntrDIg OnButton2 pac_EnableSloitinterrupt slot false disable slot interrupt pac_UnregisterSlotinterrupt slot A unregister slot interrupt Remarks To see more information please reference user manual Chapter 5 API and Demo Reference WinPAC Standard API User Manual WinCE based eVC amp NET 60 4 Memory Access API Memory operations include basic management operations such as reading from and writing to the EEPROM or SRAM The following topics describe how you can read or write data programmatically using the memory functions Supported Modules The following shows the overview of the memory access functions which are available with WinPAC Functions Modules WP 8x4x WP 8x3x WP 8x5x WP 5xxx VP 25Wx VP 23Wx VH 25Wx mome a erame 1 emmen o e o e ee ete pac_EnableEEPROM A WP 5xxx only supports the memory type 1 EEPROM not type 0 SRAM Function List The following functions are used to retrieve or set memory access functions Function Description pac_GetMemorySize This function retrieves the size of the specified memory
39. ame slot WinPAC Standard API User Manual WinCE based eVC amp NET mi 1 10 pac_GetOSVersion This function retrieves the OS version Syntax void pac_GetOSVersion LPSTR os version Parameters OS Version out Retrieves the OS version of the WinPAC Return Values Return a nonzero value if successful otherwise false Examples eVC char OS 32 pac_GetOSVersion OS C string OS OS WinPAC pac_GetOSVersion WinPAC Standard API User Manual WinCE based eVC amp NET 1 11 pac_GetRotarylID This function retrieves the rotary switch ID Syntax int pac_GetRotaryID Parameters None Return Values Return the position of the rotary switch Examples feVC int RotarylD RotaryID pac_GetRotaryID C int RotarylD RotaryID WinPAC pac_GetRotaryID WinPAC Standard API User Manual WinCE based eVC amp NET om 1 12 pac_GetSerialNumber This function retrieves the serial number Syntax void pac_GetSerialNumber LPSTR SerialNumber Parameters SerialNumber out Retrieves the serial number of the WinPAC Return Values None Examples eVC char SN 32 pac_GetSerialNumber SN C string SN SN WinPAC pac_GetSerialNumber WinPAC Standard API User Manual WinCE based eVC amp NET 30 1 13 pac_GetWinPacNetVersion This function retrieves the version of the W
40. apter are not applicable for WP 5xxx series Supported Modules The following shows the overview of the backplane functions which are available with WinPAC Functions Modules WP 8x4x WP 8x3x WP 8x5x WP 5xxx VP 25Wx VP 23Wx VH 25Wx pac_RegistryHotPlug Beta testing pac_UnregistryHotPlug Beta testing WinPAC Standard API User Manual WinCE based eVC amp NET Function List The following functions are used to retrieve or set backplane functions Function Description pac_GetSlotCount This function retrieves the number of slot pac_RegistryHotPlug This function registers the registry after turning on the hot Beta testing plug pac_UnregistryHotPlug This function deletes the registry key after turning off the hot Beta testing plug WinPAC Standard API User Manual WinCE based eVC amp NET WE 2 1 pac_EnableRetrigger This function decides the retrigger turning on or not Syntax void pac_EnableRetrigger BYTE iValues Parameters Values in Decide turning on or not Return Values None Examples None WinPAC Standard API User Manual WinCE based eVC amp NET 36 2 2 pac_GetBackplanelD This function retrieves the backplane ID Syntax void pac_GetBackplanelD LPSTR backplane_version Parameters backplane_version out the pointer to a buffer to receive the backplane version Return Values None Examples eVC char Backplane 32
41. based eVC amp NET Tr Although user can use UART API to set and read values for high profile 87K series modules we provide a more convenient API to do it Please refer Section 9 PAC_IO API Use these functions of this section to communicate with external devices by I 811xW I 814xW serises modules Any serial devices connected with COM port H P _1 7000 or __1 87K4 5 8 9 A e ei To see more information please reference user manual Chapter 5 API and Demo Reference WP 5000 The WP 5000 series has no slots for plugging the high profile I 8K and I 87K series but the UART API on this section can also be used for COM1 COM2 COMS8 of WP 5000 series In addition of COM1 COM2 COMs all of the functions can be used to communicate with external device by XW5xxx expansion board To see more information please reference user manual Chapter 5 API and Demo Reference WinPAC Standard API User Manual WinCE based eVC amp NET WER Supported Modules The following shows the overview of the uart functions which are available with WinPAC Functions Models WP 8x4x WP 8x3x WP 8x5x WP 5xxx VP 25Wx VP 23Wx VH 25Wx uart_BinRecv Py fy v fy iy uart_BinSend py v fy iy iy uart_BinSendCmd Py fy joy fy oy uart_Close py v yyy uart_EnableCheckSum Py fy joy fy y uart GetDataSize Py fy joy fy y uart_GetLineStatus py fy yyy uart_Open py v iv jy fy uart_Recv Py v ow fv fy uart_Send py v fy iy y uart_SendCmd Py fy vy fv f
42. buffer that receives the value s data Return Values Return true if success otherwise false To get an error code call pac_GetLastError A nonzero error code defined in PACERROR h indicates failure To get a generic description of the error call pac_GetErrorMessage The message resource is optional therefore if you call pac_GetErrorMessage it could fail WinPAC Standard API User Manual WinCE based eVC amp NET eros Examples feVC bool ret DWORD index 0 TCHAR strName 10 ret pac_RegGetValueBylndex TEXT HKEY_USERS myKey index strName C bool ret uint index 0 string strName new String 0 10 ret WinPAC pac_RegGetValueByIndex HKEY USERS myKey index strName WinPAC Standard API User Manual WinCE based eVC amp NET 105 7 11 pac_RegKeyExist This function determinants the specified registry key exist or not Syntax bool pac_RegKeyExist LPCTSTR KeyName Parameters kKeyName in Specific the path of registry key which you want to check whether it exists or not Return Values Return true if success otherwise false To get an error code call pac_GetLastError A nonzero error code defined in PACERROR h indicates failure To get a generic description of the error call pac_GetErrorMessage The message resource is optional therefore if you call pac_GetErrorMessage it could fail Examples eVC bool DE viet bExist pac_RegKeyExist TEX
43. c_EnableWatchDog 1 millisecond Remarks The hardware watchdog second Parameters is a value which is between 0 31 unit A unit is about 200 milliseconds 0 means the shortest timeout otherwise 31 is longest WinPAC Standard API User Manual WinCE based eVC amp NET TT 5 3 pac _GetWatchDogState This function retrieves the watchdog state Syntax bool pac_GetWatchDogState int wat Parameters WDT in Specifies the Watchdog type WINpac_WDT_HW 0 WINpac_WDT_ OS 1 Return Values The return value specifies the watchdog state lf turning on return true otherwise false Examples eVC bool bState bState pac_GetWatchDogstate WINpac_WDT_OS WinPAC Standard API User Manual WinCE based eVC amp NET O75 C bool bState bState WinPAC pac_GetWatchDogState 1 WinPAC Standard API User Manual WinCE based eVC amp NET mm 5 4 pac_GetWatchdogTime This function retrieves the watchdog time Syntax DWORD pac_GetWatchDogTime int wat Parameters WDT in Specifies the Watchdog type WINpac_WDT_HW 0 WINpac_WDT_ OS 1 Return Values The return value is the watchdog time which has been assigned by pac_EnableWatchDog or pac_SetWatchDog Time Examples eVC DWORD dwTime dwTime pac_GetWatchDogTime WINpac_WDT_ OS WinPAC Standard API User Manual WinCE based eVC amp NET mt C uint uTime uTime WinPAC pac_GetWatchDogTime 1
44. ceeceeseeeeeaeeeeseeeeeceeeeeseeeeeseeeesseeeesseeesseeeesaeees 19 1 6 pac CCIW ACA ele TE 20 e le GENEP ET 22 LEE GOIMOGUIG NING ics sss cs cscs snes cscs ne pene ageet EEA EEKE ERA EENEN RASER 24 29 ae Get Oe ele EN Ke 26 1 10 pac_GetOSVersion Peeeeeee nner ener eer eRe ener eee ee eee 28 IEP lege Ee CT UR ene E E E T E 29 1 12 pac_GetSerialNumber cccccccccceececseeeeeeeeeeseeeeeseeeeeseeeeeseeesseeeesseeeesseeeesaaeees 30 1 13 pac _GetWinPacNetVersion cccccccccssecccseececeeeeeceeeeeseeeeseeeesseeeesseeesseeeesaeeees 31 1 14 pac GetWinPacSDKVEr SION seerideneseinyannaana annee eneee EEEE EENEN EIENEN 32 BTD FREDO C0 EE 33 2 Backplane API Be lis AG Ee Erd Le Le 36 WinPAC Standard API User Manual WinCE based eVC amp NET CR 2 2 DaC GeIBACKDIANC ID ccs cecexesevexacasievenapereuecepsscucneteretewateieusieveesuerebeuetesentteuseeuesee lt eee 37 2 0 DAC EE EE 38 aa e e RI eo 6 BEE 40 2 Os aC EE e LE Tu e a E E E 41 2 6 pac_RegistryHotPlug Beta testng 42 2 pac_UnregistryHotPlug Beta testing cccccecesssceesesesseseesesenseeessesensesensesenees 43 3 Interrupt API 3 1 pac _EnableSlotilnterrupt ccc ccccccsecceceeeeeceeeeseeeeeseeeeseeeeesseesesseeeesseeeesseeesaees 47 32 aC Gel IOMMIle hm IIE ee 49 3 3 pac _GetSlotinterruptlD cece cceeeeceeeeeeee cesses eeeseeeeeseeeesseeeesseeeessaeeesaeeesaees 50 3 4 pac_lnterruptDOone ccc ceecceeccceeecee
45. ditionally some of those properties offer access to the environment around the device such as ambient brightness or atmospheric pressure PAC_IO API supports to operate IO modules not only in slot but in Remote mode Besides these API support for 8K or 87K modules Following lets show how we could use these API for local and remote Local IO in slot iy H We Ww i N Local O Function ji f Bit E Il eh d KL In the local mode the slot range is from 0 to 7 the same the iSlot as follow hPort WinPAG uart_Open 3 fclear DO Ee Se WinPAC pac_WriteDO hPort iSlot Do_Totalch 6 De eene eer gi WinPAC Standard API User Manual WinCE based eVC NEI 146 Remote Se fa emote O Function lf remote mode the address need call a macro PAC_ REMOTE IO And its range is from 0 to 255 For example as follow Z Write DO value to the remote module Handle hPort WinPAC uart_Open Connectionstring if thPort AfshessageBox _ T Open Com Error Lem B lleg WinPAC pac_WriteDo hPort WinPAy PAC_REMOTE_I0 iAddr m_iDOCHs 1D0_Ualue kg To see more information please reference user manual Chapter 5 API and Demo Reference WinPAC Standard API User Manual WinCE based eVC amp NET pea Supported Modules The following shows the overview of the PAC_IO functions which are available with WinPAC Functions Models WP 8x5x WP 5xxx VP 25Wx VP 23Wx VH 25W
46. e pac_RegGetKeyBylndex This function retrieves the type of specified index of registry key pac_RegGetString This function retrieves value of the specified registry key This function retrieves the value of specified index of registry key pac_RegGetKeyInfo pac_RegGetValueBylndex This function determinants the specified registry key exist ac ReqKeyExist pan ene or not This function writes all the attributes of the specified open ac RegSave pac_heg registry key into the registry This function assigns the specified registry key data whose RegsSetsStri ee eee type is string This function assigns the specified registry key data whose type is DWORD pac_RegSetDWORD WinPAC Standard API User Manual WinCE based eVC amp NET WE 7 1 pac_RegCountKey This function retrieves the specified registry key which has how many sub keys Syntax DWORD pac_RegCountKey LPCTSTR KeyName Parameters kKeyName in Specific the path of registry key which you want to count Return Values Return the number of subkeys contained by the specified key Examples eVC DWORD i i pac_RegCountKey TEXT HKEY USERS myKey C uint i i WinPAC pac_RegCountKey HKEY_USERS myKey WinPAC Standard API User Manual WinCE based eVC amp NET eso 7 2 pac_RegCountValue This function retrieves the specified registry key which has how many values Syntax DWO
47. e WinPAC Standard API User Manual WinCE based eVC amp NET ECE Examples feVC HANDLE hPort hPort uart_Open COMO0 115200 N 8 1 BYTE iSlot 0 int iChannel 2 int AN TotalCh 8 float fValue bool ret pac_ReadAl hPort iSlot iChannel iAl_ TotalCh amp fValue uart_Close hPort C IntPtr hPort hPort WinPAC uart_Open COMo0 115200 N 8 1 byte iSlot 0 int iChannel 2 int AN TotalCh 8 float fValue new float bool ret WinPAC pac_ReadAl hPort iSlot iChannel iAl_ TotalCh ref fValue WinPAC uart_Close hPort Remarks The function can support for Local or Remote When the module is local the second Parameters s range is from 0 to 7 If remote the second Parameters need use the macro pac REMOTE _ IO Address which Address is from 0 to 255 WinPAC Standard API User Manual WinCE based eVC amp NET WR 9 7 pac_ReadAlAIll This function reads all the Al values of all channels in engineering mode of the Al module Syntax bool pac_ReadAlAll HANDLE hPort int slot float fValue Parameters hPort in the serial port HANDLE opened by uart_Open iSlot in The slot in which module is to receive the command Default is local lf the IO module is remote please use the macro pac_REMOTE_IO 0 255 fValue out The array contains the Al values that read back from the Al module Return Values Return true if success otherwise false WinPA
48. e second parameters s range is from 0 to 7 If remote the second parameters need use the macro PAC REMOTE _IO Address which address if from 0 to 255 WinPAC Standard API User Manual WinCE based eVC amp NET RE 9 17 pac_ReadDIOLatch This function reads the latch values of the DI and DO channels of the DIO module Syntax bool pac_ReadDIOLatch HANDLE hPort int slot int iDI_TotalCh int iDO TotalCh int iLatchType DWORD IDI_Latch_Value DWORD IDO_Latch_Value WinPAC Standard API User Manual WinCE based eVC amp NET met Parameters hPort in the serial port HANDLE opened by uart_Open iSlot in The slot in which module is to receive the command Default is local lf the IO module is remote please use the macro pac_REMOTE_IO 0 255 iDIL_TotalCh in The total number of the DI channels of the DIO module IDO_TotalCh in The total number of the DO channels of the DIO module iLatch Type in The type of the latch value read back IDI_Latch_ Value out The pointer to the DI latch value read back 1 latched high status 0 latched low status IDO_Latch_ Value out The pointer to the DO latch value read back Return Values Return true if success otherwise false WinPAC Standard API User Manual WinCE based eVC amp NET 184 Examples eVC HANDLE hPort hPort uart_Open COMO0 115200 N 8 1 BYTE iSlot 0 int DI TotalCh 8 int UDO TotalCh 8 int iLatchT
49. ecksum Syntax void uart EnableCheckSum HANDLE hPort bool bEnable Parameters hPort in Handle to the open COM port bEnable in Decide the check sum turning on or not Default is disabling Return Values None WinPAC Standard API User Manual WinCE based eVC amp NET mie Examples feVC HANDLE hPort hPort uart_Open COM3 9600 N 8 1 uart_EnableCheckSum hPort true uart_Close hPort C IntPtr hPort hPort WinPAC uart_Open COM3 9600 N 8 1 WinPAC uart_EnableCheckSum hPort true WinPAC uart_Close hPort WinPAC Standard API User Manual WinCE based eVC amp NET a 8 6 uart_GetDataSize This function retrieves the number of bytes received by the serial provider but not yet read by a uart_Recv operation or of user data remaining to transmit for write operations Syntax BOOL uart_GetDataSize HANDLE hPort int data_type Parameters hPort in Handle to the open COM port data_type in A value specifies to retrieve in or out buffer This Parameters can be following values define IN DATA 0 define OUT DATA 1 Return Values The number of bytes in out buffer but not yet read write WinPAC Standard API User Manual WinCE based eVC amp NET roe Examples feVC char buf 1024 DWORD in Len HANDLE hPort uart_Open COM1 9600 N 8 1 in_Len uart_GetDataSize hPort IN_DATA BOOL ret uart_BinRecv hPort buf in_Len ua
50. ed eVC amp NET o Return Values Return true if success otherwise false To get an error code call pac_GetLastError A nonzero error code defined in PACERROR h indicates failure To get a generic description of the error call pac_GetErrorMessage The message resource is optional therefore if you call pac_GetErrorMessage it could fail Examples eVC bool ret DWORD address 0 BYTE Buffer 2 ret pac_ReadMemory address Buffer 2 WINpac_MEM SRAM C bool ret uint address 0 byte Buffer new byte 2 ret WinPAC pac_ReadMemory address Buffer 2 0 Remarks The input range size of EEPROM doesn t exceed 8K The architecture of EEPROM is as following O Ox1FFF 8k for users Ox2000 0 x 3FFF 8k for reserve The input range size of SRAM only 0 Ox6FFFF 448k Another 64K of SRAM is system reserved WinPAC Standard API User Manual WinCE based eVC amp NET e 4 3 pac_WriteMemory This function stores data in the specified memory Syntax bool pac_WriteMemory DWORD address LPBYTE lpBuffer DWORD dwLength int mem_type Parameters address in Specifies the memory address where write from loBuffer in A pointer to the buffer containing the data to be written to the memory dwLength in Number of characters to be written mem_type in Handle to a currently type memory WINpac_MEM_SRAM 0 WINpac_MEM EEPROM 1 Note WP 5xxx series doesn t support SRAM WinPAC
51. eeneeeceeeceeeeseeeseeeseueeseeeseeeseueesseeseeeeueeneeeseeesaes 51 9 9 Lee E Di ele UK 53 3 6 Dap REGISISrSIOLUMISI MUON eege 54 Oa Dae EENEG 56 IS aC elo Olle UDI ea E E 57 3 9 DAC SOT ING GS E 58 So NO Dae egal Eege Die dE 59 4 Memory Access API dte WAC E un ele KE 62 4 2 pa ReadMemMOry E 64 BO AG NONONO aere EE EEE ENA 66 4 4 oac EnabletEDOM 68 5 Watchdog API 5 1 pac_DisableWatchDog n nnnennnennnnnnennnennnennnnnennrnnnrnrrrnresnrrnrrnrrrnrrrnnrrnrennrrenrrnnenne 72 WinPAC Standard API User Manual WinCE based eVC amp NET mmm SE e Ee ENADICVV AIG MI OG erreser penskar erener rre N ET ENEKE RENON ENNE KE EENE 73 5 3 Da GtVV FICN DOG e CN 75 oA eye ome i E Nee e Let Nr E 77 Dio Dac eile shiv Val Cll OO E 79 5 6 pDac GetWaichloglme 80 6 microSD Management API Bete AG RE Sls aa 83 SE P Re a 84 SRC Dee RE e E 85 6 4 PAC GDUnmount cece ceccccceecceceeeeeeeeeesaeeeeseeeeeseaeceseeeeeseeeesseesesseeeesseeessneessaaes 86 7 Registry API 7 1 Tee Le ln d 89 TEAC e Le le 90 7 3 pac_RegCreateKey ccccceccccsecccceeeeeceeeeeceeeeeseeceeseeesseeeesseeesseeeessaeeesseeeeseeeesas 91 7 4 poac Heglieleiehey 93 7 5 pac_RegDeleteValue cccccccescccececseeceeeceececeeeseueccacesseeseueeceeeseeesegeeneeeseesseesens 95 LoDE e ELE RT KE 97 ent e E 98 723 DAC IASG GU ne aaa 100 Fee OAC TOO Ae ot ersinnen akena niaaa nanain paaien eain aani iaaii 102 n
52. egistry key which you want to assign data assignStr in Specific the data dwLength in Specific the size of data Return Values Return true if success otherwise false To get an error code call pac_GetLastError A nonzero error code defined in PACERROR h indicates failure To get a generic description of the error call pac_GetErrorMessage The message resource is optional therefore if you call pac_GetErrorMessage it could fail WinPAC Standard API User Manual WinCE based eVC amp NET anii Examples eVC bool ret ret pac_RegSetString TEXT HKEY USERS myKey value TEXT Hello exe 2 wcslen TEXT Hello exe sizeof T CHAR 2 C bool ret ret WinPAC pac_RegSetString HKEY_USERS myKey value Hello exe 2 uint Hello exe Length WinPAC Standard API User Manual WinCE based eVC amp NET amiji 7 14 pac_RegSetDWORD This function assigns the specified registry key data whose type is DWORD Syntax bool pac_RegSetDWORD LPCTSTR KeyName DWORD assignVal Parameters KeyName in Specific the path of registry key which you want to assign data assignStr in Specific the data Return Values Return true if success otherwise false To get an error code call pac_GetLastError A nonzero error code defined in PACERROR h indicates failure To get a generic description of the error call pac_GetErrorMessage The message resource is optional there
53. en COMO0 115200 N 8 1 BYTE iSlot 0 int iValue 8 bool ret pac_ReadAlAllHex hPort iSlot iValue uart_Close hPort C IntPtr hPort hPort WinPAC uart_Open COMO 115200 N 8 1 byte iSlot 0 int iValue new int 8 bool ret WinPAC pac_ReadAlAllHex hPort iSlot Value WinPAC uart_Close hPort Remarks The function can support for Local or Remote When the module is local the second Parameters s range is from 0 to 7 If remote the second Parameters need use the macro pac REMOTE _IO Address which Address is from 0 to 255 WinPAC Standard API User Manual WinCE based eVC amp NET 166 9 9 pac _ReadAlHex This function reads the 2 s complement mode Al value of the Al module Syntax bool pac_ReadAlHex HANDLE hPort int slot int Channel int A TotalCh int iValue Parameters hPort in the serial port HANDLE opened by uart_Open iSlot in The slot in which module is to receive the command Default is local lf the IO module is remote please use the macro pac_REMOTE_IO 0 255 iChannel in Read the Al value from the channel IAl_TotalCh in The total number of the Al channels of the Al module Value in The pointer to the Al value that is read back from the Al module Return Values Return true if success otherwise false WinPAC Standard API User Manual WinCE based eVC amp NET Te Examples feVC HANDLE hPort hPort uart_Ope
54. etSlotCount C int wSlot wSlot WinPAC pac_GetSlotCount WinPAC Standard API User Manual WinCE based eVC amp NET Oon 2 6 pac_RegistryHotPlug Beta testing This function registers the registry after turning on the hot plug Syntax void pac_RegistryHotPlug DWORD hWnd DWORD msgID Parameters hWnd in User specifies the handle ID Return Values None Examples None WinPAC Standard API User Manual WinCE based eVC amp NET CR 2 pac_UnregistryHotPlug Beta testing This function deletes the registry key after turning off the hot plug Syntax void pac_UnregistryHotPlug DWORD hWnd Parameters hWnd in User specifies the handle ID Return Values None Examples None WinPAC Standard API User Manual WinCE based eVC amp NET pas 3 Interrupt API Interrupt operations include basic management operations such as interrupt done enable and disable interrupt The following topics describe how you can operate interrupt programmatically using the interrupt functions Step 1 Set tigger type Program Start pac_SetTriggerType Slot type type 0 Rising edge 1 Level trigger 2 Falling edge Step 2 Install user callback function pac_RegisterSlotInterrupt Slot f Step 3 Set interrupt priority pac_SetSlotinterruptPriority Slot Priority Step 4 Enable Interrupt pac_EnableSlotIinterrupt Slot true int CALLBACK REO return PAC_
55. f the IO module is remote please use the macro pac REMOTE _lO 0 255 iChannel in The DO channel to change IDO_TotalCh in The total number of DO channels of the DO modules IBitValue in 1 is to turn on the DO channel 0 is off Return Values Return true if success otherwise false WinPAC Standard API User Manual WinCE based eVC amp NET ac Examples eVC HANDLE hPort hPort uart_Open COMO0 115200 N 8 1 BYTE iSlot 0 int iChannel 2 int UDO TotalCh 8 int iBitValue 1 bool ret pac_WriteDOBit hPort iSlot Channel iDO_TotalCh iBitValue uart_Close hPort C IntPtr hPort hPort WinPAC uart_Open COMO0 115200 N 8 1 byte iSlot 0 int iChannel 2 int UDO TotalCh 8 int iBitValue 1 bool ret WinPAC pac_WriteDOBit hPort iSlot Channel miDO_TotalCh iBitValue WinPAC uart_Close hPort Remarks The function can support for Local or Remote When the module is local the second Parameters s range is from 0 to 7 If remote the second Parameters need use the macro pac REMOTE _IO Address which Address is from 0 to 255 WinPAC Standard API User Manual WinCE based eVC amp NET RER 10 Backplane timer API Backplane timer API supports to hardware timer including timerout timer1 timer2 Supported Modules The following shows the overview of the backplane timer functions which are available with WinPAC Functions
56. fined Examples eVC byte slot 1 char strName 10 pac_GetModuleName slot strName WinPAC Standard API User Manual WinCE based eVC amp NET C byte slot 1 string strName int Module Type 0 ModuleType WinPac pac_GetModuleName slot ref strName Because of calling by reference you should add rer keyword For this API there are two overloading for NET First is above Another is below whose return value is Module Name not Module type byte slot 1 string strName strName WinPac pac_GetModuleName slot WinPAC Standard API User Manual WinCE based eVC amp NET 0025 1 9 pac_GetModuleType This function is used to retrieve the type of I O modules Syntax int pac_GetModule Type int slot Parameters slot in Specify the slot number where the I O module is plugged into Return Values None Examples eVC int slot 1 char strName 10 pac_GetModuleName slot strName WinPAC Standard API User Manual WinCE based eVC amp NET eee C byte slot 1 string strName int Module Type 0 ModuleType WinPac pac_GetModuleName slot ref strName Because of calling by reference you should add rer keyword For this API there are two overloading for NET First is above Another is below whose return value is Module Name not Module type byte slot 1 string strName strName WinPac pac_GetModuleN
57. fore if you call pac_GetErrorMessage it could fail Examples eVC bool ret ret pac_RegSetDWORD TEXT HKEY_USERS myKey value 40 WinPAC Standard API User Manual WinCE based eVC amp NET miian C bool ret ret WinPAC pac_RegSetDWORD HKEY_ USERS myKey value 40 WinPAC Standard API User Manual WinCE based eVC amp NET meine 8 UART API Uart operations include basic management operations such as opening sending receiving and closing The following topics describe how you can operate uart programmatically using the uart functions We provide several COM port functions uart_Send uart_Recv to communicate with ICPDAS modules High profile 87K series 811xW I 814xW series l 7000 series All the functions are based on standard COM port function in EVC CreateFile CloseHandle WriteFile ReadFile GetCommModemsStatus WP 8000 ViewPAC WinCE Use these functions of this section to communicate with 87K 87K module COMO For I 87K modules T Ei i j a E R E i i Gi CH kaa When a high profile l 87K is plugged in slot please call the function pac_ChangeSlot to change to the specific slot before doing other operations Please refer to demo 8 7k_Basic About I 87K commands DCON protocol please refer htto fto icodas com pub cd 8000cd napdos dcon io module 87k high profile modules bt m WinPAC Standard API User Manual WinCE
58. hPort WinPAC uart_Open COM3 9600 N 8 1 ret WinPAC uart_BinSend hPort WinPAC AnsiString AB 2 ret WinPAC uart_Recv hPort buf WinPAC uart_Close hPort Remarks Note that this function is usually applied to communicate with the other device but not for ICPDAS DCON I 7000 8000 87K series modules WinPAC Standard API User Manual WinCE based eVC amp NET eis 8 2 uart_ BinSend Send out the command string by fix length which is controlled by the Parameters in_Len The difference between this function and uart_ Send is that uart_BinSend terminates the sending process by the string length in_Len instead of the character CR Carry return This function can send out command string with or without null character under the consideration of the command length Besides because of this function without any error checking mechanism Checksum CRC LRC etc users have to add the error checking information to the raw data by themselves if communication checking system is required Syntax bool uart_BinSend HANDLE hPort LPCSTR buf DWORD in_Len 1 Parameters hPort in Handle to the open COM port buf in A pointer to a buffer that send the data in_Len in The length of result string Return Values 1 indicates success O indicates failure WinPAC Standard API User Manual WinCE based eVC amp NET SEI Examples eVC bool ret HANDLE hPort char buf 2 buf 0
59. he message resource is optional therefore if you call pac_GetErrorMessage it could fail Examples eVC bool ret ret pac_RegDeleteValue TEXT HKEY USERS myKey value WinPAC Standard API User Manual WinCE based eVC amp NET ee C bool ret ret WinPAC pac_RegDeleteValue TEXT HKEY_ USERS myKey value Remarks The function could be used only in leaf key And the function pac_RegDeleteKey can be used in any registry key except leaf key If you would delete a leaf key you should call pac_RegDeleteValue WinPAC Standard API User Manual WinCE based eVC amp NET WC 7 6 pac_RegGetDWORD This function retrieves value of the specified registry key Syntax DWORD pac_RegGetDWORD LPCTSTR KeyName Parameters kKeyName in Specific the path of registry key Return Values Return the value of the specific key Examples eVC DWORD dwvValue dwValue pac_RegGetDWORD TEXT HKEY_USERS myKey value C uint uValue uValue WinPAC pac_RegGetDWORD HKEY_USERS myKey value WinPAC Standard API User Manual WinCE based eVC amp NET ov n 7 pac_RegGetKeyBylndex This function retrieves the name of specified index of registry key Syntax bool pac_RegGetKeyByIndex LPCTSTR KeyName DWORD dwindex LPTSTR lpName Parameters kKeyName in Specific the path of registry key dwlndex in Specific the index of registry key
60. icroSD Management API MicroSD operations include basic management operations such as mounting and unmounting The following topics describe how you can mount or unmount MicroSD programmatically using the memory functions Supported Modules The following shows the overview of the memory access functions which are available with WinPAC Functions Modules WP 8x4x WP 8x3x WP 8x5x WP 5xxx VP 25Wx VP 23Wx VH 25Wx pac_SDExists pac_SDMount pete trier ly BESSERES EES yy fy pmen v v vty ie ly Function List The following functions are used to retrieve or set memory access functions Function Description This function is used to check that the Micro SD whether has been pac_SDExists standby ready or not This function is used to mount Micro SD if the Micro SD has been pac_SDMount inserting to the device without mounting pac_SDOnside This function is used to check the Micro SD whether on side or not This function is used to dismount Micro SD if the Micro SD has pac_SDUnmount been mounted WinPAC Standard API User Manual WinCE based eVC amp NET 6 1 pac_SDExists This function is used to check that the Micro SD whether has been standby ready or not Syntax bool pac_SDExists Parameters None ReturnValues Returns TRUE if successful otherwise FALSE Examples feVC bool DE viet bExist pac_SDExists C bool DE viet bExist WinPAC pac_SDExists W
61. ifies which slot COM port map between backward compatible or not Return Values Return the index of COM port under the backward compatible if backward compatible is running Otherwise return the index of COM port in the normal mode Examples eVC int currentCOM current com port intnormalCOM com port index in normal mode currentCOM pac_GetMapCom normalCOM If the device is running on normal mode then the return value currentCOM equals normalCOM ex normalCOM 0 after this API the currentCOM O too Otherwise if the device is running on backward compatible mode then the return value currentCOM is backward compatible mapping index ex normalCOM 0 after this API the currentCOM 1 C int currentCOM int normalCOM currentCOM WinPAC pac_GetMapCom normalCOM WinPAC Standard API User Manual WinCE based eVC amp NET 1 8 pac_GetModuleName This function is used to retrieve the name of an 8000 series I O module which is plugged into a specific I O slot in the WinPac system This function supports the collection of system hardware configurations Syntax int pac_GetModuleName BYTE slot LPSTR strName Parameters slot in Specify the slot number where the I O module is plugged into strName out The pointer to a buffer to receive the name of the I O module Return Values Return 255 if the module is I 8K series module otherwise unde
62. inPAC Standard API User Manual WinCE based eVC amp NET ess 6 2 pac_SDMount This function is used to mount Micro SD if the Micro SD has been inserting to the device without mounting Syntax bool pac_SDMount LPTSTR szPartitionName Parameters szPartitionName in Name of the partition Example Hart ReturnValues Returns TRUE if successful otherwise FALSE Examples eVC bool ret ret pac_SDMount TEXT Part00 C bool ret ret WinPAC pac_SDMount Part00 WinPAC Standard API User Manual WinCE based eVC amp NET CH 6 3 pac SDOnside This function is used to check the Micro SD whether on side or not Syntax bool pac_SDOnside Parameters None ReturnValues Returns TRUE if successful otherwise FALSE Examples eVC bool ret ret pac_SDOnside C bool ret ret WinPAC pac_SDOnside WinPAC Standard API User Manual WinCE based eVC amp NET pe 6 4 pac SDUnmount This function is used to dismount Micro SD if the Micro SD has been mounted Syntax bool pac_SDUnmouni Parameters None ReturnValues Returns TRUE if successful otherwise FALSE Examples eVC bool ret ret pac_SDUnmouni C bool ret ret WinPAC pac_SDUnmount WinPAC Standard API User Manual WinCE based eVC amp NET em 7 Registry API Registry operations include basic management operations
63. inPacNet dll Syntax void pac_GetWinPacNetVersion LPSTR dll version Parameters OI version out Retrieves the version of the WinNetVersion Return Values None Examples eVC char DLL 32 pac_GetSWinPacNetVersion SDK C string WinPacNet WinPacNet WinPac pac_GetWinPacNetVersion WinPAC Standard API User Manual WinCE based eVC amp NET min 1 14 pac_GetWinPacSDKVersion This function retrieves the SDK version Syntax void pac_GetWinPacSDKVersion LPSTR sdk_version Parameters sdk_version out Retrieves the version of the WinPacSDK Return Values None Examples eVC char SDK 32 pac_GetWinPacSDKVersion SDk C string WinPacSDK WinPacSDK WinPAC pac_GetWinPacSDKVersion WinPAC Standard API User Manual WinCE based eVC amp NET 1 15 pac _Reboot This function reboots the device Syntax void pac_Reboot void Parameters None Return Values None Examples feVC pac_Reboot C WinPAC pac_Reboot WinPAC Standard API User Manual WinCE based eVC amp NET 2 Backplane API Backplane operations include hot plug interrupt and backplane information such as NET ID and backplane version The following topics describe how you can show the backplane information hot plug or interrupt operation programmatically using the backplane functions Note The functions on the ch
64. interrupt This function registers slot interrupt service route and turns on slot interrupt Syntax bool pac_RegisterSlotinterrupt BYTE slot pac CALLBACK_FUNC f Parameters slot in Specify the index of slot A callback function Return Values Return true if success otherwise false WinPAC Standard API User Manual WinCE based eVC amp NET 54 Examples eVC intslot 3 Mif slot is 3 int CALLBACK slot_callback_proc do something return 0 if return 0 SDK will do pac_InterruptDone automatically else return 1 users should do pac_InterruptDone by themselves if nedded void ClntrDIg OnButton 1 pac_RegisterSlotinterrupt slot slot_callback_proc pac_EnableSlotinterrupt slot true enable slot interrupt void ClntrDIg OnButton2 Pac_EnableSlotinterrupt slot false disable slot interrupt pac_UnregisterSlotinterrupt slot unregister slot interrupt Remarks To see more information please reference user manual Chapter 5 API and Demo Reference WinPAC Standard API User Manual WinCE based eVC amp NET WER 3 pac_SetSlotinterruptEvent This function allows a device driver to assign the slot event handle Syntax void pac_SetSlotinterruptEvent BYTE slot HANDLE hEvent Parameters slot in Specify the index of slot to retrieve the event handle hEvent in Event to be signaled Return Values None Examples None
65. ion of uart Send and uart_Recv The operation for sending a command is the same as uart_Send The operation for receiving a response is the same as uart_Recv Syntax bool uart_SendCmd HANDLE hPort LPCSTR cmd LPSTR szResult Parameters hPort in Handle to the open COM cmd in A pointer to a command szResult out A pointer to a buffer that receives the data Return Values 1 indicates success O indicates failure WinPAC Standard API User Manual WinCE based eVC amp NET WER Examples eVC Put an I 87K module in slot0 like I 87017W bool ret HANDLE hPort char buf 10 hPort uart_Open COMO0 115200 N 8 1 pac_ChangeSlot 0 ret uart_SendCmd hPort 00M buf 00M ask the device name DCON proctol for ICPDAS modules uart_Close hPort C bool ret IntPtr hPort byte buf new byte 100 hPort WinPAC uart_Open COMO 115200 N 8 1 00M ask the device name WinPAC pac_ChangeSlot 0 ret WinPAC uart_SendCmd hPort WinPAC AnsiString 00M buf 00M ask the device name DCON proctol for ICPDAS modules string result WinPAC WideString buf Replace 0 WinPAC uart_Close hPort Remarks This function will call PurgeComm to clear serial COM port output and input buffer WinPAC Standard API User Manual WinCE based eVC amp NET Perso 8 12 uart_SetTerminator This function sets the terminate characters Syntax v
66. is function reads the DI value of the DI module This function reads the counts of the DI channels of the DI pac_ReadDICNT maddie pac_ReadDILatch This function reads the DI latch value of the DI module pac_ClearDICNT pac_ClearDlOLatch pac_ReadAlAllHex pac_ReadCNT Overflow WinPAC Standard API User Manual WinCE based eVC amp NET WER This function reads the DI and the DO values of the DIO pac_ReadDIO modde This function reads the latch values of the DI and DO channels of the DIO module pac_ReadDO This function reads the DO value of the DO module pac_ReadDIOLatch pac_WriteAO This function writes the AO value to the AO modules pac_WriteDO This function writes the DO values to DO modules This function writes a single bit of value to the DO module ac_WriteDOBit EES that is only the channel corresponding to the bit is changed WinPAC Standard API User Manual WinCE based eVC amp NET 150 9 1 pac_ClearCNT This function clears the counter values of the counter frequency modules Syntax bool pac_ClearCNT HANDLE hPort int slot int Channel Parameters hPort in the serial port HANDLE opened by uart_Open iSlot in The slot in which module is to receive the command Default is local lf the IO module is remote please use the macro pac_REMOTE_IO 0 255 iChannel in The channel that clears the counter value back from the counter frequency module Re
67. is to turn on the DO channel 0 is off Return Values Return true if success otherwise false WinPAC Standard API User Manual WinCE based eVC amp NET 190 Examples eVC lf the module is remote HANDLE hPort hPort uart_Open COM2 9600 N 8 1 int total channel 8 DWORD do _value 3 turn on the channel 0 1 bool ret pac_WriteDO hPort pac_REMOTE_IO 1 total_channel do_value uart_Close hPort C If the module is remote IntPtr hPort hPort WinPAC uart_Open COM2 9600 N 8 1 int total_channel 8 uint do_value 3 turn on the channel 0 1 bool ret WinPAC pac_WriteDO hPort WinPAC pac_REMOTE_I O 1 total_channel do_value WinPAC uart_Close hPort Remarks The function can support for Local or Remote When the module is local the second Parameters s range is from 0 to 7 If remote the second Parameters need use the macro pac REMOTE _ IO Address which Address is from 0 to 255 WinPAC Standard API User Manual WinCE based eVC amp NET ree 9 21 pac_WriteDOBit This function writes a single bit of value to the DO module that is only the channel corresponding to the bit is changed Syntax bool pac_WriteDOBit HANDLE hPort int slot int UDO TotalCh int Channel int iBitValue Parameters hPort in the serial port HANDLE opened by uart_Open iSlot in The slot in which module is to receive the command Default is local l
68. mmatically using the registry functions Supported Modules The following shows the overview of the error handling functions which are available with WinPAC Functions Modules WP 8x4x WP 8x3x WP 8x5x WP 5xxx VP 25Wx VP 23Wx VH 25Wx pac_GetErrorMessage eevee ely ww ee e e sume vy o e e ie Function List The following functions are used to retrieve or set error handling functions Function Description pac_GetErrorMessage This function retrieves a message string pac_GetLastError This function returns the last error code value pac_SetLastError This function sets the last error code Remarks To see more information please reference user manual Chapter 5 API and Demo Reference WinPAC Standard API User Manual WinCE based eVC amp NET peor 11 1 pac_GetErrorMessage This function retrieves a message string Syntax void pac_GetErrorMessage DWORD dwMessagelD LPTSTR IpBuffer Parameters dwMessage D in Specifies the 32 bit message identifier for the requested message loBuffer out Pointer to a buffer for the error message Return Values None Examples None Examples None WinPAC Standard API User Manual WinCE based eVC amp NET EH Remarks The pac_GetErrorMessage function can be used to obtain error message strings for the WinPac error codes returned by pac_GetLasitError as shown in the following sample code TCHAR Buffer 32 pac_GetErrorMessage pac_
69. n COMO0 115200 N 8 1 BYTE iSlot 0 int iChannel 2 int AN TotalCh 8 int iValue bool ret pac_ReadAlHex hPort iSlot iChannel iAl_ TotalCh amp iValue uart_Close hPort C IntPtr hPort hPort WinPAC uart_Open COMO0 115200 N 8 1 byte iSlot 0 int iChannel 2 int AN TotalCh 8 int iValue new ml bool ret WinPAC pac_ReadAlHex hPort iSlot iChannel iAl_ TotalCh ref iValue WinPAC uart_Close hPort Remarks The function can support for Local or Remote When the module is local the second Parameters s range is from 0 to 7 If remote the second Parameters need use the macro pac REMOTE _ IO Address which Address is from 0 to 255 WinPAC Standard API User Manual WinCE based eVC amp NET 168 9 10 pac_ReadAO This function reads the AO value of the AO module Syntax bool pac_ReadAO HANDLE hPort int slot int Channel int AC TotalCh float fValue Parameters hPort in the serial port HANDLE opened by uart_Open iSlot in The slot in which module is to receive the command Default is local lf the IO module is remote please use the macro pac_REMOTE_IO 0 255 iChannel in Read the AO value from the channel IAO_ TotalCh in The total number of the AO channels of the AO module float fValue in The pointer to the AO value that is read back from the AO module Return Values Return true if success otherwise false WinPAC Standard API User Ma
70. n The AO value to write to the AO module Return Values Return true if success otherwise false WinPAC Standard API User Manual WinCE based eVC amp NET 0188 38 Examples eVC HANDLE hPort hPort uart_Open COMO0 115200 N 8 1 BYTE iSlot 0 int iChannel 2 intiAO_TotalCh 4 float fValue 5 bool ret pac_WriteAO hPort iSlot iChannel iAO_TotalCh fValue uart_Close hPort C IntPtr hPort hPort WinPAC uart_Open COMOd 115200 N 8 1 byte iSlot 0 int iChannel 2 intiAO_TotalCh 4 float fValue 5 bool ret WinPAC pac_WriteAO hPort iSlot iChannel iAO_TotalCh fValue WinPAC uart_Close hPort Remarks The function can support for Local or Remote When the module is local the second Parameters s range is from 0 to 7 If remote the second Parameters need use the macro pac REMOTE _ IO Address which Address is from 0 to 255 WinPAC Standard API User Manual WinCE based eVC amp NET ERE 9 20 pac_WriteDO This function writes the DO values to DO modules Syntax bool pac_WriteDO HANDLE hPort int slot int DO TotalCh DWORD IDO Value Parameters hPort in the serial port HANDLE opened by uart_Open iSlot in The slot in which module is to receive the command Default is local lf the IO module is remote please use the macro pac_ REMOTE _IO Address IDO_TotalCh in The total number of DO channels of the DO modules IDO _ Value in 1
71. nd Default is local lf the IO module is remote please use the macro pac_REMOTE_IO 0 255 IDL_TotalCh in The total number of the DI channels of the DI module iLatch Type in The latch type specified to read latch value back 1 latched high status 0 latched low status IDI_Latch_ Value out The pointer to the latch value read back from the DI module Return Values WinPAC Standard API User Manual WinCE based eVC amp NET TS Return true if success otherwise false Examples feVC HANDLE hPort hPort uart_Open COMO0 115200 N 8 1 BYTE iSlot 0 int DI TotalCh 8 int iLatchType 0 DWORD IDI Latch Value bool ret pac_ReadDILatch hPort iSlot OI TotalCh iLatchType amp IDI_ Latch Value uart_Close hPort C IntPtr hPort hPort WinPAC uart_Open COMO0 115200 N 8 1 byte iSlot 0 int IDI TotalCh 8 int iLatchType 0 uint IDI Latch_ Value new uint bool ret WinPAC pac_ReadDILatch hPort iSlot OD TotalCh iLatchType ref DI Latch_Value WinPAC uart_Close hPort Remarks The function can support for Local or Remote When the module is local the second Parameters s range is from 0 to 7 If remote the second Parameters need use the macro pac HEMOTIE IO Address which Address is from 0 to 255 WinPAC Standard API User Manual WinCE based eVC amp NET Teo 9 16 pac_ReadDIO This function reads the DI and the DO values of the DIO mod
72. nual WinCE based eVC amp NET 169 Examples feVC HANDLE hPort hPort uart_Open COMO0 115200 N 8 1 BYTE iSlot 0 int iChannel 2 int iAO_TotalCh 4 float fValue bool ret pac_ReadAO hPort iSlot iChannel iAO_TotalCh amp fValue uart_Close hPort C IntPtr hPort hPort WinPAC uart_Open COMO 115200 N 8 1 byte iSlot 0 int iChannel 2 int iAO _ TotalCh 4 float fValue new float bool ret WinPAC pac_ReadAO hPort iSlot iChannel iAO _TotalCh ref fValue WinPAC uart_Close hPort Remarks The function can support for Local or Remote When the module is local the second Parameters s range is from 0 to 7 If remote the second Parameters need use the macro pac REMOTE _ IO Address which Address is from 0 to 255 WinPAC Standard API User Manual WinCE based eVC amp NET kg 9 11 pac_ReadCNT This function reads the counter values of the counter frequency modules Syntax bool pac_ReadCNT HANDLE hPort int slot int iChannel DWORD Counter_ Value Parameters hPort in the serial port HANDLE opened by uart_Open iSlot in The slot in which module is to receive the command Default is local lf the IO module is remote please use the macro pac_REMOTE_IO 0 255 iChannel in The channel that reads the counter value back from the counter frequency module Counter_ Value out The pointer to the counter value that reads back from the
73. ocessing has been completed Syntax void pac_InterruptDone BYTE slot Parameters Slot in Specify the slot Return Values Return the slot interrupt ID WinPAC Standard API User Manual WinCE based eVC amp NET WS Examples feVC HANDLE hintr bool bExit false BYTE slot 0 DWORD INTP_Thread PVOID pContext d while DE vu d WaitForSingleObject hintr INFINITE do something pac_InterruptDone slot pac_EnableSlotInterrupt slot false pac_SetSlotinterruptEvent slot NULL CloseHandle pac_GetSlotInterruptEvent slot return 0 void CinterruptDlg OnButton 1 d bExit true pac_Interruptlnitialize slot pac_EnableSlotInterrupt slot true hintr pac_GetSlotInterruptEvent slot Create Thread NULL 0 INTP_ Thread amp slot 0 NULL WinPAC Standard API User Manual WinCE based eVC amp NET e 3 5 pac_Interruptinitialize This function initializes a slot interrupt with the kernel This initialization allows the slot to register an event and enable the interrupt Syntax bool pac_Interruptinitialize BYTE slot Parameters slot in Specify the index of slot to initialize Return Values Return true if success otherwise false Examples None Remarks lf you want to get the registered event handle please call this API pac_GetSlotInterruptEvent WinPAC Standard API User Manual WinCE based eVC amp NET e 3 6 pac_RegisterSlot
74. oid uart_SetTerminator HANDLE hPort LPCSTR szTerm Parameters hPort in Handle to the open COM port szlerm in Pointer the terminate characters Default is CR 0x0D Return Values None WinPAC Standard API User Manual WinCE based eVC amp NET EZE Examples eVC HANDLE hPort char result 32 hPort uart_Open Open COMO data format 115200 N 8 1 uart_SetTerminator hPort r pac_ChangeSlot 0 A 87K module is in slot0 uart_SendCmd hPort 00M result 00M ask the device name DCON uart_Close hPort C byte result new byte 32 IntPtr hPort WinPAC uart_Open Open COMO data format 115200 N 8 1 WinPAC uart_SetTerminator hPort WinPAC AnsiString r WinPAC pac_ChangeSlot 0 A 87K module is in slot0 WinPAC uart_SendCmd hPort WinPAC AnsiString 00M result 00M ask the device name DCON string str WinPAC WideString result WinPAC uart_Close hPort Remarks This function relates to uart_Send uart_ Recv uart_ SendCmd WinPAC Standard API User Manual WinCE based eVC amp NET RE 8 13 uart_SetTimeOut This function sets the time out timer Syntax void uart_SetTimeOut HANDLE hPort DWORD msec int cto Type Parameters hPort in Handle to the open COM port msec in millisecond to the timer cto Type in Specifies the time out timer type as following CTO_TIMEOUT_ALL 0 CTO READ_RETRY_TIMEOUT 1 CT
75. ol uart_Send HANDLE hPort LPCSTR buf Parameters hPort in Handle to the open COM port buf in A pointer to a buffer that send the data 2048 bytes maximum Return Values 1 indicates success O indicates failure WinPAC Standard API User Manual WinCE based eVC amp NET a Examples feVC bool ret HANDLE hPeort char buf 4 sprintf buf abcd hPort uart_Open COM2 9600 N 8 1 ret uart_Send hPort buf uart_Close hPort C bool ret IntPtr hPort string buf buf abcd hPort WinPAC uart_Open COM2 9600 N 8 1 ret WinPAC uart_Send hPort WinPAC AnsiString buf WinPAC uart_Close hPort Remarks A string for buf cannot include space character within the string Otherwise the string will be stoped by space character For example 01M 02 03 of the user defined string Howerver the actual string sent out is 01M 0x0D The terminate characters isOxOD Refer to uart_SetTerminator function to change This function will call PurgeComm to clear serial COM port output buffer This function sends data with a terminate characterOx0D For example 1 Check sum is disabled The buf are five bytes ABCD 0x0 This function will send five bytes ABCD 0x0D WinPAC Standard API User Manual WinCE based eVC amp NET RER 8 11 uart_SendCmd This function sends commands through the COM port which have been opened This function is a combinat
76. requency module iOverflow out The pointer to the counter overflow that is read back from the counter frequency module Return Values Return true if success otherwise false WinPAC Standard API User Manual WinCE based eVC amp NET amiin Examples eVC HANDLE hPort hPort uart_Open COMO0 115200 N 8 1 BYTE iSlot 0 int iChannel 0 int iOverflow bool ret pac_ReadCNT Overflow hPort iSlot iChannel amp iOverflow uart_Close hPort C IntPtr hPort hPort WinPAC uart_Open COMO0 115200 N 8 1 byte iSlot 0 int iChannel 0 int iOverflow new int bool ret WinPAC pac_ReadCNT Overflow hPort iSlot Channel ref iOverflow WinPAC uart_Close hPort Remarks The function can support for Local or Remote When the module is local the second Parameters s range is from 0 to 7 If remote the second Parameters need use the macro pac REMOTE _ O Address which Address is from 0 to 255 WinPAC Standard API User Manual WinCE based eVC amp NET a 9 13 pac_ReadDIl This function reads the DI value of the DI module Syntax bool oac Head HANDLE hPort int slot int iDL_ TotalCh DWORD IDI Value Parameters hPort in The serial port HANDLE opened by uart_Open iSlot in The slot in which module is to receive the command Default is local lf the IO module is remote please use the macro pac_REMOTE_IO 0 255 IDL_TotalCh in The total channels of
77. rt_Close hPort C string buf uint Im Len IntPtr hPort WinPAC uart_ Open COM1 9600 N 8 1 in_Len WinPAC uart_GetDataSize hPort 0 0 IN DATA 1 OUT DATA bool ret WinPAC uart_BinRecv hPort WinPAC AnsiString buf in_Len WinPAC uart_Close hPort WinPAC Standard API User Manual WinCE based eVC amp NET WR 8 7 uart_GetLineStatus This function retrieves the modem control register values Syntax BOOL uart_GetLineStatus HANDLE hPort int pin Parameters hPort in Handle to the open COM port pin in A variable specifies state of a pin of the COM port This Parameters can be following values define CTS 0O define DSR 1 define RI 2 define CD 3 Return Values TRUE indicates the pin s state is ON 0 indicates OFF WinPAC Standard API User Manual WinCE based eVC amp NET SEI Examples feVC HANDLE hPort uart_Open COM4 115200 N 8 1 BOOL ret uart_GetLineStatus hPort DSR the pin DSR for example if ret printf The status of DSR is ON n else printf The status of DSR is OFF n uart_Close hPort C IntPtr hPort WinPAC uart_ Open COM4 115200 N 8 1 the pin DSR for example bool ret WinPAC uart_ GetLineStatus hPort DSR if ret Console WriteLine The status of DSR is ON else Console WriteLine The status of DSR is OFF WinPAC uart_Close hPort WinPAC Standard API User Manual Win
78. s Timer 2 Specifies the elapses time value for a timerout signal 0 65535 in 10 microseconds Specifies the address of the application supplied f callback function Return Values The value is true if the function was installed successfully It is zero and the function cannot be installed Examples None WinPAC Standard API User Manual WinCE based eVC amp NET WER 10 5 pac_SetBPTimerOut The timerout pin on each slot will be triggered while a timerout signal has been outputted The timeourput pin can be used to acquire the synchronized data on each slot Syntax bool pac_SetBP TimerOut unsigned int UHighElapse unsigned int uLOwElapse pac_TIMEROUT CALLBACK FUNC f Parameters UuHighElapse in Specifies the elapses time value for a high wave of the timerout signal 0 65535 in microseconds uLOwElapse in Specifies the elapses time value for a low wave of the timerout signal 0 65535 in microseconds Specifies the address of the application supplied f callback function Return Values The value is true if the function was installed successfully It is zero and the function cannot be installed Examples None WinPAC Standard API User Manual WinCE based eVC amp NET 200 11 Error Handling API Error handling operations include basic management operations such as setting and the writing to the registry The following topics describe how you can create delete or modify registry keys progra
79. s Return true if success otherwise false WinPAC Standard API User Manual WinCE based eVC amp NET 186 Examples eVC HANDLE hPort hPort uart_Open COMO0 115200 N 8 1 BYTE slot 0 int total channel 8 DWORD do value bool ret pac_ReadDO hPort slot total channel amp do_ value uart_Close hPort C IntPtr hPort hPort WinPAC uart_Open COMO 115200 N 8 1 byte slot 0 int total channel 8 uint do_value new uint bool ret WinPAC pac_ReadDO hPort slot total_ channel rei do_value WinPAC uart_Close hPort Remarks The function can support for Local or Remote When the module is local the second Parameters s range is from 0 to 7 If remote the second Parameters need use the macro pac REMOTE _IO Address which Address is from 0 to 255 WinPAC Standard API User Manual WinCE based eVC amp NET EEA 9 19 pac_WriteAO This function writes the AO value to the AO modules Syntax bool pac_WriteAO HANDLE hPort int slot int Channel int AC TotalCh float fValue Parameters hPort in the serial port HANDLE opened by uart_Open iSlot in The slot in which module is to receive the command Default is local lf the IO module is remote please use the macro pac_REMOTE _IO 0 255 iChannel in The channel that is written thee AO value to IAO_ TotalCh in The total number of the AO channels of the AO module float fValue i
80. s 3 int CALLBACK slot_callback_proc do something Pac_InterruptDone slot return 1 if return 0 SDK will do pac_InterruptDone automatically else return 1 users should do pac_InterruptDone by themselves if nedded void ClntrDIg OnButton1 pac_RegisterSlotInterrupt slot slot_callback_proc pac_EnableSlotinterrupt slot true enable slot interrupt void ClintrDig OnButton2 pac_EnableSlotinterrupt slot false disable slot interrupt pac_UnregisterSlotinterrupt slot unregister slot interrupt WinPAC Standard API User Manual WinCE based eVC amp NET CCS 3 2 pac_GetSlotinterruptEvent This function retrieves the slot event handle which registered by pac_Interruptlnitialize Syntax HANDLE pac_GetSlotlnterruptEvent BYTE slot Parameters slot in Specify the index of slot to retrieve the event handle Return Values Return a handle to the event object if success otherwise false Examples None WinPAC Standard API User Manual WinCE based eVC amp NET eas 3 3 pac _GetSlotinterruptiD This function retrieves the slot interrupt ID Syntax DWORD pac_GetSlotInterruptID BYTE Slot Parameters Slot in Specify the slot Return Values Return the slot interrupt ID Examples None WinPAC Standard API User Manual WinCE based eVC amp NET 50 3 4 pac_InterruptDone This function signals to the kernel that interrupt pr
81. se Examples eVC bool bBC bBC pac_BackwardCompatible C bool bBC bBC WinPAC pac_BackwardCompatible WinPAC Standard API User Manual WinCE based eVC amp NET TT 1 2 pac_ChangeSlot This function specifies the slot from one to another Syntax void pac_ChangeSlot BYTE slotNo Parameters slotNo in Specifies the slot number Return Values None Examples eVC HANDLE hPort bool ret char buf 10 hPort uart_Open COMO0 pac_Changeslot 0 Change to the slot 0 which the 87k module plug in ret uart_SendCmd hPort 00M buf A 00M ask the device name uart_Close hPort WinPAC Standard API User Manual WinCE based eVC amp NET eis 1 3 pac_EnableLED This function decides the LED turning on or not Syntax void pac_EnableLED bool bFlag Parameters bFlag in Boolean value that specifies whether to enable or disable the keyboard Value Description TRUE Enable the RUN LED FALSE Disable the RUN LED Return Values None Examples eVC pac_EnableLED True C WinPAC pac_EnableLED True WinPAC Standard API User Manual WinCE based eVC amp NET E 1 4 pac_GetCPUVersion This function retrieves the CPU version Syntax void pac_GetCPUVersion LPSTR cpu_version Parameters CDU Version out Retrieves the CPU version of the WinPAC Return Values None Examples
82. slot interrupt ID This function signals to the kernel that interrupt processing has been completed pac_GetSlotInterruptEvent pac_InterruptDone This function initializes a slot interrupt with the kernel pac_Interruptinitialize This initialization allows the slot to register an event and enable the interrupt This function registers slot interrupt service route and pac_RegisterSlotinterrupt l turns on slot interrupt This function allows a device driver to assign the slot ac SetSlotinterruotEvent gt p event handle This function sets the priority for a real time thread on a thread by thread basis pac_SetTriggerType This function can assign the pulse trigger type This function unregisters slot interrupt service route and pac_SetSlotinterruptPriority pac_UnregisterSlotinterrupt diables a hardware interrupt as specified by its interrupt identifier WinPAC Standard API User Manual WinCE based eVC amp NET oe 3 1 pac_EnableSlotinterrupt This function performs hardware operations necessary to enable the specified hardware interrupt Syntax void pac_EnableSlotinterrupt BYTE slot bool bEnable Parameters slot in Specify the index of slot to enable interrupt or disable bEnable in Specify the Slot interrupt turning on or not Return Values Return Values None WinPAC Standard API User Manual WinCE based eVC amp NET CH Examples eVC intslot 3 ifsloti
83. tandard API User Manual WinCE based eVC amp NET 207 12 2 pac_AnsiToWideString This function can convert ansi string to unicode string Syntax void pac_AnsiloWideString const char astr LPTSTR wstr Parameters astr in A pointer to a buffer that stores ansi string wstr in A pointer to a buffer that receives unicode string Return Values None Examples eVC char ansiString 128 This is an ansi string TCHAR uniString 128 pac_AnsiloWideString ansiString uniString MessageBox NULL uniString NULL MB_OK The string This is an ansi string will show in the messagebox correctly WinPAC Standard API User Manual WinCE based eVC amp NET 208 Remarks Maximum string buffer size is 2 Kbytes WinPAC Standard API User Manual WinCE based eVC amp NET WER 12 3 pac_DoEvents This function marshals the case to handle the other events When you run a Windows Form it creates the new form which then waits for events to handle Each time the form handles an event it processes all the code associated with that event All other events wait in the queue While your code handles the event your application does not respond If you call pac_DoEvents in your code your application can handle the other events Syntax void pac_DoEvents Parameters None Return Values None WinPAC Standard API User Manual WinCE based eVC amp NET oro Examples
84. the DI module IDI_ Value out The pointer to DI value to read back Return Values Return true if success otherwise false WinPAC Standard API User Manual WinCE based eVC amp NET 0175 Examples eVC HANDLE hPort hPort uart_Open COMO0 115200 N 8 1 BYTE iSlot 0 int DI TotalCh 8 DWORD IDI Value bool ret pac_ReadDI hPort iSlot iDl_TotalCh amp IDI_ Value uart_Close hPort C IntPtr hPort hPort WinPAC uart_Open COMO 115200 N 8 1 byte iSlot 0 int iDI_TotalCh 8 uint IDI_Value new uint bool ret WinPAC pac_ReadDI hPort iSlot iDl_TotalCh ref IDI_Value WinPAC uart_Close hPort Remarks The function can support for Local or Remote When the module is local the second Parameters s range is from 0 to 7 If remote the second Parameters need use the macro pac_REMOTE_IO Address which Address is from 0 to 255 WinPAC Standard API User Manual WinCE based eVC amp NET 176 9 14 pac ReadDICNT This function reads the counts of the DI channels of the DI module Syntax bool pac_ReadDICNT HANDLE hPort int slot int iChannel int DI TotalCh DWORD ICounter_ Value Parameters hPort in the serial port HANDLE opened by uart_Open iSlot in The slot in which module is to receive the command Default is local lf the IO module is remote please use the macro pac_REMOTE_IO 0 255 iChannel in The channel that the counter val
85. turn Values Return true if success otherwise false WinPAC Standard API User Manual WinCE based eVC amp NET Piet Examples feVC HANDLE hPort hPort uart_Open COMO0 115200 N 8 1 BYTE iSlot 0 int iChannel 0 bool ret pac_ClearCNT hPort iSlot Channel uart_Close hPort C IntPtr hPort hPort WinPAC uart_Open COMO0 115200 N 8 1 byte iSlot 0 int iChannel 0 bool ret WinPAC pac_ClearCNT hPort iSlot Channel WinPAC uart_Close hPort Remarks The function can support for Local or Remote When the module is local the second Parameters s range is from 0 to 7 If remote the second Parameters need use the macro pac REMOTE _IO Address which Address is from 0 to 255 WinPAC Standard API User Manual WinCE based eVC amp NET Te 9 2 pac_ClearDICNT This function clears the counter value of the DI channel of the DI module Syntax bool pac_ClearDICNT HANDLE hPort int slot int Channel int OT TotalCh Parameters hPort in the serial port HANDLE opened by uart_Open iSlot in The slot in which module is to receive the command Default is local lf the IO module is remote please use the macro pac_REMOTE_IO 0 255 iChannel in The channel that the counter value belongs IDL_TotalCh in Total number of the DI channels of the DI module Return Values Return true if success otherwise false WinPAC Standard API User Manual WinCE based eVC
86. ue belongs IDL_TotalCh in Total number of the DI channels of the DI module Counter_ Value out The pointer to the counter value Return Values Return true if success otherwise false WinPAC Standard API User Manual WinCE based eVC amp NET mi Examples feVC HANDLE hPort hPort uart_Open COMO0 115200 N 8 1 BYTE iSlot 0 int Channel 2 int DI TotalCh 8 DWORD Counter_ Value bool ret pac_ReadDICNT hPort iSlot iChannel iDI_ TotalCh amp lCounter_ Value uart_Close hPort C IntPtr hPort hPort WinPAC uart_Open COMO0 115200 N 8 1 byte iSlot 0 int Channel 2 int DI TotalCh 8 uint Counter_ Value new uint bool ret WinPAC pac_ReadDICNT hPort iSlot iChannel iDI_ TotalCh ref ICounter_ Value WinPAC uart_Close hPort Remarks The function can support for Local or Remote When the module is local the second Parameters s range is from 0 to 7 If remote the second Parameters need use the macro pac REMOTE _ IO Address which Address is from 0 to 255 WinPAC Standard API User Manual WinCE based eVC amp NET Te 9 15 pac_ReadDiLatch This function reads the DI latch value of the DI module Syntax bool pac_ReadDILatch HANDLE hPort int slot int UD TotalCh int iLatchType DWORD ID Latch Value Parameters hPort in the serial port HANDLE opened by uart_Open iSlot in The slot in which module is to receive the comma
87. ule Syntax bool pac_ReadDIO HANDLE hPort int slot int DI TotalCh int iDO TotalCh DWORD IDI Value DWORD IDO Value Parameters hPort in the serial port HANDLE opened by uart_Open iSlot in The slot in which module is to receive the command Default is local lf the IO module is remote please use the macro pac_REMOTE_IO 0 255 IDL_TotalCh in The total number of DI channels of the DIO module IDO_TotalCh in The total number of DO channels of the DIO module IDI_ Value out The pointer to the value of DI read back IDO _ Value out The pointers to the value of DO read back WinPAC Standard API User Manual WinCE based eVC amp NET anii Return Values Return true if success otherwise false Examples feVC HANDLE hPort hPort uart_Open COMO0 115200 N 8 1 BYTE iSlot 0 int DI TotalCh 8 int UDO TotalCh 8 DWORD IDI Value DWORD IDO Value bool ret pac_ReadDIO hPort iSlot iDl_TotalCh iDO_TotalCh amp IDI_Value amp IDO_ Value uart_Close hPort C IntPtr hPort hPort WinPAC uart_Open COMO0 115200 N 8 1 byte iSlot 0 int iDI_TotalCh 8 int UDO TotalCh 8 uint IDI_ Value new uint uint IDO Value new uint bool ret WinPAC pac_ReadDIO hPort Got DI TotalCh iDO_TotalCh ref IDI_ Value ref IDO_ Value WinPAC uart_Close hPort Remarks The function can support for local or remote When the module is local th
88. unctions are used to retrieve or set system information Function Description This function retrieves the WinPAC270 running in the backward compatible mode or not pac_BackwardCompatible pac_ChangesSlot This function specifies the slot from one to another pac_EnableLED This function decides the LED turning on or not pac_GetCPUVersion This function retrieves the CPU version pac_GetEbootVersion This function retrieves the eboot version pac_GetMacAddress This function retrieves the Mac address pac_GetMapCOM This function retrieves the index mapping of COM port This function is used to retrieve the name of an 8000 pac_GetModuleName series I O module which is plugged into a specific I O slot in the WinPac system pac_GetOSVersion This function retrieves the OS version pac_GetRotaryID This function retrieves the rotary switch ID pac_GetSerialNumber This function retrieves the serial number pac_GetWinPacNetVersion This function retrieves the version of the WinPacNet dll pac_GetWinPacSDK Version This function retrieves the SDK version pac_Reboot This function reboots the device WinPAC Standard API User Manual WinCE based eVC amp NET ea 1 1 pac_BackwardCompatible This function retrieves the WinPAC270 running in the backward compatible mode or not Syntax bool pac_BackwardCompatible Parameters None Return Values Return true if the WinPAC is running in a backward compatible mode otherwise fal
89. urn Values 1 indicates success 0 indicates failure If this function doesn t receive a characterOxOD the other data still store to buf but the return value is 0 Calling GetLastError function will get an error code pac_ERR_uart_READ_TIMEOUT WinPAC Standard API User Manual WinCE based eVC amp NET RER Examples eVC bool ret HANDLE hPort char buf 10 hPort uart_Open COM2 9600 N 8 1 ret uart_Recv hPort buf uart_Close hPort C bool ret IntPtr hPort string buf hPort WinPAC uart_Open COM2 9600 N 8 1 ret WinPAC uart_Recv hPort WinPAC AnsiString buf WinPAC uart_Close hPort Remarks The terminate characters isOxOD Refer to uart_SetTerminator function to change For example a Check sum is disabled This function receives five bytes ABCD 0x0D The buf will be five bytes ABCD 0x0 b Check sum is disabled This function receives four bytes ABCD The buf will be four bytes ABCD But the reurn value is 0 WinPAC Standard API User Manual WinCE based eVC amp NET ke 8 10 uart_Send This function sends data through the COM port which have been opened This function will send a string If the checksum is enabled by the uart_EnableCheckSum function this function automatically adds the two checksum bytes to the string And then the end of sending string is further added 0x0D to mean the termination of the string buf Syntax bo
90. x WP 8x4x WP 8x3x pac_ClearDILatch pac_ClearDlOLatch pac_ReadAlAllHex pac_ReadCNT Overflow pac_ReadDILatch pac_ReadDI OLatch pac_WriteAO Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y pac_WriteDO Y Y pac_WriteDOBit WinPAC Standard API User Manual WinCE based eVC amp NET Te Function List The following functions are used to retrieve or set PAC_IO information Function Description This function clears the counter values of the pac_ClearCNT counter frequency modules This function clears the counter value of the DI channel of the DI module pac_ClearDlLatch This function clears the latch value of the DI module This function clears the latch values of DI and DO channels of the DIO module pac_GeiBit The function can retrieve the value which in specific bit This function reads the engineering mode Al value of the Al pac_ReadAl module This function reads all the Al values of all channels in pac_ReadAlAll engineering mode of the Al module This function reads all the Al values of all channels in 2 s complement mode of the Al module This function reads the 2 s complement mode Al value of pac_ReadAlHex the Al module pac_ReadAO This function reads the AO value of the AO module This function reads the counter values of the pac_ReadCNT counter frequency modules This function clears the counter overflow value of the counter frequency modules pac_ReadDIl Th
91. y uart_SetTerminator Py fy joy fy oy pe ty ite uart_SetTimeOut WinPAC Standard API User Manual WinCE based eVC amp NET ue Function List The following functions are used to retrieve or set uart information Function Description uart_BinRecv This function is applied to receive the fix length response This function can send out command string with or without null character under the consideration of the command length uart_ BinSend This function is used to Send binary command and receive binary data with the fixed length uart_Close This function closes the COM port which has been opened uart_ EnableCheckSum This function turns on the check sum or not This function retrieves the number of bytes received by the uart_GetDataSize serial provider but not yet read by a uart_Recv operation or of user data remaining to transmit for write operations uart_GetLineStatus This function retrieves the modem control register values This function opens the COM port and specifies the baud rate parity bits data bits and stop bits uart_ BinSendCmd uart_Open This function retrieves data through the COM port which uart_Recv have been opened This function sends data through the COM port which have t_Send been opened This function sends commands through the COM port which have been opened uart SendCmd uart_ SetTerminator This function sets the terminate characters uart_ Set
92. ype 0 DWORD IDI Latch Value DWORD IDO Latch _ Value bool ret pac_ReadDlOLatch hPort iSlot iDI_TotalCh iDO_TotalCh iLatchType amp lDl_Latch_Value amp IDO_Latch_Value uart_Close hPort C IntPtr hPort hPort WinPAC uart_Open COMO 115200 N 8 1 byte iSlot 0 int iDI_TotalCh 8 int UDO TotalCh 8 int iLatch Type 0 uint IDI Latch_ Value new uint uint IDO Latch _ Value new uint bool ret WinPAC pac_ReadDIOLatch hPort iSlot OI TotalCh iDO_TotalCh iLatchType ref IDI_Latch_Value ref IDO Latch _Value WinPAC uart_Close hPort Remarks The function can support for Local or Remote When the module is local the second Parameters s range is from 0 to 7 If remote the second Parameters need use the macro pac REMOTE _ IO Address which Address is from 0 to 255 WinPAC Standard API User Manual WinCE based eVC amp NET 185 9 18 pac_ReadDO This function reads the DO value of the DO module Syntax bool pac_ReadDO HANDLE hPort int slot int UDO TotalCh DWORD IDO Value Parameters hPort in the serial port HANDLE opened by uart_Open iSlot in The slot in which module is to receive the command Default is local lf the IO module is remote please use the macro pac_REMOTE_IO 0 255 IDO_TotalCh in The total number of DO channels of the DO modules IDO Value in The pointer of the DO value to read from the DO module Return Value
Download Pdf Manuals
Related Search
Related Contents
(SmartWave LF Tool User manual) SUNNE PRO05 project mount Notice d`utilisation et de montage Détecteur de Slit Lamp HIS-5000 5X Huvitz Bedienungsanleitung D & GB Copyright © All rights reserved.
Failed to retrieve file