Keyence Visual KV Series Manual de usuario Pagina 341

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 392
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 340
7.2 Serial Communication
3-317
1
7
Chapter 7 Serial Communication
7.2.7 Example Program
Typical program for communications between the KV and a personal computer (For
IBM PC-AT & compatible computers using BASIC)
‘Language Microsoft BASIC Version 7.0
‘ *****I/OAddress (RS-232C Port-1)*****
‘Port-1&H3F*
‘Port-2&H2F*
PortCtrl%=&H3FB’COM1
Port1Modem%=&H3FC’MODEMCtrl
PortBpsLow%=&H3F8’BitrateLow
PortBpsHigh%=&H3F9’BitrateHigh
‘*****ControlCode*****
Port1CtrlCode1%=&H5B’Break&8bitEven1Stopbit
Port1CtrlCode2%=&H1B’8bitEven1Stopbit
‘*****InitializesRS-232C*****
OPEN"COM1:9600,N,8,1"FORRANDOMAS#1'
‘*****RS-232CPortInit*****
OUTPortCtrl %,Port1CtrlCode1%’Start transmitting a break signal
SLEEP1’wait 1 sec.
OUTPortCtrl%,Port1CtrlCode2%’Ends transmitting a break signal
‘-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
‘’’’’’’’’’’’*****DebugPrint*****
‘’’’’’’’’’’status=INP(&H3FE):PRINT"ModemStatus1";status
‘’’’’’’’’’’status=INP(&H3FD):PRINT"LineStatus1";status
‘’’’’’’’’’’’
‘’’’’’’’’’’’*****SelfInit.*****
‘’’’’’’’’’’linectrl=INP(PortCtrl%)’ReadLine-Control-Register
‘’’’’’’’’’’linectrl=linectrlOR&H80'
‘’’’’’’’’’’OUTPortCtrl%,linectrl’DLAB=ON
‘’’’’’’’’’’
‘’’’’’’’’’’OUTPortBpsLow%,12’SetBitRate(9600BPS)
‘’’’’’’’’’’OUTPortBpsHigh%,0'
‘’’’’’’’’’’
‘’’’’’’’’’’linectrl=linectrlAND&H7F’DLAB=OFF
‘’’’’’’’’’’OUTPortCtrl%,linectrl
‘’’’’’’’’’’’
‘’’’’’’’’’’’*****CtrlLine*****
‘’’’’’’’’’’OUTPort1Modem%,&HB’RTS,DTRON !!
‘’’’’’’’’’’’
‘’’’’’’’’’’’*****DebugPrint*****
‘’’’’’’’’’’status=INP(&H3FE):PRINT"ModemStatus2";status
‘’’’’’’’’’’status=INP(&H3FD):PRINT"LineStatus2";status
‘-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
‘*********************************************************
‘*****Transmitting a command/receiving a response*****
‘*********************************************************
a$=""
WHILEa $>"END"
PRINT"Command>>":
INPUTa$
PRINT#1,a $
b$=""
LINEINPUT#1,b$
PRINT"RsP[";b$;"]"
PRINT
WEND
PRINT"GoodBy!!"
CLOSE#1
END
Note: No parity check is specified due to the
limitations of the version of BASIC being used.
Change value in "SLEEP" timer according to your personal computer’s clock
frequency so that value I exceeds 100 ms.
Set the baud rate of your personal computer to 9600 bits/s.
Enter END to terminate programming.
Note 1: MS-DOS executable files (KVCOM.EXE) and BASIC source code files
(KVCOM.BAS) are included in the KV Incrediware (DOS) Software (KV-H4E,
version 2.00 or higher).
Note 2: Type in "KVCOM" and press ENTER to call the MS-DOS command line.
KVNKA Chap 07.p65 08.3.11, 0:11 PM317
Vista de pagina 340
1 2 ... 336 337 338 339 340 341 342 343 344 345 346 ... 391 392

Comentarios a estos manuales

Sin comentarios