Jäger ADwin-Gold-USB Manual page 45

Hide thumbs Also See for ADwin-Gold-USB:
Table of Contents

Advertisement

ADwin
Example programs
The following program illustrates the initialization of the serial RS232 interface
in the INIT: section and the cyclic reading and writing of data in the EVENT:.
section. The process is timer-controlled:
REM The program initializes the serial interface
REM in the Init: section.
REM In the Event: section data is exchanged between
REM the interfaces 1 & 2 of the RS module.
REM The interfaces are tested with this program.
REM For this connect the interfaces with each other
REM befor starting the program.
#INCLUDE
adwpext.inc
DIM
DATA_1[1000]
AS
DIM
DATA_2[1000]
AS
DIM
lauf
AS LONG
INIT:
FOR
run
= 1
TO
1000
DATA_1[run] =
run
NEXT
run
REM Initialization of the interfaces:
REM 9600 Baud, not parity bit, 8 data bits,
REM 2 stop bits, RS232 witout handshake
RS_INIT(19600.0.8,1,0)
RS_INIT(2,9600,0,8,1,0)
PAR_1
= 1
PAR_4
= 1
EVENT:
REM Read and write a data set
IF
(PAR_1
<= 1000)
PAR_2
= WRITE_FIFO(1,DATA_1[PAR_1])
IF
(PAR_2
= 0)
ENDIF
PAR_3
= READ_FIFO(2)
IF
(PAR_3
<> -1)
DATA_2[PAR_4] =
INC
PAR_4
ENDIF
IF
(PAR_4
> 1000)
ADwin-Gold USB / ENET, manual version 3.8, October 2005
LONG'Transmitted data
LONG'Received data
'Control variable
'Initialization of the transmit-
'ted data
AND
0FFh
THEN'Send data
THEN INC
PAR_1
'Read data
THEN
PAR_3
THEN
END'All data are transmitted
CAN add-on
RS232
41

Advertisement

Table of Contents
loading

This manual is also suitable for:

Adwin-gold-enet

Table of Contents