APPENDIX
Appendix 9.4 When receiving data using nonprocedural or bidirectional protocol
The following program example receives data under the nonprocedural protocol (or bidirectional protocol) using the REMFR instruction and I/O signals.
Refer to Chapter 6 for the communication using the nonprocedural protocol. Refer to Chapter 7 for the communication using the bidirectional protocol.
Refer to Chapter 11 of the User's Manual (Application) for data communication using the user frames.
(1) Program conditions
| The following program receives data from the external device by communication | |||||||||
| using the nonprocedural protocol, then turns ON the receive read request signal | |||||||||
| (X1003), and reads the received data from the QJ71C24N buffer memory to the | |||||||||
| PLC CPU. |
|
|
|
|
|
|
| ||
| (a) | Devices used: |
|
|
|
|
|
|
| |
|
| • Error code read signal ............................................................ |
|
|
| X1023 | ||||
|
| • Receive read request signal................................................... | M10 |
| ||||||
|
| • Received data acquisition command ..................................... | M11 |
| ||||||
|
| • Receive result acquisition command...................................... | M12 |
| ||||||
|
| • Completion device for REMFR instruction............................. | M100 to 105 | |||||||
|
| • Normal/abnormal completion flag for REMFR instruction..... | M200 to 203 | |||||||
|
| • Normal/abnormal completion of receive ................................ | M300, M301 | |||||||
|
| • Received data count............................................................... |
|
|
| D0 |
| |||
|
| • Received data (when | D1 to D5 | |||||||
|
| • Data reception result............................................................... |
|
|
| D8000 | ||||
| (b) Intelligent function module switch settings (Refer to Section 4.5.2) |
| ||||||||
|
|
|
|
|
|
|
|
|
|
|
Switch No. |
| Bit |
| Description |
|
|
| Setting | ||
Position | Designated value |
|
|
|
| value | ||||
|
|
|
|
|
|
| ||||
| b0 |
| OFF |
| Operation setting |
| Independent |
|
|
|
| b1 |
| OFF |
| Data bit |
| 7 bits |
|
|
|
| b2 |
| OFF |
| Parity bit |
| No |
|
|
|
| b3 |
| OFF | Transmission | Even/odd parity |
| Odd |
|
|
|
Switch 1 | b4 |
| OFF | setting | Stop bit |
| 1 bit |
|
| 07C0H |
| b5 |
| OFF |
| Sum check code |
| No |
|
|
|
| b6 |
| ON |
| Write during RUN |
| Enabled |
|
|
|
| b7 |
| ON |
| Setting modifications |
| Enabled |
|
|
|
| b8 to b15 |
| — | Communication rate setting |
| 19200bps |
|
|
| |
Switch 2 |
| — | Communication protocol setting |
|
| 0006H | ||||
Switch 5 |
| — | Station number setting |
| Station 0 |
|
| 0000H | ||
| (c) Buffer memory settings used in this example |
|
|
|
| |||||
|
|
|
|
|
|
|
|
| ||
Address Decimal (Hexadecimal) |
|
| Name |
|
|
| Setting | |||
| CH1 |
|
|
|
|
|
| value | ||
|
|
|
|
|
|
|
|
| ||
| 150 (96H) |
| Word/byte units designation |
|
| Word units | ||||
| 164 (A4H) |
| Received data count designation |
|
|
| 01FFH | |||
| 165 (A5H) |
| Receive complete code designation |
|
|
| 0D0AH | |||
| 166 (A6H) |
| Receive buffer memory head address designation |
|
|
| 0600H | |||
| 167 (A7H) |
| Receive buffer memory length designation |
|
|
| 0200H | |||
| 600 (258H) |
| Data reception result |
|
|
|
|
| — |
App. - 37 | App. - 37 |