Toshiba AS311 Network Card User Manual


 
User’s Manual
45
5. Operation Procedure
In this sample program, the following devices/registers are used.
R0100 AS311 status (ON when ready) - Refer to section 5.4
R0110 Internal flag to start transmitting
R0201 Transmitting normal complete (comes ON when transmitting is complete
normally)
R0301 Transmitting error complete (comes ON when transmitting error has
occurred)
X000F Write ready flag
X000E Transmit complete flag
X000D Transmit error flag
Y002F Transmit start flag
D0200 - D0263 Transmitting message is set here
D3010 Transmitting error information is stored here
D4010 - D4011 Parameters for WRITE instruction
D4000 - D4001 Parameters for READ instruction
This sample program works as follows.
Main program
- Rung 1: Prepares a transmission message and sets it into D0200 and after (maximum
64 words in this sample). Then sets R0110 to ON.
- Rung 2: Calls Subroutine No. 1 when the AS311 is normal and R0110 is ON.
- Rung 3: When R0201 comes ON (normal transmitting), resets R0110 and R0201 to
OFF.
- Rung 4: When R0301 comes ON (transmitting error has occurred), performs the error
processing, then resets R0110 and R0301 to OFF.
Subroutine No. 1
- Rung 1: Indicates the entry of Subroutine No. 1.
- Rung 2: Reads XW000 and XW001 from the AS311 by direct I/O instruction.
- Rung 3: When X000F (Write ready flag) is ON, writes the message that is stored in
D0200 to D0263 into the AS311’s buffer memory, 64 words starting with address 576,
by WRITE instruction, and sets Y002F (Transmit start flag) to ON.
- Rung 4: When X000E (Transmit complete flag) comes ON, resets Y002F (Transmit
start flag) to OFF, and sets R0201 to ON.
When X000D (Transmit error flag) comes ON, reads the error information from the
AS311’s buffer memory, 1 word of address 17, by READ instruction, and stores it into
D3010. Then resets Y002F (Transmit start flag) to OFF, and sets R0301 to ON.
- Rung 5: Writes YW002 and YW003 into the AS311 by direct I/O instruction.
- Rung 6: Indicates the return of Subroutine No. 1.