CPM2A_PROGRAMMING MANUAL (W353-E1-2) (986750), страница 83
Текст из файла (страница 83)
Reset when RXD(47) is executed.AR 0814 will be turned ON when data has been received normally at theperipheral port. Reset when RXD(47) is executed.AR 09: Contains the number of bytes received at the RS-232C port. Reset to0000 when RXD(47) is executed.AR 10: Contains the number of bytes received at the peripheral port.
Reset to0000 when RXD(47) is executed.Note Communications flags and counters can be cleared either by specifying 0000 forN or using the Port Reset Bits (SR 25208 for peripheral port and SR 25209 forRS-232C port.)7-30-2 TRANSMIT – TXD(48)Operand Data AreasLadder SymbolsS: First source wordTXD(48)@TXD(48)SSCCNNIR, SR, AR, DM, HR, TC, LRC: Control word#N: Number of bytesIR, SR, AR, DM, HR, TC, LR, #Limitations478This instruction is available in the CPM2A/CPM2C and SRM1(-V2) only.S and S+(N÷2)–1 must be in the same data area.DM 6144 to DM 6655 cannot be used for S or N.Section 7-30Communications InstructionsN must be BCD from #0000 to #0256.
(#0000 to #0061 in Host Link mode)DescriptionWhen the execution condition is OFF, TXD(48) is not executed. When theexecution condition is ON, TXD(48) reads N bytes of data from words S toS+(N÷2)–1, converts it to ASCII, and outputs the data from the specified port.TXD(48) operates differently in Host Link mode and RS-232C mode, so thesemodes are described separately.NoteHost Link Mode1.
Flag AR 0805 will be ON when the PC is capable of transmitting datathrough the RS-232C port and AR 0813 will be ON when the PC is capableof transmitting data through the peripheral port.2. Refer to 4-1 Communications Functions for details on using the TXD(48)instruction, setting communications protocol in the PC Setup, etc.N must be BCD from #0000 to #0061 (i.e., up to 122 bytes of ASCII). The value ofthe control word determines the port from which data will be output, as shownbelow.Digit number:3 2 1 0Not used.
(Set to 000.)Port0: Specifies RS-232C port.1: Specifies peripheral port.The specified number of bytes will be read from S through S+(N/2)–1, convertedto ASCII, and transmitted through the specified port. The bytes of source datashown below will be transmitted in this order: 12345678...MSB1357SS+1S+2S+3LSB2468The following diagram shows the format for Host Link command (TXD) sent fromthe CPM2A/CPM2C. The CPM2A/CPM2C automatically attaches the prefixesand suffixes, such as the node number, header, and FCS.@ENodenumberXHeadercode∗.........Data (122 ASCII characters max.)FCSCRTerminatorRS-232C ModeN must be BCD from #0000 to #00256. The value of the control word determinesthe port from which data will be output and the order in which data will be writtento memory.Control WordThe value of the control word determines the port from which data will be readand the order in which data will be written to memory.Digit number:3 2 1 0Byte order0: Most significant bytes first1: Least significant bytes firstNot used.
(Set to 00.)Port0: Specifies RS-232C port.1: Specifies peripheral port.479Section 7-30Communications InstructionsThe specified number of bytes will be read from S through S+(N÷2)–1 and transmitted through the specified port.SS+1S+2S+3MSB1357LSB2468When digit 0 of C is 0, the bytes of source data shown above will be transmitted inthis order: 12345678...When digit 0 of C is 1, the bytes of source data shown above will be transmitted inthis order: 21436587...Note When start and end codes are specified the total data length should be 256 bytesmax., including the start and end codes.FlagsER:The settings in C are not correct.N is greater than 256 for no-protocol mode or greater than 61 for HostLink mode.The PC Setup is not set for the correct communications mode.Indirectly addressed DM word is non-existent.
(Content of *DM word isnot BCD, or the DM area boundary has been exceeded.)TXD(48) is already being executed.AR 08: AR 0805 will be turned ON when it is possible to transmit through theRS-232C port. AR 0813 will be turned ON when it is possible to transmitthrough the peripheral port.7-30-3 CHANGE RS-232C SETUP – STUP(––)Operand Data AreasLadder SymbolsN: RS-232C port specifierSTUP(––)@STUP(––)NNSS––000S: First source wordIR, SR, AR, DM, HR, LR, #The third operand is ignored.LimitationsThis instruction is available in the CPM2A/CPM2C and SRM1(-V2) only.N must be 000.S and S+4 must be in the same data area.(S can be set to #0000 to change the RS-232C settings to their defaults.)STUP(––) can’t be executed within an interrupt subroutine.DescriptionWhen the execution condition is OFF, STUP(––) is not executed.
When theexecution condition is ON, STUP(––) changes the PC Setup settings for thebuilt-in RS-232C port. The settings are changed in the PC Setup, but they arenot written to flash memory until the PC is switched to PROGRAM mode (fromRUN or MONITOR mode) or the PC is turned OFF and then ON again.480Section 7-30Communications InstructionsIn CPM2A/CPM2C and SRM1(-V2) PCs, N must be 000 because STUP(––) canchange the RS-232C Setup for the built-in RS-232C port (DM 6645 to DM 6649)only.If S is a word address, the contents of S through S+4 are copied to DM 6645 toDM 6649.If S is input as the constant #0000, the settings for the built-in RS-232C port arereturned to their default values.SFunctionWord addressConstant (#0000)NoteApplication ExampleThe contents of S through S+4 are copied to DM 6645 throughDM 6649.The settings in DM 6645 through DM 6649 are returned to theirdefault values.1.
The Changing RS-232C Setup Flag (SR 25312) will be ON while STUP(––)is being executed; it is turned OFF when STUP(––) is completed.2. In the CPM2A/CPM2C, an error will occur and STUP(––) will not be executed if the Communications Switch on the front of the CPU Unit is ON. Whenthis switch is ON, RS-232C communications are governed by the defaultsettings.This example shows a program that transfers the contents of DM 0100 throughDM 0104 to the PC Setup area for the built-in RS-232C port (DM 6645 throughDM 6649).00000AddressInstruction0000000001LD@STUP(––)Operands@STUP(––)000DM 010000000000DM0000100---The settings are transferred as shown below.
The Changing RS-232C SetupFlag (SR 25312) will be turned OFF when the transfer has been completed.The following table shows the function of the transferred setup data.FlagsSourcewordDM 0100DestinationwordDM 66451001Enables the communications settings in DM0101 and sets the communications mode tono-protocol.DM 0101DM 66460803Sets the following communications settings:9,600 bps, 1 start bit, 8-bit data, 1 stop bit,no parityDM 0102DM 66470000No transmission delay (0 ms)DM 0103DM 66482000Enables the end code CR, LF.DM 0104DM 66490000(No function when DM 6648 is set to 2000.)ER:ContentFunctionIndirectly addressed DM word is non-existent.
(Content of DM word isnot BCD, or the DM area boundary has been exceeded.)The port specifier (N) isn’t 000.In the CPM2A/CPM2C, the Communications Switch on the front of theCPU Unit is ON.Another STUP(––) instruction is already being executed or event processing is being performed.The specified source words exceed the data area.The instruction was executed from an interrupt program.The PC Setup is write-protected.481SECTION 8PC Operations and Processing TimeThis section explains the internal processing of the CPM1, CPM1A, CPM2A, CPM2C, and SRM1(-V2), as well as the timerequired for processing and execution.
Refer to this section to gain an understanding of the precise timing of PC operation.8-18-28-3CPM1/CPM1A Cycle Time and I/O Response Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-1-1 The CPM1/CPM1A Cycle . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . .8-1-2 CPM1/CPM1A Cycle Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-1-3 I/O Response Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-1-4 One-to-one PC Link I/O Response Time . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .8-1-5 Interrupt Processing Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-1-6 CPM1/CPM1A Instruction Execution Times . . . . . . . . . . . . . . . . . . . . . . . . . . .
.CPM2A/CPM2C Cycle Time and I/O Response Time . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-2-1 CPM2A/CPM2C Cycle Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-2-2 I/O Response Time . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . .8-2-3 One-to-one PC Link I/O Response Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-2-4 Interrupt Processing Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-2-5 CPM2A/CPM2C Instruction Execution Times . . . . . . . . . . . . . .