英语翻译(1)单片机以方式3进行通信,一帧数据的第9位为“1”代表地址帧,为“0”代表数据帧.(2)设定通信波特率为1200bps.(3)00H是以地址帧形式发送的一条对所有从机起作用的控制命令,
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/25 00:31:54
英语翻译(1)单片机以方式3进行通信,一帧数据的第9位为“1”代表地址帧,为“0”代表数据帧.(2)设定通信波特率为1200bps.(3)00H是以地址帧形式发送的一条对所有从机起作用的控制命令,
英语翻译
(1)单片机以方式3进行通信,一帧数据的第9位为“1”代表地址帧,为“0”代表数据帧.
(2)设定通信波特率为1200bps.
(3)00H是以地址帧形式发送的一条对所有从机起作用的控制命令,命令各从机恢复SM2=1,等待接收状态.
(4)主机与从机的联络过程为;
主机下发地址帧,被呼叫从机向主机返回地址帧,以便主机确定与从机联络上了.主机下发控制命令,从机根据命令或接收主机的数据块,或向主机发送数据块.
(5)主机发送的控制命令代码为:
AAH:设置表底数;BBH:读取表数;CCH:开表设置;DDH:关表设置
EEH:校验出错;EDH:传送结束符.
(6)数据块组成格式为:数据块最后一帧为结束符EDH,结束符之前本数据块内容可以是操作码帧、地址码帧和数据帧.
为了实现多机通信,所有发射电路的振荡频率和所有的接收电路的振荡频率都必须调整一致,为保证正常通信,防止自己发自己接,数据传送方向必须为半双工传送,收发器在发射时,必须屏蔽自己的接收中断,发射结束后再开放中断.多机通信过程为:
(1)所有从机的SM2=1,处于地址帧接收状态.
(2)主机发送一帧地址信息,其中包含8位地址,第9位为“1”,与所需的从机进行联络.
(3)从机接收到地址信息后,各自将其与自己的地址相比较;对于地址相符的从机使RI=0,TB8=1,发送自身地址,并使SM2=0,TI=1,以等待接收主机随后发来的所有信息;对于地址不相符的从机仍保持SM2=1状态,对主机随后发来的数据不理睬直至发送新的一帧地址信息.
(4)主机接收到地址后将SCON第9位TB8清“0”,然后进行地址校对,若地址校对通过,说明从机已经联络上,发送进一步的通信控制命令信号;地址校对出错,说明从机没有联络上,发送结束本次通信命令,修改SCON第9位,将TB8置“1”.主机向被寻址的从机发送控制指令与数据,一帧数据的第9位为“0”,表示发送的是数据或控制指令.
5)被叫从机接收到命令后进行命令分析,收集现场信息,进行一定的数据处理,根据主机的要求返回数据,并执行主机发出的命令.若为结束通信的命令,则立即置SM2=1,结束本次通信,等待下一次通信,否则执行相应的动作,对于要求返回信息的命令,置TB8=0,返回正确的响应信息后置SM2=1,恢复其只接收地址帧数据状态.
(6)主机接收结束通信命令的返回信息后修改SCON第9位,将TB8置“1”,准备进行下一轮的通信.
2.硬件构成
主要包括红外发射电路和红外接收电路两部分:
红外发射电路
在红外数据传输的信号调制方式上,采用脉冲调制的二进制不归零码.这种调制方式比较简单,编码解码都比较方便,有利于电路简化.红外发射电路如图2所示.
由455KHZ的晶振CRY,反相器74HC04及电阻、电容构成的振荡器产生455KHZ的方波信号.经脉冲分频器74LS92,六分频成为75.83KHZ的脉冲信号.再经过D触发器构成的2分频/整形电路变成38KHZ的方波信号.由单片机的异步串行口TX输出的串行数据信号,送到与非门74HC00的输入端.与非门的另一输入端接38KHZ的载波信号.与非门的输出信号用来控制三极管的开通或关断,从而控制红外发射管发送信息.这样就达到了用串行口TX输出的串行数据信号直接调制载波,进行红外数据传输的目的.发射电路的调制采用的是时分制幅度键控调制方式.因单片机在复位后,TXD脚为高电平,为满足同步的要求,采用低电平同步脉冲,经与非门(U3)后变成高电平同步脉冲.所以单片机TXD发送的编码应是反码.
英语翻译(1)单片机以方式3进行通信,一帧数据的第9位为“1”代表地址帧,为“0”代表数据帧.(2)设定通信波特率为1200bps.(3)00H是以地址帧形式发送的一条对所有从机起作用的控制命令,
(1) single-chip 3 to the way communications,a data section 9 for the "1" on behalf of the address frame,in order to "0" on behalf of the data frame.
(2) to set the communication baud rate is 1200bps.
(3) 00H is the address of a frame sent from the machine work on all of the control order,order the resumption of the slave SM2 = 1,waiting to receive state.
(4) and from the host machine for the contact process;
Host Address frame issued by the call from the machine frame to host the return address in order to determine the host machine from a contact.Host control commands issued from the machine in accordance with an order or to receive the host data blocks or data blocks sent to the host.
(5) control the host sending the command code as follows:
AAH:set table base; BBH:the number of read table; CCH:open table settings; DDH:clearance table settings
EEH:Checksum error; EDH:at the end of transmission.
(6) the composition of the format of data blocks:one block for the final at the end of EDH,until at the end of the contents of the data blocks can be frame opcode,address,code frames and data frames.
In order to achieve multi-machine communications,all firing circuits and all the oscillation frequency of the oscillation frequency receiver circuit must be adjusted in line,in order to ensure the normal communications,to prevent their own fat,then the direction of data transmission must be half-duplex transmission,transceiver in the launch must be shielded to receive its own interrupt,interrupted open after the end of the launch.Multi-machine communication process as follows:
(1) all from the machine SM2 = 1,at the address to receive the status of frame.
(2) a host address information,which includes 8-bit address,the first 9 to "1",with the required contact from the machine.
(3) from the machine after the address information received,each with its own compared to the address; in line for the address from the machine so that RI = 0,TB8 = 1,to send its own address,and SM2 = 0,TI = 1,to wait for the receiving host then sent all the information; the address does not match the slave remained SM2 = 1 state,then sent to the host of the data sent up to take no notice of a new address information.
(4) to address the host will receive SCON 9th TB8-ching "0",and then proceed to address proof,address proof,if passed,from the machine has been contacted,send control commands to the communications signal; address error proofing on there is no contact from the machine,send the end of the communication command,modify SCON 9th,TB8 home will be "1." Addressing the host to be sent from the machine control commands and data,a data section 9 for the "0",that send data or control commands.
5) called from the plane after receiving a command to the command analysis information collected at the scene to carry out certain data processing,in accordance with the requirements of the host to return data and the implementation of the host orders.If an order to end the communication,then immediately buy SM2 = 1,the end of this communication,to wait for the next communication,otherwise the implementation of appropriate action,for an order to return information,home TB8 = 0,return the correct information in response to post-SM2 = 1,to resume its only state to receive the address data frame.
(6) host receiving orders to return to the end of communication message SCON modify the first nine,will be home TB8 "1",ready for the next round of communications.
2.Hardware
Mainly include the infrared transmitter and infrared receiver circuit of two parts:
Infrared transmitter
Data transmission in the infrared signal modulation methods,the use of pulse modulation of the binary code is not zero.This modulation is simpler,more convenient all codec will help simplify the circuit.Infrared emission circuit as shown in Figure 2.
455KHZ the crystal by CRY,inverter 74HC04 and resistors,capacitors consisting of the square wave oscillator signal generated 455KHZ.By the pulse divider 74LS92,six of the pulse frequency as a signal 75.83KHZ.Another D flip-flop consisting of 2-/ 38KHZ shaping circuit into a square wave signal.By the single-chip asynchronous serial port TX of the serial data output signal to the NAND gate input of the 74HC00.Doors with non-38KHZ another input termination of the carrier signal.And non-gate transistor used to control the output signal of the open or off to control the launch tube infrared send a message.This achieved by the serial port TX of the serial data output directly modulated carrier signal to carry out the purpose of infrared data transmission.Transmitter modulation system using time division modulation keying rate.After the reduction due to single-chip,TXD pin is high,in order to meet the requirements of synchronous,use of low-level synchronization pulse,with the non-gate (U3) become high after the synchronization pulse.Therefore,single-chip encoder TXD should be sent by the anti-code.
浣犺?鐨勬槸杩欐牱鍚