by orosmagno » Tue May 22, 2007 1:15 pm
activa los puertos seriales para leer y escribir
los uso en una aplicacion de lector con trajetas de credito y debito.
Gracias.
Functions For IOLib
Values for INIT_PORT can be seen in IOLib.ch
Version 1.2r1
*******************************************************************************
INIT_PORT(Nx_port,Nbaud,Ndata,Nparity,Nstop,Nirq,@cIn_buffer) => log
Initializes the communication port and sets up the input bufferd stream
Pass:
Nx_port= base port value see IOLib.ch
Nbaud= The baud rate divisor see IOLib.ch for standard bauds
Ndata=data bits 5 to 8
Nparity= Parity value see IOLib.ch
Nstop=number of stop bits
Nirq=Interrupt number
cIn_buffer= a public String variable 512 bytes or larger, no more
than 32k, ie <Public cIn_buffer:=SPACE(4000) > This option may change
in the future to a numeric value for buffer size.
******************************************************************
OUTC(nVar,[nPort])
Sends a value out the communication port, default port is
the one used by INIT_PORT(), optional any port.
This function will wait a short time for the port to become
available.
nVar= a numeric value 0 to 255
nPort=hardware Port number to send the value
NOTE: nPort not available in BETA version.
******************************************************************
OUTCHR(@cString) =log
Spools a string out the Initialized port cString must not be larger
than 32k, and no smaller than 1 byte, it may contain imbeded null
bytes. The cString must remain public and can not be cleared until
the buffer is clear see OUTBUFSIZE()
Returns False if another stream is still spooling.
*******************************************************************
INCHR(nVar) => cVar
Returns one or more bytes communication port input buffer.
Maximum is INITSIZE-1
Note: Returns NIL if no byte available do not mistake with chr(0)
Example:
cVar:=INCHR(1)
do case
case cVAR=NIL
* do nothing
case cVar=chr(0)
* received break
otherwise
?? cVar
endcase
***************************************************************
UNINT_PORT()
returns NIL
Uninitializes the communication port, this MUST be done before
exiting program. Best use the following function.
EXIT PROCEDURE cleanup()
CLS
UNINT_PORT()
? "Port Uninitialized, program terminating............."
RETURN
*********************************************************
ISWORKING() =>Log
Returns TRUE if IRQ is working, the byte is set by the input/ouput
spooler.
********************************************************
ISONLINE() => log
Returns True if modem online
*********************************************************
IOLIB_VER() =>cString
Returns character string of IO version
**********************************************************
SETDTR([lVar]) =>log
returns .t. if DTR has been set, otherwise false optional lVar
will set the DTR .
EXAMPLE:
LOCAL l_DTR
l_DTR:=SETDTR(.T.)
*************************************************************************
SETRTS([lvar]) => log
returns .t. if RTS has been set, otherwise false optional lVar
will set the RTS .
EXAMPLE:
LOCAL l_RTS
l_DTR:=SETRTS(.T.)
**************************************************************************
DSR() => log Returns .T. if DSR set better than Xon/Xoff
**************************************************************************
CTS() => log Returns .T. if CTS set better than Xon/Xoff
**************************************************************************
Note: You may use DTR/DSR as a Hardware version of Xon/Xoff
or you may use RTS/CTS. Or none.
If changing the IRQ, you must use UNINT_PORT() before
using INIT_PORT()
**************************************************************************
INBUFSIZE() => Num
Returns a numeric value of how many characters remain in the inbuffer.
Input buffer can hold up to one less than the init size.
**************************************************************************
OUTBUFSIZE() => Num
Returns a numeric value of how many characters remain in the ouput stream.
**************************************************************************
INBUFCLR()
clears the input buffer, all waiting characters are lost.
**************************************************************************
OUTBUFCLR()
clears the output buffer, all waiting characters are lost.
**************************************************************************
CHKCRC(cString)=> cCrc
Returns a 3 byte string pertaining to passed string.
First byte is the checksum
Second and third are a 16 bit CRC
**************************************************************************
Microsoft (R) Library Manager Version 3.10
Copyright (C) Microsoft Corp 1983-1988. All rights reserved.
CHKCRC............io CTS...............io
DSR...............io INBUFCLR..........io
INBUFSIZE.........io INCHR.............io
INIT_PORT.........io INPORT............io
IOLIB_VER.........io ISONLINE..........io
ISWORKING.........io OUTBUFCLR.........io
OUTBUFSIZE........io OUTC..............io
OUTCHR............io OUTPORT...........io
SETDTR............io SETRTS............io
SIZEO.............io UNINT_PORT........io
io Offset: 00000010H Code and data size: 7ceH
CHKCRC CTS DSR INBUFCLR
INBUFSIZE INCHR INIT_PORT INPORT
IOLIB_VER ISONLINE ISWORKING OUTBUFCLR
OUTBUFSIZE OUTC OUTCHR OUTPORT
SETDTR SETRTS SIZEO UNINT_PORT