mandar imprimir na SERIAL
Moderador: Moderadores
mandar imprimir na SERIAL
Tenho um impressora espon de 40 coluna, ela nao tem porta paralela so serial, queria saber qual o comando que vou usar para imprimir.
Prezado Colega
Para imprimir na serial você deve executar os seguintes comandos antes no prompt do DOS :
// Para uso na COM1
mode com1:9600,n,8,1
mode lpt2:=com1:
ou
// Para uso na COM2
mode com2:9600,n,8,1
mode lpt2:=com2:
Para testar se está funcionando execute a linha abaixo no prompt do DOS :
DIR >LPT2
Se imprimir é porque está funcionando beleza, aí é só você criar um BAT para chamar estes comandos antes do seu sistema.
Depois disso é só redirecionar normalmente em seu programa
SET PRINTER TO LPT2
Até logo.
Marcelo
Para imprimir na serial você deve executar os seguintes comandos antes no prompt do DOS :
// Para uso na COM1
mode com1:9600,n,8,1
mode lpt2:=com1:
ou
// Para uso na COM2
mode com2:9600,n,8,1
mode lpt2:=com2:
Para testar se está funcionando execute a linha abaixo no prompt do DOS :
DIR >LPT2
Se imprimir é porque está funcionando beleza, aí é só você criar um BAT para chamar estes comandos antes do seu sistema.
Depois disso é só redirecionar normalmente em seu programa
SET PRINTER TO LPT2
Até logo.
Marcelo
Programador que é programador, quando tá de folga vai inventar função nova, fazer testes, ou seja... se divertir
Cobra 210 - Drive de 8" 1.024 KB - 64 KB RAM - Impressora de Linha Cobra - Visicalc - Fortran - Dialog - Sistema Operacional SP/M (é sp/m mesmo - era o cp/m da cobra)
Cobra 210 - Drive de 8" 1.024 KB - 64 KB RAM - Impressora de Linha Cobra - Visicalc - Fortran - Dialog - Sistema Operacional SP/M (é sp/m mesmo - era o cp/m da cobra)
Se vc tem a CA-Tools, existe a função COM_INIT.
Syntax
COM_INIT(<nComPort>,[<nBaudRate>],[<cParity>],[<nDataLength>],[<nStopBits>]) --> lInitialized
Arguments
<nComPort> Designates the port (1 to 4) that is initialized.
<nBaudRate> Designates the selected baud rate for the port. Settings of 300, 600, 1200, 2400, 4800, 9600 and 19200 baud are possible. The default value is 300 baud.
<cParity> Designates parity in the following form: (E)ven, (O)dd, (M)ark, (S)pace, or (N)one. The default value is (N)one.
<nDataLength> Designates the data length; seven or eight bits are possible. The default value is eight bits.
<nStopBits> Designates the number of stop bits, one or two. The default value is one stop bit.
Returns
If the com port is initialized successfully, the function returns .T..
Syntax
COM_INIT(<nComPort>,[<nBaudRate>],[<cParity>],[<nDataLength>],[<nStopBits>]) --> lInitialized
Arguments
<nComPort> Designates the port (1 to 4) that is initialized.
<nBaudRate> Designates the selected baud rate for the port. Settings of 300, 600, 1200, 2400, 4800, 9600 and 19200 baud are possible. The default value is 300 baud.
<cParity> Designates parity in the following form: (E)ven, (O)dd, (M)ark, (S)pace, or (N)one. The default value is (N)one.
<nDataLength> Designates the data length; seven or eight bits are possible. The default value is eight bits.
<nStopBits> Designates the number of stop bits, one or two. The default value is one stop bit.
Returns
If the com port is initialized successfully, the function returns .T..

