日韩免费一级毛片在线观看-中文日韩亚洲综合-欧美系列日韩另类-欧美激情极品日韩-午夜日韩爱爱毛片视频免费看-欧美日韩一区免费观看-欧美日韩欧美黄色三级

CAN bus based on RS-232 Serial Remote Communication

1 Introduction

Industrial equipment, communication usually involves a lot of hardware and software products as well as for connecting a standard computer platform (PC or workstation) and industrial automation equipment, protocol, and the use of a wide range of devices and protocols. Therefore, the majority of automation applications want to implement a simple serial command, and that these commands with the personal computer or additional serial port serial port compatible with the standards board. RS-232 is PC computer and communications industry, the most widely used as a serial interface. RS-232 is defined as a low-speed serial communications to increase communication distance of the single-ended standards. As the RS-232 transmit and receiver signal ground between the public, so it can not use double-ended signals, or, common-mode noise will be coupled to the signal system. RS-232 standard provides that the maximum distance of only 15m, the signal transmission rate of up to 20kbit / s.

CAN, all known as the "Controller Area Network", the Controller Area Network, is the internationally most widely used field bus, one composed of a single CAN bus network, network hardware electrical characteristics of the restrictions. CAN as a multi-master mode serial communication bus, the basic design specifications of its high speed and high resistance to electromagnetic interference, and to be able to detect the communication bus to generate any errors. When the signal transmission distance up to 10km when, CAN can provide up to 50kbit / s data transfer rate. Table 1 for the CAN bus maximum transmission between any two nodes from their corresponding relationship between the bit rate.

Table 1 CAN bus system any two rival powers of the potential maximum distance between the

Bit rate / kbps 1000 500 250 125 100
Maximum distance / m 40 130 270 530 620
Bit rate / kbps 50 20 10 5
Maximum distance / m 1300 3300 6700 1000 0

Thus, in terms of real-time, adaptability, flexibility, or reliability point of view, CAN bus is a kind of a more excellent than the RS-232 serial bus. When the far distance between two serial devices, RS-232 can not be directly used to connect them when you can convert the RS-232 CAN, CAN bus via the serial port device to achieve network interconnection.

However, RS-232 and CAN frames in the level and format are very different. Specific performance is as follows:

RS-232 standard using negative logic levels, regulations 3V ~ 15V at any level between a logic "0" level,-3V ~-15V at any level between a logic "1" level. The CAN signal is transmitted using differential voltage, the two signal wires called "CAN_H" and "CAM_L", when all the static around 2.5V, then the state is represented as logic "1", also called a "hidden"; CAN_L higher than that with CAN_H logic "0", referred to as "dominant." Dominant, usually voltage value: CAN_H = 3.5V, CAN_L = 1.5V;

RS-232 serial frame format: one start bit, 8 data bits, a programmable 9th bit (this bit is sent and received address / data bits), one stop bit. The CAN data frame format: Frame Information ID data (can be divided into the standard frame and extended frame format).

CAN bus based on RS-232 Serial Remote Communication

Therefore, the design requires a micro-controller to achieve the level and frame format conversion. The conversion shown in Figure 1.

2 RS-232 to CAN converter for hardware design

In the design of RS-232 to CAN conversion device, a microprocessor chip microcomputer AT89C52; used as a CAN microcontroller SJA1000, SJA1000 CAN protocol integrates the physical layer and data link layer function, the passive situation of the communication data frame processing; AT82C250 CAN controller and physical bus as the interface between the bus used to provide differential to send power and CAN controller and differential receive capability, through the AT82C250 pin 3 can choose from three different ways of working (high-speed, slope control and standby). One pin 3 grounded for high-speed mode; high-speed optical compartment with 6N137 to achieve, its role is to prevent signal interference in series; MAX232 is used to complete the 232 level to the micro-controller interface chip TTL level conversion. See the specific hardware interface circuit SJA1000 of the resources, I will not do more to explain. However, the following points need attention.

(1) CAN bus connected via a 120Ω resistor, whose role is to match bus impedance, improve data communication and reliable anti-interference lines. But in fact, only to ensure CAN network "CAN_H" and "CAN_L" bridging between the resistance of 60Ω can.

(2) SJA1000 20-pin RX1 ground when not in use (see the specific reasons for software design), the Set with CDR.6 can greatly increase the length of the bus.

(3) pin TX0, TX1 determine the access method of serial output level. Refer to the specific relationship OCR output control register settings.

(4) AT82C250 the RS pin and indirectly has a slope resistance. Resistor size can adjust the speed of the bus communication, usually between 16kΩ ~ 140kΩ.

(5) MAX232 requires four external electrolytic capacitors C1, C2, C3, C4, the capacitor capacitance is required for the internal power conversion, its values are 1μF/25V, tantalum capacitor should be chosen and the location of application volume close to the chip, power supply VCC and to be connected between a 0.1μF decoupling capacitor.

CAN bus based on RS-232 Serial Remote Communication

3 RS-232 to CAN converter for software design

Under the control of the microprocessor, RS-232 and CAN data exchange, the use of serial port receive and CAN interrupt can improve efficiency. The main program flow chart shown in Figure 2. SJA1000 in reset mode, the initialization can be, including work settings, the clock frequency and the acceptance filter register settings, baud rate parameter settings and interrupt register settings allow.

Can accurate data transfer also depends on the baud rate and flow control, which is software designed place can not be ignored. So then introduces the CAN baud rate settings, automatic detection of serial port baud rate, serial data flow control.

3.1 CAN filtering rate settings

CAN protocol is one of the elements in the baud rate. Users can set the bit cycle of the Wei and Caiyangcishuo sampling point location, to enable the user freedom to optimize Ying Yong network performance but 優(yōu)化 process, we must focus time Shen Shu Wei Shen Kao oscillator basis of tolerance and Jitong different Xinhaozhuanbo The relationship between delayed.

System bit rate fBil that transmit data bits per unit amount of time that the baud rate fBit = 1/tBit. Nominal bit time by the three non-overlapping segments SYNC_SEG, TSEG1 and TSEG2 composition, this three time periods are TSYNC_SEG, TSEG1 and TSEG2 composition, this three time periods are tSYNC_SEG, tTSEG1 and tTSEG2. Therefore, the amount of positioning cycle tBit are three time periods and.

tBit = tSYNC_SEG tTSEG1 tTSEG2

Bit period of these paragraphs are an integer number of basic time unit used to express. The unit of time is called time share TQ, the duration of time share is a CAN system clock cycle tSCL, can be obtained from the oscillator clock cycles tCLK. Pre-programmed frequency factor (baud rate default BRP) can adjust the CAN system clock. As follows:

tSCL = BRP × 2tCLK = 2BPR/fCLK

CAN Bit Timing Calculation on another very important time is synchronized jump width (SJW), duration is tSJW. SJW is not the bit period of a paragraph, but the definition of events in the re-synchronization is the bit period increase or decrease the maximum number of TQ. In addition, CAN protocol also allows the user to specify the bit sampling mode (SAM), respectively, and three single-sample sampling mode (the results in the three samples selected one). In the single sample mode, the sampling points in TESG1 the end of paragraph. The three sampling mode more than the single sample taken two samples, they end in front of TSEG1 section, a difference between a TQ.

Mentioned above, BPR, SJW, SAM, TESG1, TESG2 CAN controller can be adopted by the user's contents in register BTR0 and BTR1 to define. Specifically shown in Figure 3. Set up BTR0 and BTR1, the actual transmission baud rate range:

Maximum = 1 / (tBit-tSJW), minimum = 1 / (tBit tSJW)

3.2 serial baud rate detection

When the serial device is a host, additional testing at this time converter serial baud rate, can host the first to receive baud rate (9600 baud for example) to set, and in the terminal to send a specific character ( a carriage return as an example), so that the host of characters according to the information received on the conversion device can determine the communication baud rate. The ASCII value of carriage is 0DH, to receive at different baud rate to the value listed in Table 2.

Table 2 under different baud rate of bytes received

Baud rate (bit / s) to receive bytes (hex) Baud rate (bit / s) to receive bytes (hexadecimal)
1200 80 4800 E6
1800 F0 9600 0D
2400 78 19200 F *

3.3 Serial Port Flow Control

Here talked about the "flow" refers to the data stream. Between the two serial data transmission, data loss is often the phenomenon occurs. As the MCU buffer is limited, such as receiving data buffer is full, then continue to send to the data at this time will be lost. The flow control can effectively solve the problem, data processing, but when the receiver came, flow control system will issue "no longer receive" the signal, Er Shi sender to stop sending until receiving "can continue to send a" signal then send the data. Therefore, data flow control can control the process, to prevent data loss. Two common flow control is hardware flow control (including RTS / CTS, DTR / CTS) and software flow control XON / XOFF (continue / stop), the following only in respect of hardware flow control RTS / CTS illustration.

When using hardware flow control, serial console RTS, CTS received a microcontroller I / O port, by setting the I / O port to 1 or 0 to receive and send signals from the stop. Data terminal equipment (such as computer) microcontroller using RTS to start the flow of data sent, while the MCU is used to start and pause CTS data flow from the computer. When hardware handshaking way to achieve this, the programming according to the size of the receiver buffer to set a high mark and a low mark, when the buffer data to high levels, the CTS line at the receiving end will be set low (to send Luoji 0 ), and when the program detects the transmitter is lower after the CTS, it stops sending data until the receiver buffer data will be lower than low and high CTS set up. RTS is used to indicate the receiving device to receive data have good accuracy.

CAN bus based on RS-232 Serial Remote Communication

3.4 CAN receiver subroutine

PeliCAN send both standard frame format can be sent to extend the frame, use the clock divider registers CDR.7 tuned to the CAN mode (0-BasicCAN, 1 - PeliCAN), received CAN data, frame information in accordance with FF bits to determine a standard frame or frame extension, and RTR bit to determine the data frame or remote frame. The following is a CAN receiver subroutine:

;///////////////////////////////////////////////// /////////////////
; / / CAN data reception / unified into a two-byte ID of the frame format / /
;///////////////////////////////////////////////// //////////////////////
RECAN:
MOV R0, # C_RE; microcontroller within the buffer start address
MOV DPTR, # RXBUF; read and save the contents of receive buffer
MOVX A, @ DPTR; read buffer of 2 byte CAN
MOV @ R0, A; Save
JB ACC.7, EFF_RE; FF bit ,0-SFF ,1-EFF
MOV R2, # 0
SJMP SFF_RE; ID number is different from the interception of "data byte" in different positions
EFF_RE: MOV R2, # 2
SFF_RE: MOV R2, # 2
SFF_RE:
JB ACC.6, EXIT_RECAN; RTR bit to judge, 1 - a remote frame, then jump out
ANL A, # 0FH
MOV R3, A; then the middle four is the interception of data length
MOV C_NUM, A; R3, R5 to receive frames stored in the length of
RDATA0:
INC DPTR; 2 bytes ID
INC R0
MOVX A, @ DPTR
MOV @ R0, A
INC DPTR
MOVX A, @ R0, A
INC DPTR
MOVX A, @ DPTR
MOV @ R0, A
MOV A, R2; if you skip two byte ID EFF
JZ DRATA1
INC DPTR
INC DPTR
DATA1:; data bytes
INC DPTR
INC R0
MOVX A, @ DPTR
MOV @ R0, A
DJNZ R3, RDATA1
EXIT_RECAN:
RET

4 Conclusion

Micro-computer into an intelligent measurement and control instrumentation to provide the necessary conditions in which the terminal device with a microprocessor with a better digital communications. As more and more intelligent terminals Chu Xian, Wu Lun yes right network's architecture, protocol, Shi Shi Xing, or the applicability, flexibility, reliability Naizhi Chengbendouyou a higher demand, so good in the Fa Zhan Xian Chang bus Youzhao prospects. CAN bus frame structure has a logo ID, which makes network equipment, has more than one network in the host as possible, which can be monitored by network hosts work of Zheng Ge devices and the network to the corresponding control decision-making. This device has accomplished and achieved in practice very good results.

Declined comment

国产成人精品综合久久久| 色综合久久久久综合体桃花网| 久久久久久久久综合影视网| 天天做日日干| 精品国产亚洲人成在线| 欧美激情一区二区三区视频 | 九九久久99综合一区二区| 成人高清视频在线观看| 四虎影视库| 久久精品店| 亚洲天堂在线播放| 国产一区二区精品| 国产成人欧美一区二区三区的| 久久国产影院| 国产91精品系列在线观看| 好男人天堂网 久久精品国产这里是免费 国产精品成人一区二区 男人天堂网2021 男人的天堂在线观看 丁香六月综合激情 | 一本伊大人香蕉高清在线观看| 精品国产一区二区三区国产馆| 国产麻豆精品高清在线播放| 欧美日本韩国| 日韩中文字幕在线亚洲一区| 香蕉视频久久| 欧美夜夜骑 青草视频在线观看完整版 久久精品99无色码中文字幕 欧美日韩一区二区在线观看视频 欧美中文字幕在线视频 www.99精品 香蕉视频久久 | 久久成人综合网| 黄视频网站在线免费观看| 成人免费观看网欧美片| 青青久久国产成人免费网站| 亚洲 欧美 91| 欧美18性精品| 国产一区二区精品在线观看| 日韩在线观看视频黄| 黄色短视频网站| 国产视频一区在线| 国产精品自拍在线| 四虎精品在线观看| 一级毛片看真人在线视频| 亚洲精品久久久中文字| 日本伦理片网站| 日韩专区一区| 久久精品成人一区二区三区| 亚洲 国产精品 日韩| 久久国产影视免费精品| 中文字幕一区二区三区精彩视频 | 一 级 黄 中国色 片| 国产网站免费| 欧美激情伊人| 韩国毛片免费大片| 色综合久久久久综合体桃花网| 久久精品大片| 高清一级淫片a级中文字幕| 欧美大片aaaa一级毛片| 精品久久久久久中文| 一级女性全黄久久生活片| 国产伦精品一区二区三区在线观看| 91麻豆国产级在线| 欧美电影免费| 九九九网站| 国产麻豆精品高清在线播放| 精品视频在线观看一区二区| 精品毛片视频| 天天做人人爱夜夜爽2020 | 国产伦理精品| 欧美夜夜骑 青草视频在线观看完整版 久久精品99无色码中文字幕 欧美日韩一区二区在线观看视频 欧美中文字幕在线视频 www.99精品 香蕉视频久久 | 国产美女在线一区二区三区| 99久久精品国产高清一区二区| 成人免费福利片在线观看| 日韩av东京社区男人的天堂| 国产亚洲男人的天堂在线观看| 青青久久精品| 色综合久久手机在线| 精品视频在线观看一区二区三区| 国产视频一区二区在线观看| 成人免费高清视频| 久久精品人人做人人爽97| 久久99中文字幕| 日本免费乱人伦在线观看| 日本久久久久久久 97久久精品一区二区三区 狠狠色噜噜狠狠狠狠97 日日干综合 五月天婷婷在线观看高清 九色福利视频 | 国产精品123| 日韩专区亚洲综合久久| 国产视频一区在线| 亚洲精品久久久中文字| 成人a大片在线观看| 欧美夜夜骑 青草视频在线观看完整版 久久精品99无色码中文字幕 欧美日韩一区二区在线观看视频 欧美中文字幕在线视频 www.99精品 香蕉视频久久 | 九九热国产视频| 欧美国产日韩久久久| 国产精品自拍亚洲| 99久久精品费精品国产一区二区| 成人高清视频免费观看| 久久精品道一区二区三区| 午夜家庭影院| 毛片成人永久免费视频| 精品久久久久久影院免费| 亚洲爆爽| 沈樵在线观看福利| 久久久久久久免费视频| 青青久久网| 91麻豆tv| 可以在线看黄的网站| 亚洲 男人 天堂| 国产一级生活片| 毛片电影网| 日本在线不卡免费视频一区| 国产91精品系列在线观看| 欧美激情一区二区三区视频| 国产精品自拍在线观看| 亚洲天堂在线播放| 国产一区二区精品在线观看| 久久99中文字幕久久| 日韩综合| 日韩免费在线观看视频| 精品久久久久久综合网| 欧美a级片免费看| 欧美一级视频高清片| 国产一区精品| 中文字幕一区二区三区精彩视频| 99久久精品国产高清一区二区| 久久国产精品只做精品| 美女免费毛片| 日韩在线观看网站| 成人在免费观看视频国产| 国产不卡在线播放| 好男人天堂网 久久精品国产这里是免费 国产精品成人一区二区 男人天堂网2021 男人的天堂在线观看 丁香六月综合激情 | 精品视频在线观看视频免费视频| 天天做人人爱夜夜爽2020毛片| 成人a大片高清在线观看| 欧美夜夜骑 青草视频在线观看完整版 久久精品99无色码中文字幕 欧美日韩一区二区在线观看视频 欧美中文字幕在线视频 www.99精品 香蕉视频久久 | 国产亚洲男人的天堂在线观看| 黄色免费网站在线| 午夜精品国产自在现线拍| 亚洲精品中文字幕久久久久久| 久久国产精品自线拍免费| 欧美夜夜骑 青草视频在线观看完整版 久久精品99无色码中文字幕 欧美日韩一区二区在线观看视频 欧美中文字幕在线视频 www.99精品 香蕉视频久久 | 免费的黄色小视频| 国产网站在线| 一级女性大黄生活片免费| 国产一区二区精品| 日韩av片免费播放| 日日日夜夜操| 二级特黄绝大片免费视频大片| 欧美a级片免费看| 日韩男人天堂| 日韩av成人| 精品视频一区二区三区| 成人免费观看网欧美片| 精品视频一区二区三区| 日韩男人天堂| 91麻豆高清国产在线播放| 黄色福利片| 成人免费高清视频| 成人a级高清视频在线观看| 久久国产精品永久免费网站| 国产国语在线播放视频| 国产精品123| 欧美国产日韩一区二区三区| 日韩一级黄色| 黄视频网站在线看| 国产不卡福利| 亚洲www美色| 午夜在线亚洲| 亚洲 国产精品 日韩| 成人影院久久久久久影院| 好男人天堂网 久久精品国产这里是免费 国产精品成人一区二区 男人天堂网2021 男人的天堂在线观看 丁香六月综合激情 | 亚洲精品中文一区不卡| 国产亚洲精品aaa大片| 久草免费在线色站| 青青青草影院| 日本伦理片网站| 青青青草视频在线观看| 九九精品在线| 欧美1区| 日韩免费在线视频| 国产一区二区精品久久| 亚洲第一页乱| 日韩在线观看网站| 久久国产一久久高清| 精品视频在线看| 999久久久免费精品国产牛牛| 国产伦理精品| 欧美夜夜骑 青草视频在线观看完整版 久久精品99无色码中文字幕 欧美日韩一区二区在线观看视频 欧美中文字幕在线视频 www.99精品 香蕉视频久久 | 日本在线不卡免费视频一区| 久久精品店| 一级女人毛片人一女人| 精品国产一区二区三区久久久狼| 欧美大片a一级毛片视频| 日日夜人人澡人人澡人人看免| 日韩中文字幕在线播放| 欧美电影免费| 久久久成人影院| 九九干| 超级乱淫伦动漫| 九九免费高清在线观看视频| 国产麻豆精品| 日韩欧美一及在线播放| 欧美一区二区三区在线观看| 久草免费在线观看| 欧美激情影院| 日韩一级精品视频在线观看| 国产一区免费在线观看| 91麻豆国产| 日本在线播放一区|