全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:3014
推到 Plurk!
推到 Facebook!

Funtions in VVIO.dll 網站

 
conundrum
尊榮會員


發表:893
回覆:1272
積分:643
註冊:2004-01-06

發送簡訊給我
#1 引用回覆 回覆 發表時間:2005-06-08 02:02:12 IP:218.175.xxx.xxx 未訂閱
http://www.vincenzov.net/eng/design/vviodll.htm VincenzoV tiny page Funtions in VVIO.dll -------------------------------------------------------------------------------- Home page - Table of contents - Design - Not only electronics - Mail -------------------------------------------------------------------------------- VVIO.dll is a MS-Windows Dynamic Link Library destined to facilitate the support of home-made hardware devices; it allow you to write interfaces to hardware with any language supporting 32 bit DLL, included those that, as Microsoft Visual Basic and Borland Delphi, do not have instructions of input/output. Who will need this software ? Who loves electronics hobby and want to design PC hardware but does not have time or know-how in order to write a device driver. Time ago they used the peek/poke of the basic or in/out of the TurboC but then uncovered Windows does not allow any I/O the instructions... On the internet you can find some workaround using specific DLL but only a little number of those are free and compatible with Windows 95, 98, Me, NT, 2000 and XP with no high level software modification. And perhaps none is distributed with source code! Who wants to use hardware that I have designed writing just high level code without getting lost in the hardware direct programming. -------------------------------------------------------------------------------- This DLL will work in two deeply different modalities, one adapted for any Windows systems and a more specific one for Windows based on "NT technology". The functionalities and the interface to the high level code remain however identical. Windows (all versions) You can use this modality on all windows version, from Windows95 to Windows XP; it is based on the I/O mechanism from LabWindows/CVI; in some cases, this is a slow way. For the use of the DLL in this modality it is not necessary any installation: you only need to copy the DLL where your program resides or in the system folder (windows\system32 or winnt\system32). It is necessary to install before the LW/CVI run time engine. Windows NT, 2000, XP Using Windows versions derived from WinNT the access to hardware devices is optionally made also through VVIO.SYS device driver. Without any high level code modification in some cases large increase of performances are possible. In order to use this modality it is necessary to install the device driver VVIO.sys and to use, at the beginning of your code, the function of activation. It is necessary to install before the LW/CVI run time engine. -------------------------------------------------------------------------------- The DLL is written using LabWindows/CVI, an ANSI C compiler, but is usable with any language supporting 32 bit DLLs. Some of my design are distributed with sample code in Visual Basic and LabWindows/CVI (see this table) You will find binary and source code source, free of charge but with use conditions I pray you to read with attention. When the DLL is loaded, it shows a copyright window. If it annoys you, you can read at the end of the page. -------------------------------------------------------------------------------- Starting here, a short description of functions in VVIO.dll using C syntax. Visual Basic users will find also the VVIO.bas file with the same functions prototype using VB syntax. You will find the list of returned error codes in errorVVIO.h file : all errors codes are minor then zero. VVIO.dll: global function void VVIO_SetNtMode (void) Try to set NT mode for NT/2000/XP, for higher performance. This is an optional function, default mode work with all windows version. If function fails (wrong OS, no VVIO.sys installed, wrong VVIO.sys version...) a pop-up windows is show and program will continue as default mode. void VVIO_SlowDown (short int slow) Slow down I/O operation. This function is required required using high speed LPT and low spped external hardware as opto-isolated or I2C devices. Argument: slow: default value "0" mean higher speed. "1" double I/O time, "2" treble and so on. Higher value add others "wait states" and values over "3" should be too slow. Note: this function set a global parameter but you can change it "o the fly". VVIO.dll: generic input /output short int VVIO_in (int addr) Read a byte from device on address addr. No test is performed and this function should be used carefully: random use may hangs-up PC! Arguments: addr: the port from which to read the byte. Value: 0... 65535. Return the byte read from the port (0... 255) void VVIO_out (int addr, short int data) Write a byte to hardware address. No test is performed and this function should be used carefully: random use may hangs-up PC! Arguments: addr: the port to which the byte will be written. Values: 0... 65535 data: the byte to be written to the port. Values: 0... 255. VVIO.dll: using parallel port short int VVIO_LPT_GetNumberFromBios (short int *lpt1, short int *lpt2, short int *lpt3) Return numbers and address of parallel port form BIOS. Note that some BIOS can't see PCI port. Arguments: lpt1 (by reference): LPT1 address. 0 mean non port lpt2 (by reference): LPT2 address. 0 mean non port lpt3 (by reference): LPT3 address. 0 mean non port Return numbers of LPT (0... 3). Negative return code means error. short int VVIO_LPT_Lock (short int lpt) This function try to lock LPT for other process. I think this function will not work on all windows version (but no problems if you use it!). Argument: lpt: LPT number (i.e. "1" for lpt1) short int VVIO_LPT_Inizialize (short int lptnum, int lptaddr) Set some internal variables required for using parallel port. You need to invoice this function only one time at the begin of your program and before any VVIO_LPT_xxx() function call. Arguments: lptnum: LPT number (i.e. "1" for lpt1). Theoretical this should be a "random" number in 0... 5 range but this isn't an advisable choice. lptaddr: LPT hardware address (i.e. 0x278, 0x378, 0xD000...) short int VVIO_LPT_GetStatus (short int lpt) Read five bit from status register. Arguments: lpt: LPT number used in VVIO_LPT_Inizialize() Return a 16 bit word (but only 5 are valid), where any single bit reflect LPT pin status: 0, 0 , 0 , 0, 0, 0 , 0 , 0 busy, ack, paper_out, select, error, 0, 0, 0. If return code < 0, an error code has been generated. Note: bit values reflect pin status ("1" means high voltage level), not register status. short int VVIO_LPT_WriteData (short int lpt, short int data) Write date (eight bit) on parallel port lpt. Arguments: lpt: LPT number used in VVIO_LPT_Inizialize() data: data to write, values from 0 to 255. short int VVIO_LPT_WriteControl (short int lpt, short int strobe, short int linefeed, short int inizialize, short int select) Write four bit to control register Arguments: lpt: LPT number used in VVIO_LPT_Inizialize() strobe, linefeed, inizialize, select: bits to write. "0" means low level voltage even if lpt has an hardware inverter on this line. VVIO.dll: mini-datalogger functions short int VVIO_MAX147_Inizialize(short int lptnum, short int lptaddr) Power-on the circuit and set-up some internal variables. Execution time is a bit long (100 ms) because it needs some settling time. You need to invoice this function only one time at the begin of your program and before any VVIO_MAX_xxx() function call. Arguments: lptnum: LPT number (i.e. "1" for lpt1). Theoretical this should be a "random" number in 0... 5 range but this isn't an advisable choice. lptaddr: LPT hardware address (i.e. 0x278, 0x378, 0xD000...) short int VVIO_MAX147_GetVolt (short int lptnum, short int ch, double *volt) Read a voltage from a single mini-datalogger channel. Your program should calculates effects of Ra and Rb. Arguments: lptnum: LPT number used in VVIO_MAX147_Inizialize() ch: channel where read; values from 0 to 7 volt (by reference): voltage read back from ADC, values from 0 to 2,499 short int VVIO_MAX147_GetSamples (short int lptnum, double volt[]) Read voltages from all mini-datalogger channels. Your program should calculates effects of Ra and Rb. Arguments: lptnum: LPT number used in VVIO_MAX147_Inizialize() volt[8](by reference): eight values array where to store voltages read back from ADC. Values from 0 to 2.499 VVIO.dll: iso-buffer related functions short int VVIO_CD4094_Inizialize (short int LPT, short int lptAddr) Set up hardware and internal variables for a generic circuit based on iso-buffer. Arguments: LPT: LPT number (i.e. "1" for lpt1). Theoretical this should be a "random" number in 0... 5 range but this isn't an advisable choice. lptAddr: LPT hardware address (i.e. 0x278, 0x378, 0xD000...) short int VVIO_CD4094_Write (short int LPT, short int ch, short int data, short int immediate) Write a 16 bit word to a generic circuit based on iso-buffer. Arguments: LPT: LPT number used in VVIO_CD4094_Inizialize() data: 16 bits data to write ch: channel where to write data. Values from 1 to 6 immediate: if equals to "1", function writes data immediately, otherwise only internal variables are updated ad effective write to hardware is delayed to next call to VVIO_CD4094_Write. If no write to hardware is performed, speed is higher. short int VVIO_CD4094_18245 (short int LPT, short int ch, short int dacInput1, short int dacInput2, short int immediate) Write data to a LMD18248 based hardware (as example, see micro- step driver). Arguments: LPT: LPT number used in VVIO_CD4094_Inizialize() ch: channel where to write data. Values from 1 to 6 dacInput1: current for first H-bridge; values from -15 to 15) dacInput2: current for second H-bridge; values from -15 to 15) immediate: see VVIO_CD4094_Write() short int VVIO_CD4094_NextStepBipolar (short int LPT, short int ch, short int microstep, short int immediate) The motor do a single rotation step equals to one or more micro-step. For motor continue rotation you should invoice this function at regular interval. See micro-step driver for more details about hardware. Arguments: LPT: LPT number used in VVIO_CD4094_Inizialize() ch: channel where to write data. Values from 1 to 6. Note that each channel drive a different motor. microstep: number of micro-step to do as a single "step". Values should be in range from -CD4094_uS/4 to CD4094_uS/4 (constant equals to 64=256/4); should be good practice select power of two values and avoid change of this value during motor rotation. As example "64" means full step rotation, "32" 'half-step with torque control, "-1" a single microstep in reverse direction. immediate: see VVIO_CD4094_Write() short int VVIO_CD4094_NextStepUnipolar (short int LPT, short int ch, short int motor, short int step, short int immediate) The motor do a step or half step. For motor continue rotation you should invoice this function at regular interval. See step driver for more details about hardware. Arguments: LPT: LPT number used in VVIO_CD4094_Inizialize() ch: channel where to write data. Values from 1 to 6. Note that each channel drive two different motor. motor: motor to rotate (0 or 1) step: 2 (or -2) mean full step rotation, 1 (or -1) mean half step rotation. immediate: see VVIO_CD4094_Write() -------------------------------------------------------------------------------- How to collaborate with me... When DLL is loaded a copyright windows is showed. To avoid this little trouble is enough to comment out a single line in source code... In this, there are two problems: is not polite... you may violate license To have a legal DLL without copyright splash screen, I need just a bit of your time: help me to improve VVIO project! You will add my copyright note with your-own copyright note or elsewhere you want. To help me, you can: Correct bugs in code Correct documentation (I think you don't like my poor English...) Send me your-own code using my DLL (I'll publish it on this site as your work) Add new features (a to-do list is coming) Use DLL and send me a report (OS, Language, hardware, benchmark...) Obviously if your contribute is relevant, I'll add your name to contributors list. -------------------------------------------------------------------------------- All the files in VVIO project are contained in VVIO.tgz compressed file. license The use license basicVVxx.x Source files DLL\ The DLL for windows SYS\ The device driver for windows NT / 2000 / XP These circuits are supported from VVIO project: Mini-datalogger: a 8 channel / 12 bit ADC connect to parallel port Micro-step driver: driving up to six bipolar stepper motor with a single parallel port Step driver: driving up to twelve unipolar stepper motor or up to 48 DC load The documentation is available to the following pages VVIO: a library for I/O: general description Functions in basicVVIO.c: Dos, Windows, Linux Funtions in VVIO.dll: all windows versions IOCTL in VVIO.sys: Windows NT / 2000 / XP -------------------------------------------------------------------------------- VVIO - Version 0.2 - August 2003 Copyright ?2003, Vincenzo Villa, Casatenovo (LC), Italy The use license to read and to accept before using the product MS-DOS, Windows 95, 98, Me, NT, 2000, Xp, VisualBasic, VisualC are Microsoft trademarks Delphi e TurboC are Borland trademarks LabWindows/CVI is a National Instruments trademark Linux is a Linus Torvald trademark gcc e GNU are Free Software Foundation, Inc trademark This document is available in its integral shape on site http://www.vincenzov.net. -------------------------------------------------------------------------------- Home page - Table of contents - Design - Not only electronics - Mail -------------------------------------------------------------------------------- Versione italiana del sito All my webs and e-mail address
系統時間:2024-04-27 13:10:26
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!