Ejemplo En Visual Basic Para Enviar Un Mensaje - Digital Design EVOLUTION LX 1 Manual De Instalación Y Operación

Impresora por inyeccion de tinta
Tabla de contenido

Publicidad

EJEMPLO EN VISUAL BASIC PARA ENVIAR UN MENSAJE

INICIALICE Y ABRA EL CANAL SERIAL PARA EJECUTAR LOS SIGUIENTES COMANDO:
Public Sub DoMessage()
DATA$ = "800": GETINFODATA: Rem DISABLE PRINTING MODE
DATA$ = "&32": GETINFODATA: Rem SET LINE SPEED TO 50
DATA$ = "P01010010000100000000" & Chr$(&HD): GETINFODATA: Rem SET OBJECTs
DATA$ = "%ABCDEFGHIJ" & Chr$(&HD): GETINFODATA: Rem SEND MESSAGE
End Sub
Public Sub GETINFODATA() : : Rem SENDS A COMMAND AND GETS A RESPONSE
RESPONSE$ = "": COMM.InBufferCount = 0
COMM.Output = ESC & STX & "01" & DATA$ & EOT
Timer.Enabled = True: TIMERFLAG = False
GETINFO:
Do
DoEvents
If TIMERFLAG = True Then GoTo TCOMMERROR
Loop Until COMM.InBufferCount >= 1
RESPONSE$ = RESPONSE$ & COMM.Input
If InStr(RESPONSE$, Chr$(&H15)) > 0 Then GoTo GETDATAERROR:
Rem A NAK WAS RECEIVED
If InStr(RESPONSE$, Chr$(&H4)) = 0 Then GoTo GETINFO
Rem AN EOT WAS RECEIVED
RESPONSE$ = Mid$(RESPONSE$, 6, Len(RESPONSE$))
Rem DELETE ADDRESS HEADER
Timer.Enabled = False
Rem WE NOW HAVE A VALID RESPONSE
Exit Sub
GETDATAERROR:
Timer.Enabled = False: TIMERFLAG = False
GoTo PROCESSERROR
Exit Sub
TCOMMERROR:
Timer.Enabled = False: TIMERFLAG = False
PROCESSERROR:
If RESPONSE$ = "" Then RESPONSE$ = "0" Else RESPONSE$ = Right$(RESPONSE$, 1):
Rem GET THE ERROR CODE
Select Case (RESPONSE$)
Case 0
MSG$ = "NO RESPONSE FROM UNIT"
Case 1
MSG$ = "TRANSMISSION ERROR"
Case 2
MSG$ = "ILLEGAL COMMAND"
Case 3
MSG$ = "TRYING TO PRINT WHILE IN COMMAND MODE"
Case 4
MSG$ = "TRYING TO READ A WRITE ONLY REGISTER"
Case 5
MSG$ = "TRYING TO WRITE A READ ONLY REGISTER"
Case 6
MSG$ = "UNIT INPUT BUFFER FULL"
Case 7
6-28
EVOLUTION LX SYSTEM MANUAL Issue 1.0 5 DEC 2009

Publicidad

Tabla de contenido
loading

Este manual también es adecuado para:

Evolution lx 2

Tabla de contenido