Home

WDT-01 - ICP DAS

image

Contents

1. eddie 8 24 VB CALEDLLS ite eite are 10 2 5 DELPHI GALE DEES 2 8 ise pin EE PUDE tbe eiae tbe petits 12 2 0 DEMO PROGRAM eoo tu Ut pl ee S cube t 14 3 U 23 31 NAPDIO VXD INSTA TATION e 23 SEPARI DILO ELE 24 3 3 DIO_SHORTSUB2 DIO_FLOATSUB2 24 34 DIO GETDLEVERSION isis dis pte 24 3 5 DIO OUTPUTBYTE 25 3 0 DIO INPUTB TE ee eet ecl tee eoe pecca 25 3 7 DIO ZOPENV XD inttr adu ate argen n rd oases 27 3 8 DIO CLOSEVXD A RSE AE AB bebe eig 27 3 9 DIO GETVXDVERSION 28 3 10 A date etnies eT 28 3 11 DIOC RESETINTCOUNT n pt eon BS SE A ASS MIR Se Rie RERO RR 30 3 12 DIO GETINTCOUNT iii erret e cubase PORE OR RU RI PORE ERE 30 3 13 DIO DEMO PROGRAM ss et OUR pecu 32 4 RS 232 DRIVER indc u asa 36 a T UART 36 42 SHORT 37 4 3 FLOAT SUB LO ERIS RE 39 44 GET DEL VERSION uha Gaute e Me ee eesti eet 39 435 OPEN COM cei dete e tertie eee e 41 M0 CHOSE too HO AAEE 42 4 7 SEND CMDX RESERVED eee erecti edite
2. 43 WDT 01 Windows Software User Manual Version 1 0 3 4 8 READ_COM_STATUS RESERVED ccc sccccssssececsssceceessececesssececssseeceesseeeceessececnsseeesenseeeessuas 43 49 VART SEND STR n ease cede i ueniens 43 4 10 45 4 11 UART_READ_SEND_STATUS I tnnt 45 4 12 UART READ RECEIVE 8 86 47 4 13 VART RECEIVE I CHXAR antec o IR ONSE 47 4 T4 DEMO th ERREUR REUS ERR 49 5 WINDOWS NT APPLICATION S 52 5 1 C CALE DLES REFER TO SEC ce eren evi t pereo eee re eed 52 5 2 CALL DLLS REFER TO SEC 2 2 ccccccccesssscecesssececssececeessececssseececseeeceenaeeecessseceeesieeeesssaeees 52 5 3 BC CALL DLLS REFER TO SEC 2 3 21 2 00 0000 01000000000000000000000000000050000000 52 54 DELS REFER TO SEC 2 dyus a sn niae een as 52 5 5 DELPHI CALL DLLS REFER TO SEC 2 5 Shu 52 5 6 DEMO PROGRAM REFER TO SEC 2 6 52 6 DIO E 5
3. define UART THREAD INIT 5 define UART THREAD START 6 Zdefine UART THREAD OVER 7 others invalidate return code for UART RECEIVE 1 CHAR define UART RECEIVE ERR 8 define UART NO ERR 0 define UART PORT ERR 2 EXPORTS short CALLBACK SHORT SUB 2 short nA short nB EXPORTS float CALLBACK FLOAT SUB 2 float fA float fB EXPORTS WORD CALLBACK Get DLL Version void WDT 01 Windows Software User Manual Version 1 0 36 for general purpose UART applications EXPORTS WORD CALLBACK OPEN_COM char port DWORD baudrate char checksum EXPORTS BOOL CALLBACK CLOSE_COM char port reserved EXPORTS WORD CALLBACK SEND_CMD char port char cmd WORD wTimeout EXPORTS WORD CALLBACK READ_COM_STATUS char port char Buf WORD status for general purpose UART applications EXPORTS WORD CALLBACK UART_SEND_STR char port char cmd EXPORTS WORD CALLBACK UART CLEAR INPUT BUFFER char port EXPORTS WORD CALLBACK UART READ SEND STATUS char port EXPORTS WORD CALLBACK UART READ RECEIVE STATUS char port EXPORTS WORD CALLBACK UART RECEIVE 1 CHAR char port char cReadChar A SHORT SUB 2 Description Compute C A B in short format short 16 bits sign integer This function is provided for testing purpose To test this DLLs can be called by your programming language call this subroutine for testing If this subroutine return the correct value the other DLLs will work OK also Syntax shor
4. only press Enter nTI ASCII TO HEX szCmdq 0 HEX format nT2 ASCII TO HEX szCmd 1 nT3 ASCII TO HEX szCmd 2 wBase nT1 2564 nT2 16 nT3 nDMA ASCII TO HEX szCmd 4 DECIMAL format if nDMA 0 nDMA 1 nTI ASCII TO HEX szCmd 6 DECIMAL format nT2 ASCII TO HEX szCmdq 7 nIRQznT1 10 nT2 if NIRQ 0 nIRQ 1 short ASCII_TO_HEX char cChar if lt 97 return cChar 0 else if cChar lt F return cChar A 10 else return cChar a 10 void TEST_CMD HWND hwnd int x int dx int y int dy WDT 01 Windows Software User Manual Version 1 0 20 WDT 01 Windows Software User Manual Version 1 0 21 The READ_COM only accept fix format command The command format is given as below ifnDMA 0 symbol 224 V Wingdings 12 gt DMA is used symbol 224 V Wingdings s 12 gt will set to 1 if nIRQ 0 symbol 224 M Wingdings 12 gt IRQ is used symbol 224 f Wingdings s 12 gt nIRQ will set to 1 e symbol 224 f Wingdings s 12 gt accept current setting of wBase and nDMA and nIRQ 626 BASE 3 DMA 1 IRQ 2 NOW gt Base 2c8 DMA 1 IRQ 1 Now Setting Is gt Base 2c8 DHA 1 IRQ 1 DLL Uersion 182 SHORT SUB 2 1 2 1 FLORT SUB 2 1 0 2 0 1 000000 DO 6x55aa gt DI 55aa 00 9 55 gt DI aa55 DA 0x200 0x400 6x666 0x800 6x0 OA
5. ret OPEN COM COM PORT 9600L 0 if ret 1 strcpy cShow Open Com Error goto ret_label for retZUART READ RECEIVE STATUS COM PORT if ret 0 UART RECEIVE 1 CHAR COM PORT amp ch else break t 0 for ret UART_READ_RECEIVE_STATUS COM_PORT finished or timeout if ret 0 UART RECEIVE 1 CHAR COM PORT amp ch finished or timeout WDT 01 Windows Software User Manual Version 1 0 49 if ch 0x0d break t 0 else Sleep 1 if 2100 strcpy cShow Time Out goto ret_label t 0 120 for ret UART_READ_RECEIVE_STATUS COM_PORT finished or timeout if ret 0 UART RECEIVE 1 CHAR COM PORT amp ch finished or timeout if 0 0 break t 0 cBuf i 2ch i else Sleep 1 if t gt 100 strcpy cShow Time Out goto ret_label cBuf i 0 strepy cShow Receive string strcat cShow cBuf ret label WDT 01 Windows Software User Manual Version 1 0 50 TextOut hdc 1 yy cShow strlen cShow ReleaseDC hwnd hdc CLOSE PORT WDT 01 Windows Software User Manual Version 1 0 51 Windows NT Applications The system driver registration steps of Windows NT are given as following Enter DOS prompt A cd wnt cd sys copy NAPWNT SYS c WINNT S YSTEM32 DRIVERS REGINI NAPWNT INI Shutdown the NT power off power on the NA
6. yoso BY Microsoft Word HSMs Dos text TESTA626 BASE AM 10 40 WDT 01 Windows Software User Manual Version 1 0 22 l DIO This driver is design for DIO Cards amp WDT 01 Card the user must refer to the original User Manual for details The chapter gives an demo program for DIO 48 This example is very useful for the other DIO board It is recommended to refer to chapter 4 for all DIO user A NAPDIO VxD Installation If the user need to use interrupt the NAPDIO VxD must install in the system before software execution The installation steps are given as following step 1 place the companion floppy disk into step 2 enter DOS prompt under Windows step 3 a step 4 cd w95 step 5 cd dio step 6 cd vxd step 7 copy napdio vxd c windows system step 8 power off the computer then power on The DIO DLL will call NAPDIO VxD automatically If the user try to execute the demo program given in the companion floppy disk the NAPDIO VxD must be installed first WDT 01 Windows Software User Manual Version 1 0 23 A DIO H define EXPORTS extern declspec dllexport define NoError 0 define VxdOpenError 1 define VxdNoOpen 2 define GetVxdVersionError 3 define InstallIrqError 4 define ClearIntCountError 5 define GetIntCountError 6 EXPORTS short CALLBACK DIO_ShortSub2 short nA short nB EXPORTS float CALLBACK DIO_FloatSub2 float fA float fB EXPORTS W
7. DIO GetDllVersion sprintf cShow 1 DLL Version x wRetVal TextOut hdc x dx y iLine dy cShow strlen cShow iLine nRetVal DIO_ShortSub2 1 2 sprintf cShow 2 SHORT SUB 2 1 2 nRetVal TextOut hdc x dx y iLine dy cShow strlen cShow iLine fRetVal DIO_FloatSub2 float 1 0 float 2 0 sprintf cShow 3 FLOAT SUB 2 1 0 2 0 f fRetVal TextOut hdc x dx y iLine dy cShow strlen cShow iLine WDT 01 Windows Software User Manual Version 1 0 32 wRetVal DIO OpenVxd NOTE this function must call once before the other Vxd service functions are called Refer to manual for details if wRetVal 0 sprintf cShow 4 NAPDIO VXD Open OK else sprintf cShow 4 NAPDIO V XD Open Error TextOut hdc x dx y iLine dy cShow strlen cShow iLine wRetVal DIO_GetVxdVersion amp 1 if wRetVal 0 sprintf cShow 5 1 else sprintf cShow 5 Get Vxd Version Error TextOut hdc x dx y iLine dy cShow strlen cShow iLine wRetVal DIO InstallIrq wBase WORD nIRQ if WRetVal 0 sprintf cShow 6 Install Irq Ok else sprintf cShow 6 Install Irq Error TextOut hdc x dx y iLine dy cShow strlen cShow iLine wRetVal DIO_ResetIntCount if wRetVal 0 sprintf cShow 6 ResetIntCount OK else sprintf cShow 6 ResetIntCount Error TextOut hdc x dx y iLine dy cShow strlen cShow iLine for 0 j lt 10 j wRetVal DIO_
8. Software User Manual Version 1 0 29 A DIO ResetlntCount e Description This subroutine will reset the WIntCount defined in NAPDIO VxD e Syntax WORD DIO ResetIntCount e Input Parameter void Return Value NoError OK VxdNoOpen NAPDIO VxD no open ClearIntCountError WIntCount clear error e Demo Program Refer to Sec 3 13 DIO GetlntCount e Description This subroutine will read the WIntCount defined in NAPDIO VxD e Syntax WORD DIO ReadIntCount WORD wlIntCount e Input Parameter wIntCount address of wIntCount Return Value NoError OK VxdNoOpen the NAPDIO VxD no open GetIntCountError WIntCount read error e Demo Program Refer to Sec 3 13 WDT 01 Windows Software User Manual Version 1 0 30 WDT 01 Windows Software User Manual Version 1 0 31 A DIO Demo Program void TEST_CMD HWND hwnd int x int dx int y int dy char cBuf 80 cShow 80 HDC hdc WORD wRetVal wChannel wConfig wType wBuf 10 wCount i j short nRetVal float fRetVal fVal fBuf 10 iLine 0 hdc GetDC hwnd HideCaret hwnd SelectObject hdc GetStockObject SYSTEM FIXED FONT sprintf cShow gt TextOut hdc x dx y iLine dy cShow strlen cShow iLine sprintf cShow Now Setting Is gt Base x DMA d IRQ d wBase nDMA nIRQ TextOut hdc x dx y iLine dy cShow strlen cShow iLine wRetVal
9. 2 3 COM3 4 COM4 others invalidate Return Value UART THREAD INIT create send thread UART THREAD START thread start to execute UART THREAD OVER thread send input string OVER WDT 01 Windows Software User Manual Version 1 0 45 e Demo Program Refer to Sec 4 14 WDT 01 Windows Software User Manual Version 1 0 46 A UART_READ_RECEIVE STATUS Description This function will read the status of the UART receive buffer Syntax WORD UART_READ_RECEIVE_STATUS char cPort Input Parameter cPort 1 COM1 2 COM2 32COM3 others invalidate Return Value 0 others number of chars are received in receive buffer Demo Program Refer to Sec 4 14 A UART RECEIVE 1 CHAR Description This function will read 1 char from the UART receive buffer Syntax WORD UART RECEIVE 1 CHAR char cPort Input Parameter cPort 1 COM1 2 COM2 32COM3 others invalidate Return Value UART_NO_ERR receive 1 char OK UART PORT ERR port number error validate for 1 2 3 4 only UART RECEIVE ERR UART receive error WDT 01 Windows Software User Manual Version 1 0 47 e Demo Program Refer to Sec 4 14 WDT 01 Windows Software User Manual Version 1 0 48 A Demo Program void Wait_COM HWND hwnd int yy char cBuf 80 cShow 80 ch HDC hdc WORD ret i t hdc GetDC hwnd SelectObject hdc GetStockObject S YSTEM_FIXED_FONT
10. 3 E a eite atate dose 53 6 2 OUTPUTBYTE aon oet mime enim tutelle ome temo gasas 54 6 3 DIO INPUTBYTE 54 6 4 NAPWNTIT INTE thee eire nn eet bee pa i eh s 56 695 NAPWNISCEOSE oe tae aen tu ETT 56 7 DEMO FOR P16R16DIO 58 8 RS 232 DRIVER Haee 62 WDT 01 Windows Software User Manual Version 1 0 4 l Introduction The DOS software driver of WDT 01 is given in WDT 01 User Manual The function amp control details of WDT 01 are also given in that manual The user should refer to that manual for details first This software amp manual is designed for general purpose DIO amp RS232 Windows applications Therefore the user should refer to WDT 01 User Manual first then convert these DOS program into Windows program This software can be used in Windows 95 amp Windows NT The USRT H UART LIB amp UART DLL are designed for RS 232 applications The DIO H DIO LIB amp DIO DLL are designed for DIO applications A Disk Contents It is recommended to install this software driver to your hard disk and backup the companion floppy disk The contents of the companion floppy disk are given as following W95 VB symbol 224 M Wingdings s 12 gt VB demo W95 Delphi symbol 224 f Wingdings s 12 gt Delphi demo W95 Vbde
11. GetIntCount amp i if wRetVal 0 sprintf cShow 7 IntCount x 1 else sprintf cShow 7 GetIntCount Error TextOut hdc x dx y iLine dy cShow strlen cShow iLine Sleep 1000 DIO CloseVxd NOTE this function must call once before program exit if Vxd service functions are called Refer to manual for details ShowCaret hwnd WDT 01 Windows Software User Manual Version 1 0 33 ReleaseDC hwnd hdc WDT 01 Windows Software User Manual Version 1 0 34 3 DMA 1 IRQ 2 Now Setting Is gt Base 2c8 DMA 1 IRQ 5 1 DLL Uersion 183 2 5 SUB 2 1 2 1 3 FLORT SUB 2 1 8 2 0 1 888888 NAPDIO UXD Open OK 5 Uxd Uersion 181 6 Install Irq 0k 6 ResetIntCount OK 7 IntCount 8 7 IntCount 1 7 IntCount 2 7 IntCount 3 7 IntCount 4 7 IntCount 5 7 IntCount 5 7 IntCount 5 7 IntCount 5 7 IntCount 5 E is KE Ms Dos fist BY Microsoft Word Napwin Jl TESTDIO BASE ES 20501 WDT 01 Windows Software User Manual Version 1 0 35 RS 232 Driver A UART H define EXPORTS extern declspec dllexport return code for UART SEND STR define START SEND 1 define UART PORT ERR 2 define UART HANDLE ERR 3 define STR LENGTH ERR 4 return code for UART CLEAR INPUT BUFFER define UART NO ERR 0 define UART PORT ERR tdefine UART HANDLE ERR 3 return code for UART READ SEND STATUS
12. ORD CALLBACK DIO GetDIlVersion void EXPORTS void CALLBACK DIO OutputByte WORD wPortAddr WORD wOutputVal EXPORTS WORD CALLBACK DIO InputByte WORD wPortAddr EXPORTS WORD CALLBACK DIO OpenVxd void EXPORTS void CALLBACK DIO CloseV xd void EXPORTS WORD CALLBACK DIO GetVxdVersion Q WORD wVxdVersion EXPORTS WORD CALLBACK DIO InstallIrq WORD wBase WORD EXPORTS WORD CALLBACK DIO ResetIntCount void EXPORTS WORD CALLBACK DIO GetIntCount WORD wIntCount A DIO ShortSub2 DIO FloatSub2 test function A DIO CGetDllVersion test function WDT 01 Windows Software User Manual Version 1 0 24 A DIO OutputByte Description This subroutine will send the 8 bits data to the desired I O port Syntax void DIO OutputByte WORD wPortAddr WORD wOutputVal Input Parameter wPortAddr I O port address for example 0x220 wOutputVal 8 bits data send to I O port e Return Value void e Demo Program Refer to Sec 3 13 A DIO InputByte Description This subroutine will input the 8 bits data from the desired I O port Syntax WORD DIO InputByte WORD wPortAddr Input Parameter wPortAddr I O port address for example 0x220 Return Value 16 bits data with the leading 8 bits are all 0 WDT 01 Windows Software User Manual Version 1 0 25 e Demo Program Refer to Sec 3 13 WDT 01 Windows Software User Manual Version 1 0 26 DIO OpenVxd e D
13. PWNT SYS will be in NT system ONDURWNE Call DLLsr refer to Sec 2 1 MFC Call to Sec 2 2 BC Call DLLs refer to Sec 2 3 VB Call DLLsS refer to Sec 2 4 Delphi Call DLLs refer to Sec 2 5 Demo Programy refer to Sec 2 6 WDT 01 Windows Software User Manual Version 1 0 52 ll DIO This driver is design for DIO Cards amp WDT 01 Card me user must refer to the original User Manual for details A DIO H define EXPORTS define NoError 0 define OpenError 1 define DaChannelError 1 EXPORTS WORD CALLBACK NAPWNT INIT WORD wPort EXPORTS void CALLBACK NAPWNT CLOSE void EXPORTS void CALLBACK DIO OutputByte WORD wBase WORD wHex Value EXPORTS WORD CALLBACK DIO InputByte WORD wBase WDT 01 Windows Software User Manual Version 1 0 53 A DIO OutputByte Description This subroutine will send the 8 bits data to the desired I O port Syntax void DIO OutputByte WORD wPortAddr WORD wOutputVal Input Parameter wPortAddr I O port address for example 0x220 wOutputVal 8 bits data send to I O port e Return Value void e Demo Program Refer to chapter 7 A DIO InputByte Description This subroutine will input the 8 bits data from the desired I O port Syntax WORD DIO InputByte WORD wPortAddr Input Parameter wPortAddr I O port address for example 0x220 Return Value 16 bits data with the leading 8 bits are
14. W95 DELPHI UART DLL symbol 224 V Wingdings s 12 gt DLLs W95 DELPHI UNIT1 PAS symbol 224 V Wingdings 15 12 gt demo source file W95 DELPHI UNIT1 DFM symbol 224 Wingdings 12 gt form file W95 DELPHI PROJECT1 DPR symbol 224 V Wingdings s 12 gt project file NOTE 1 testing under Windows 95 and Delphi 2 0 32 bits 2 The UART PAS is designed for demo purpose and the UART PAS now only support SHORT SUB 2 A B The user can modify this file to support all DLLs unit UART interface function SHORT SUB 2 smallint b smallint smallint StdCall implementation function SHORT SUB 2 external UART DLL name SHORT SUB 2 end procedure TForml Buttonl Click Sender TObject var ab c smallint begin StrToInt Editl text WDT 01 Windows Software User Manual Version 1 0 12 b StrToInt Edit2 text SHORT_SUB_2 a b Edit3 text IntToStr c end end WDT 01 Windows Software User Manual Version 1 0 13 A Demo Program We use a common demo program for all ICP DAS C software demo program This demo program will accept the Base Address and DMA Channel Number and IRQ Channel Number and call the different DLLs for usage demonstration Note 1 Some demo program does not use any of these three value Note 2 Some demo program use these values in different name format or functions Note 3 The demo program given in this section is used as referenc
15. WDT O1 Windows Software User Manual Warranty All products manufactured by Acquire Inc are warranted against defective materials for a period of one year from the date of delivery to the original purchaser Warning Acquire Inc assume no liability for damages consequent to the use of this product Acquire Inc reserves the right to change this manual at any time without notice The information furnished by Acquire Inc is believed to be accurate and reliable However no responsibility is assumed by Acquire Inc for its use nor for any infringements of patents or other rights of third parties resulting from its use Copyright Copyright 1997 by Acquire Inc All rights are reserved Trademark The names used for identification only maybe registered trademarks of their respective companies License The user can use modify and backup this software ON single machine The user may not reproduce transfer or distribute this software or any copy in whole or in part WDT 01 Windows Software User Manual Version 1 0 1 WDT 01 Windows Software User Manual Version 1 0 2 Table of Contents 1 INTRODUCTION serv 5 1 1 DISK CONTENTS e gi aR saa 5 2 WINDOWS 95 APPLICATIONS T T tota sata esee etes tni 7 21 UC CALE DELS iiS INI da RAE 7 22 MEC CALLE DEES aite bad Anti ea i Ate MAA idees 7 2 3 BOE
16. all 0 WDT 01 Windows Software User Manual Version 1 0 54 e Demo Program Refer to chapter 7 WDT 01 Windows Software User Manual Version 1 0 55 A NAPWNT_INIT Description Initialize the NAPWNT DLLs This function must be called before the other DLLs Syntax WORD NAPWNT WORD wBase Input Parameter wBase I O port base address Return Value 0x8000 invalidate handle 0x4000 open handle error NoError OK Demo Program Refer to chapter 7 A NAPWNT CLOSE Description Close the NAPWNT DLLs This function must be called before program stop Syntax WORD NAPWNT CLOSE void Input Parameter void Return Value 0x1000 status error NoError OK WDT 01 Windows Software User Manual Version 1 0 56 e Demo Program Refer to chapter 7 WDT 01 Windows Software User Manual Version 1 0 57 Demo for P16R16DIO void TEST CMD HWND hwnd int x int dx int y int dy char cBuf 80 cShow 80 HDC hdc WORD wRetVal wChannel wConfig wType wBuf 10 wCount i j wData w Val short nRetVal float fRetVal fVal fBuf 10 if 0 need to init once NAPWNT INIT wBase wOpen 1 iLine 0 hdc GetDC hwnd HideCaret hwnd SelectObject hdc GetStockObject SYSTEM FIXED FONT sprintf cShow TextOut hdc x dx y iLine dy cShow strlen cShow iLine sprintf cShow Now Set
17. e The user should refer to C given in floppy disk for details include lt windows h gt include lt stdlib h gt include lt stdio h gt include lt conio h gt include h void READ_CMD char short ASCII_TO_HEX char void TEST CMD HWND int int int int LRESULT CALLBACK WndProc HWND UINT WPARAM LPARAM short nDMA 1 nIRQ 1 WORD wBase 0x220 int iLine int WINAPI WinMain HINSTANCE hInstance HINSTANCE hPrevInstance PSTR szCmdLine int iCmdShow static char szAppName TestA822 HWND hwnd MSG msg WDT 01 Windows Software User Manual Version 1 0 14 WNDCLASSEX wndclass WDT 01 Windows Software User Manual Version 1 0 15 wndclass cbSize sizeof wndclass wndclass style CS HREDRAWICS VREDRAW wndclass lpfnWndProc WndProc wndclass cbClsExtra 0 wndclass cbWndExtra 0 wndclass hInstance hInstance wndclass hIcon LoadIcon NULL IDI APPLICATION wndclass hCursor LoadCursor NULL IDC ARROW wndclass hbrBackground HBRUSH GetStockObject WHITE BRUSH wndclass lpszMenuName NULL wndclass lpszClassName szAppName wndclass hIconSm LoadIcon NULL IDI APPLICATION RegisterClassEx amp wndclass hwnd CreateWindow szAppName TESTA822 BASE 3 DMA 1 IRQ 2 WS_OVERLAPPEDWINDOW CW_USEDEFAULT CW_USEDEFAULT CW_USEDEFAULT CW_USEDEFAULT NULL NULL hInstance NULL Show Window hwnd iCmdShow Update Window hwnd while Ge
18. escription This subroutine will open the NAPDIO VxD If the user use Interrupt this function must be called once before the related functions are called e Syntax WORD DIO OpenVxd e Input Parameter void Return Value NoError OK VxdOpenError open NAPDIO VxD error copy NAPDIO VxD into c windows system vxd e Demo Program Refer to Sec 3 13 A DIO CloseVxd Description This subroutine will close the NAPDIO VxD e Syntax void DIO CloseVxd e Input Parameter void e Return Value void e Demo Program Refer to Sec 3 13 WDT 01 Windows Software User Manual Version 1 0 27 DIO GetVxdVersion e Description 2 This subroutine will read the version number of NAPDIO VxD e Syntax WORD DIO GetVxdVersion Q WORD wV xdVersion e Input Parameter wVxdVersion address of wVxdVersion Return Value NoError OK VxdNoOpen NAPDIO VxD no open Get V xdVersionError read VxD version error e Demo Program Refer to Sec 3 13 A DIO Installirq e Description This subroutine will install the IRQ service routine e Syntax WORD DIO InstallIrq WORD wBase WORD wlrq Input Parameter wBase I O base address of board IRQ channel number Return Value NoError OK VxdNoOpen the NAPDIO VxD no open InstallIrqError IRQ installation error e Demo Program Refer to Sec 3 13 WDT 01 Windows Software User Manual Version 1 0 28 WDT 01 Windows
19. fer to W95 BAT 10 Execute the batch file 222 11 Execute the execution file exe NOTE The lib is used in linking time the DLL is used in execution time A MFC Call DLLs The usage of UART DLL for MFC user is very similar to that for C user It is testing OK under Windows 95 and Visual C 4 0 The key points are given as following Use MFC wizard to create source code The source program must include H Copy the LIB import library to the same directory with source program Copy the DLL to the same directory with source program Select Build Settings Link and key UART LIB in the object library modules field WDT 01 Windows Software User Manual Version 1 0 7 A BC Call DLLs The DLLs are created by Visual C 4 0 The H and lib are also designed for Visual C C The BC can not use this two file The modification part is given below include lt conio h gt include lt windows h gt HINSTANCE hDLLLib Step 1 declare a functionpointer float CALLBACK FLOAT SUB 2 flaot fA float fB main Step 2 load dll hDIILib LoadLibrary dIl if hDLLLib Step 3 get the function address FLOAT_SUB_2 FARPROC GetProcAddress hDLLLib FLOAT_SUB_2 if FLOAT SUB 2 Step 4 call function printf 1 2 3 4 f FLOAT_SUB_2 1 2 3 4 else printf get FLOAT SUB 2
20. function address error Step 5 free library FreeLibrary hDLLib else printf load dll error getch This usage can be divided into 5 steps listing above Using this modification WDT 01 Windows Software User Manual Version 1 0 8 and DLL the user can use BC to call DLLs WDT 01 Windows Software User Manual Version 1 0 9 A VB Call DLLs W95 VB UART DLL DLLs W95 VB FROM1 FRM and source file W95 VB MODULE1 BAS declare file W95 VB PROJECT1 VBP project file symbol 224 V Wingdings s 12 gt symbol 224 V Wingdings 12 gt form symbol 224 V Wingdings S 12 gt symbol 224 X Wingdings 12 gt NOTE 1 Testing under Windows 95 and VB 4 0 32 bits 2 The MODULEI BAS designed for demo purpose and the MODULEI BAS now only support SHORT SUB 2 A B The user can modify this file to support all DLLs Module1 BAS Attribute VB Name 1 Declare Function SHORT SUB 2 Lib a w95 vb uart dll ByVal As Integer ByVal b As Integer As Integer FORM1 FRM partial WDT 01 Windows Software User Manual Version 1 0 10 Private Sub Command1_Click Dim a As Integer b As Integer c As Integer Val Text1 Text b Val Text2 Text SHORT_SUB_2 a b Text3 Text c WDT 01 Windows Software User Manual Version 1 0 11 A Delphi Call DLLs W95 DELPHI UART PAS symbol 224 V Wingdings s 12 gt unit file
21. mand string Syntax WORD OPEN COM char cPort DWORD dwBaudRate char cChecksum e Input Parameter cPort 1 COM1 2 2 3 COM3 4 COM4 others invalidate dwBaudRate 1200 2400 4800 9600 19200 38400 others invalidate cChecksum reserved e Return Value 1 open COM OK 2 port number error validate only foe 1 2 3 4 3 baud rate value error validate only for 1200 2400 4800 9600 19200 38400 57600 115200 4 open COM port error 5 set COM port mask error 6 set buffer size error 7 set time out error 8 set DCB error e Demo Program Refer to Sec 4 14 WDT 01 Windows Software User Manual Version 1 0 41 A CLOSE COM e Description This function will free all the resources used by OPEN_COM This function must be called after program exit The OPEN_COM will return error message if the program exit without calling CLOSE_COM function Syntax BOOL CLOSE_COM char cPort e Input Parameter cPort 1 COM1 2 COM2 32COM3 others invalidate e Return Value 1 close COM 0 port number error validate only foe 1 2 3 4 e Demo Program Refer to Sec 4 14 WDT 01 Windows Software User Manual Version 1 0 42 A SEND CMD reserved B READ STATUS reserved A UART SEND STR e Description This function will create a thread to send out string The input string is terminated with 0 After create the thread this function will return to
22. mo symbol 224 f Wingdings s 12 gt for all DIO cards W95 DIO symbol 224 f Wingdings s 12 gt for all DIO cards W95 RS232 symbol 224 f Wingdings s 12 gt for all RS 232 application WNT SYS symbol 224 f Wingdings s 12 gt for driver registration WNT Vbdemo symbol 224 f Wingdings s 12 gt for all DIO cards WNT DIO symbol 224 f Wingdings s 12 gt for all DIO cards WNT RS232 symbol 224 f Wingdings s 12 gt for all RS 232 application Refer to chapter 2 3 4 for Win 95 applications WDT 01 Windows Software User Manual Version 1 0 5 Refer to chapter 5 6 7 8 for Win NT applications WDT 01 Windows Software User Manual Version 1 0 6 l Windows 95 Applications A Call DLLs All the demo program given in W95 are designed with C language It is testing OK under Windows 95 and Visual C 4 0 compiler The key points are given as following 1 Enter the DOS command prompt under Windows 2 Make sure the PATH include the Visual C compiler 3 Execute the MSDEV BIN VCVARS32 BAT time to setup the environment The VCVARS32 BAT is provided by Visual C The source program must include Copy the LIB import library to the same directory with source program Copy the DLL to the same directory with source program Edit the source program refer to W95 C Edit the NMAKE file refer to W95 MAK Edit the BATCH file re
23. n cShow iLine DIO OutputByte 0x300 0xAA RO R7 OFF Sleep 500 wRetVal DIO_InputByte 0x300 sprintf cShow 2 RO R7 0xAA gt read back x wRetVal TextOut hdc x dx y iLine dy cShow strlen cShow iLine DIO OutputByte 0x301 0x55 RO R7 OFF Sleep 500 WDT 01 Windows Software User Manual Version 1 0 60 wRetVal DIO_InputByte 0x301 sprintf cShow 3 R8 R15 0x55 read back x wRetVal TextOut hdc x dx y iLine dy cShow strlen cShow iLine DIO OutputByte 0x301 0xAA RO R7 OFF Sleep 500 wRetVal DIO_InputByte 0x301 sprintf cShow 4 8 15 read back x wRetVal TextOut hdc x dx y iLine dy cShow strlen cShow iLine ret_label ShowCaret hwnd ReleaseDC hwnd hdc WDT 01 Windows Software User Manual Version 1 0 61 RS 232 Driver Refer to Chapter 4 for details The UART DLL is WIN32 driver It can be run in the Windows 95 amp Windows NT WDT 01 Windows Software User Manual Version 1 0 62
24. t 1 ShowCaret hwnd ReleaseDC hwnd hdc break case r carriage return pressed cBuf xCaret 0 if xCaret 0 xCaret 0 yCaret READ CMD cBuf TEST CMD hwnd xCaret cxChar yCaret cyChar xCaret 0 yCaret iLine if yCaret gt cyBuffer InvalidateRect hwnd NULL TRUE break case 1 escape pressed InvalidateRect hwnd NULL TRUE xCaret yCaret 0 break WDT 01 Windows Software User Manual Version 1 0 18 default other KEY pressed cBuf xCaret char wParam HideCaret hwnd hdc GetDC hwnd SelectObject hdc GetStockObject S YSTEM_FIXED_FONT TextOut hdc xCaret cx Char yCaret cyChar cBuf xCaret 1 ShowCaret hwnd ReleaseDC hwnd hdc xCaret 4 break SetCaretPos xCaret cxChar yCaret cyChar return 0 case WM_PAINT clr and show HELP InvalidateRect hwnd NULL TRUE hdc BeginPaint hwnd amp ps SelectObject hdc GetStockObject S YSTEM FIXED FONT sprintf cBuf NOW gt Base x DMA d IRQ d wBase nDMA nIRQ TextOut hdc 0 0 cBuf strlen cBuf xCaret 0 yCaret 1 SetCaretPos 0 yCaret cyChar EndPaint hwnd amp ps return 0 case WM_DESTROY PostQuitMessage 0 return 0 return DefWindowProc hwnd iMsg wParam IParam WDT 01 Windows Software User Manual Version 1 0 19 O 1 2 base_address 4J DMA 6 7 IRQ void READ_CMD char szCmd short nT 1 nT2 nT3 if szCmd 0 0 return
25. t SHORT SUB 2 short nA short nB Input Parameter nA short integer nB short integer Return Value WDT 01 Windows Software User Manual Version 1 0 37 return nA nB symbol 224 f Wingdings s 12 gt short integer e Demo Program void WDT 01 Windows Software User Manual Version 1 0 38 A FLOAT SUB 2 Description Compute C A B in float format float 32 bits floating pointer number This function is provided for testing purpose To test this DLLs can be called by your programming language call this subroutine for testing If this subroutine return the correct value the other DLLs will work OK also Syntax float FLOAT SUB 2 fA float fB Input Parameter fA floating point value fB floating point value Return Value return fA fB symbol 224 V Wingdings 12 gt floating point value e Demo Program void A Get DLL Version Description Read the software version of the NAP6000 DLLs Syntax WORD Get DLL Version void Input Parameter void Return Value return 0x 102 symbol 224 V Wingdings 12 gt Version 1 2 WORD 106 bits WDT 01 Windows Software User Manual Version 1 0 39 unsigned integer e Demo Program void WDT 01 Windows Software User Manual Version 1 0 40 A OPEN COM e Description This function will initialize the COM port This function must be called before sending any com
26. tMessage amp msg NULL 0 0 TranslateMessage amp msg DispatchMessage amp msg return msg wParam WDT 01 Windows Software User Manual Version 1 0 16 LRESULT CALLBACK WndProc HWND hwnd UINT iMsg WPARAM wParam LPARAM IParam static int cxChar cyChar cxClient cyClient cxBuffer cyBuffer xCaret yCaret static char cBuf 80 HDC hdc TEXTMETRIC tm PAINTSTRUCT ps int 1 switch Msg case WM_CREATE window initial hdc GetDC hwnd SelectObject hdc GetStockObject S YSTEM_FIXED_FONT GetTextMetrics hdc amp tm cxChar tm tmA veCharWidth cyChar tm tmHeight ReleaseDC hwnd hdc return 0 case WM_SIZE cxClient LOWORD lParam window size in pixels cyClientZHIWORD lIParam cx Buffer max 1 cxClient cxChar window size in characters cyBuffer max 1 cyClient cyChar return 0 case WM_SETFOCUS CreateCaret hwnd NULL cxChar cyChar SetCaretPos xCaret cxChar yCaret cyChar ShowCaret hwnd return 0 case WM_KILLFOCUS HideCaret hwnd DestroyCaret return 0 WDT 01 Windows Software User Manual Version 1 0 17 case WM CHAR user press KEYBOARD for 120 1 int LOWORD lParam i switch wParam case b backspace pressed if xCaret gt 0 xCaret cBuf xCaret HideCaret hwnd hdc GetDC hwnd SelectObject hdc GetStockObject S YSTEM_FIXED_FONT TextOut hdc xCaret yCaret cyChar cBuf xCare
27. the caller at once So the caller and the thread will be executed in multitasking environment The thread will auto terminated when the input string is sent over The caller can call READ SEND STATUS to read the status of this thread Syntax WORD UART SEND STR char cPort char szCmd e Input Parameter cPort 1 COM1 2 COM2 32COM3 others invalidate szCmd the starting address of the command string e Return Value UART START SEND create a thread to send input string and return at once UART PORT ERR port number error validate for 1 2 3 4 only UART HANDLE ERR COM port not initialize or OPEN ERROR UART STR LENGTH ERR input string too long WDT 01 Windows Software User Manual Version 1 0 43 e Demo Program Refer to Sec 4 14 WDT 01 Windows Software User Manual Version 1 0 44 UART CLEAR INPUT BUFFER Description This function will clear the UART input buffer Syntax WORD UART CLEAR INPUT BUFFER char cPort Input Parameter cPort 1 COM1 2 COM2 32COM3 others invalidate Return Value UART NO ERR function OK UART PORT ERR port number error validate for 1 2 3 4 only UART HANDLE ERR COM port not initialize or OPEN ERROR Demo Program void A UART READ SEND STATUS Description This function will read the status of the send thread Syntax WORD UART READ SEND STATUS char cPort Input Parameter cPort 1 COM1 2
28. ting Is gt Base x DMA d IRQ d wBase nDMA nIRQ TextOut hdc x dx y iLine dy cShow strlen cShow iLine DIO_OutputB yte Ox7ff4 0x55 wRetVal DIO_InputByte Ox7ff4 sprintf cShow 0 0x55 read back x wRetVal TextOut hdc x dx y iLine dy cShow strlen cShow iLine DIO_OutputB yte Ox7ff4 0xAA wRetVal DIO_InputByte Ox7ff4 WDT 01 Windows Software User Manual Version 1 0 58 sprintf cShow 0 OxAA gt read back x wRetVal TextOut hdc x dx y iLine dy cShow strlen cShow iLine WDT 01 Windows Software User Manual Version 1 0 59 DIO_OutputB yte 0x7f7c 0x00 wRetVal DIO_InputByte 0x7f7c sprintf cShow 0 0x00 gt read back x wRetVal TextOut hdc x dx y iLine dy cShow strlen cShow iLine DIO_OutputB yte Ox7f7c 0xff wRetVal DIO_InputByte 0x7f7c sprintf cShow 0 Oxff gt read back x wRetVal TextOut hdc x dx y iLine dy cShow strlen cShow iLine goto ret_label this demo is validate for PI6R16 for 120 1 lt 3 i relays ON OFF 5 times DIO_OutputB yte 0x300 0x00 RO R7 OFF DIO OutputByte 0x301 0x00 R8 R15 OFF Sleep 500 DIO OutputByte 0x300 0xff RO R7 ON DIO OutputByte 0x301 0xff R8 RIS ON Sleep 500 DIO_OutputB yte 0x300 0x55 RO R7 OFF Sleep 500 wRetVal DIO_InputByte 0x300 sprintf cShow 1 RO R7 0x55 gt read back x wRetVal TextOut hdc x dx y iLine dy cShow strle

Download Pdf Manuals

image

Related Search

Related Contents

LC-Power LC-CH-USB mobile device charger  Gestionnaire d`impression - Infoscience  Epson Stylus Photo 890 Ink Jet Printer Product Brochure  Epson EB-Z8150  KALCD22DVDAB USER MANUAL  Respireo Primo F  

Copyright © All rights reserved.
Failed to retrieve file