TW202246992A - Rs-485 circuit and communication system - Google Patents

Rs-485 circuit and communication system Download PDF

Info

Publication number
TW202246992A
TW202246992A TW110119565A TW110119565A TW202246992A TW 202246992 A TW202246992 A TW 202246992A TW 110119565 A TW110119565 A TW 110119565A TW 110119565 A TW110119565 A TW 110119565A TW 202246992 A TW202246992 A TW 202246992A
Authority
TW
Taiwan
Prior art keywords
signal
data
interface chip
circuit
processing module
Prior art date
Application number
TW110119565A
Other languages
Chinese (zh)
Other versions
TWI769840B (en
Inventor
藍玉麟
Original Assignee
精拓科技股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 精拓科技股份有限公司 filed Critical 精拓科技股份有限公司
Priority to TW110119565A priority Critical patent/TWI769840B/en
Priority to CN202111137448.4A priority patent/CN115408324A/en
Application granted granted Critical
Publication of TWI769840B publication Critical patent/TWI769840B/en
Publication of TW202246992A publication Critical patent/TW202246992A/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/42Bus transfer protocol, e.g. handshake; Synchronisation
    • G06F13/4282Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06MCOUNTING MECHANISMS; COUNTING OF OBJECTS NOT OTHERWISE PROVIDED FOR
    • G06M1/00Design features of general application
    • G06M1/27Design features of general application for representing the result of count in the form of electric signals, e.g. by sensing markings on the counter drum
    • G06M1/272Design features of general application for representing the result of count in the form of electric signals, e.g. by sensing markings on the counter drum using photoelectric means

Abstract

Disclosed is an RS-485 circuit, which is arranged in an electronic device including a processing module. The RS-485 circuit includes an RS-485 interface chip, a start detector, an inter-integrated circuit and a counter. A default state of the RS-485 interface chip is a data receiving state, and the RS-485 interface chip includes a data input terminal and an enable terminal, wherein the data input terminal is configured to receive a data signal from the processing module, and the enable terminal is configured to receive a start signal or a switching signal to make the RS-485 interface chip in a data transmitting state or the data receiving state. The start detector is configured to detect the first signal edge of the data signal to generate the start signal to the enable terminal. A count value from the processing module is stored in a register through the inter-integrated circuit, so that the counter performs counting based on the count value, and outputs the switching signal to the enable terminal when the count of the counter is expired.

Description

RS-485電路與通訊系統RS-485 circuit and communication system

本申請涉及一種通訊介面電路,且特別是有關於一種RS-485電路與通訊系統。This application relates to a communication interface circuit, and in particular to an RS-485 circuit and communication system.

RS-485為常見的串列通訊標準,是一種藉由平衡發送和差分接收實現兩個裝置之間的通訊方式。RS-485 is a common serial communication standard. It is a communication method between two devices through balanced transmission and differential reception.

基於RS-485的電器特性為半雙工模式(Half Duplex),使得通過RS-485介面進行通訊的兩個裝置之間不能同時進行資料發送和接收。因此,同一時間僅能有一個裝置傳送資料,若有另一裝置需要傳送資料時,需等待正在傳送資料的裝置完成資料的發送後才可進行。The electrical characteristics based on RS-485 are half-duplex mode (Half Duplex), so that two devices communicating through the RS-485 interface cannot simultaneously transmit and receive data. Therefore, only one device can transmit data at the same time. If another device needs to transmit data, it needs to wait for the device that is transmitting data to finish sending the data before proceeding.

一般而言,需要通過裝置的處理模組(例如:微處理器、中央處理器或單晶片)輸出控制信號至RS-485介面晶片,以實現RS-485介面晶片的資料收發狀態的切換。然而上述方式存在因需要在裝置的處理模組上增加額外的軟體代碼來實現狀態切換的控制,而造成增加軟體開發的工作量,浪費研發的人力資源的問題。Generally speaking, it is necessary to output a control signal to the RS-485 interface chip through the processing module (for example: microprocessor, central processing unit or single chip) of the device, so as to realize the switching of the data sending and receiving state of the RS-485 interface chip. However, the above method has the problem of increasing the workload of software development and wasting human resources for research and development because additional software codes need to be added to the processing module of the device to realize the control of state switching.

本申請的主要目的在於提供一種RS-485電路與通訊系統,解決現有技術中存在因需要在裝置的處理模組上增加額外的軟體代碼來實現狀態切換的控制,而造成增加軟體開發的工作量,浪費研發的人力資源的問題。The main purpose of this application is to provide an RS-485 circuit and communication system, which solves the problem of increasing the workload of software development due to the need to add additional software codes to the processing module of the device to realize the control of state switching in the prior art , the problem of wasting human resources for research and development.

為了實現上述目的,本申請是這樣實現的:In order to achieve the above object, the application is implemented as follows:

第一方面,提供了一種RS-485電路,設置於包括處理模組的電子裝置中。RS-485電路包括:RS-485介面晶片、啟動偵測器、積體匯流排電路與計數器。其中,RS-485介面晶片的預設狀態為資料接收狀態且包括:資料輸入端與致能端,資料輸入端用以接收來自處理模組的資料信號;致能端用以接收啟動信號後,使RS-485介面晶片處於資料發送狀態;及用以接收切換信號後,使RS-485介面晶片處於資料接收狀態。啟動偵測器用以偵測到資料信號的第一個信號邊緣而產生啟動信號至致能端。積體匯流排電路連接處理模組,計數器連接積體匯流排電路與致能端。計數器包括暫存器,來自處理模組的計數值通過積體匯流排電路儲存於暫存器,使得計數器基於計數值進行計數,並於計數到期時輸出切換信號至致能端,其中,處理模組基於資料信號的資料長度與鮑率產生計數值。In a first aspect, an RS-485 circuit is provided, which is disposed in an electronic device including a processing module. The RS-485 circuit includes: RS-485 interface chip, start detector, integrated bus circuit and counter. Wherein, the default state of the RS-485 interface chip is the data receiving state and includes: a data input terminal and an enabling terminal, the data input terminal is used to receive the data signal from the processing module; the enabling terminal is used to receive the start signal, Make the RS-485 interface chip in the data sending state; and after receiving the switching signal, make the RS-485 interface chip in the data receiving state. The start detector is used for detecting the first signal edge of the data signal to generate a start signal to the enable terminal. The integrated bus circuit is connected to the processing module, and the counter is connected to the integrated bus circuit and the enabling terminal. The counter includes a temporary register, and the count value from the processing module is stored in the temporary register through the integrated bus circuit, so that the counter counts based on the count value, and outputs a switching signal to the enabling terminal when the count expires, wherein, the processing The module generates a count value based on the data length and baud rate of the data signal.

第二方面,提供一種通訊系統,其包括:處理模組、通訊匯流排與RS-485電路,其中,RS-485電路通過通訊匯流排連接處理模組。處理模組用以基於資料信號的資料長度與鮑率產生計數值;RS-485電路包括:RS-485介面晶片、啟動偵測器、積體匯流排電路與計數器。其中,RS-485介面晶片的預設狀態為資料接收狀態且包括:資料輸入端與致能端,資料輸入端用以接收來自處理模組的資料信號;致能端用以接收啟動信號後,使RS-485介面晶片處於資料發送狀態;及用以接收切換信號後,使RS-485介面晶片處於資料接收狀態。啟動偵測器用以偵測到資料信號的第一個信號邊緣而產生啟動信號至致能端。積體匯流排電路連接處理模組,計數器連接積體匯流排電路與致能端。計數器包括暫存器,來自處理模組的計數值通過積體匯流排電路儲存於暫存器,使得計數器基於計數值進行計數,並於計數到期時輸出切換信號至致能端。In a second aspect, a communication system is provided, which includes: a processing module, a communication bus and an RS-485 circuit, wherein the RS-485 circuit is connected to the processing module through the communication bus. The processing module is used to generate a count value based on the data length and baud rate of the data signal; the RS-485 circuit includes: an RS-485 interface chip, a start detector, an integrated bus circuit and a counter. Wherein, the default state of the RS-485 interface chip is the data receiving state and includes: a data input terminal and an enabling terminal, the data input terminal is used to receive the data signal from the processing module; the enabling terminal is used to receive the start signal, Make the RS-485 interface chip in the data sending state; and after receiving the switching signal, make the RS-485 interface chip in the data receiving state. The start detector is used for detecting the first signal edge of the data signal to generate a start signal to the enable terminal. The integrated bus circuit is connected to the processing module, and the counter is connected to the integrated bus circuit and the enabling terminal. The counter includes a temporary register, and the count value from the processing module is stored in the temporary register through the integrated bus circuit, so that the counter counts based on the count value, and outputs a switching signal to the enabling terminal when the count expires.

在本申請中,通過啟動偵測器、控制模組與計數器的設置,使得RS-485電路可由硬體方式自動判斷RS-485介面晶片的資料傳輸方向及傳輸時間,避免因資料尚未完全傳送完畢便將傳輸方向進行切換或者資料傳輸完畢卻未及時切換傳輸方向,而造成資料傳輸上的錯誤,也可解決現有技術中存在因需要在裝置的處理模組上增加額外的軟體代碼來實現狀態切換的控制,而造成增加軟體開發的工作量,浪費研發的人力資源的問題。In this application, by setting up the detector, the control module and the counter, the RS-485 circuit can automatically judge the data transmission direction and transmission time of the RS-485 interface chip by means of hardware, so as to avoid the problem that the data has not been completely transmitted Then the transmission direction is switched or the data transmission is completed but the transmission direction is not switched in time, resulting in errors in data transmission, and it can also solve the problem in the prior art that additional software codes need to be added to the processing module of the device to achieve state switching control, resulting in increased workload of software development, waste of human resources for research and development.

以下將配合相關圖式來說明本發明的實施例。在這些圖式中,相同的標號表示相同或類似的組件或方法流程。Embodiments of the present invention will be described below in conjunction with related figures. In these drawings, the same reference numerals indicate the same or similar components or method flows.

必須瞭解的是,使用在本說明書中的「包含」、「包括 」等詞,是用於表示存在特定的技術特徵、數值、方法步驟、作業處理、元件和/或組件,但並不排除可加上更多的技術特徵、數值、方法步驟、作業處理、元件、組件,或以上的任意組合。It must be understood that words such as "comprising" and "including" used in this specification are used to indicate the existence of specific technical features, values, method steps, operations, components and/or components, but do not exclude possible Add more technical characteristics, values, method steps, operation processes, components, components, or any combination of the above.

必須瞭解的是,當組件描述為「連接 」或「耦接 」至另一組件時,可以是直接連結、或耦接至其他組件,可能出現中間組件。相反地,當組件描述為「直接連接 」或「直接耦接 」至另一組件時,其中不存在任何中間組件。It must be understood that when a component is described as being "connected" or "coupled" to another component, it may be directly linked, or coupled to the other component, and intervening components may be present. Conversely, when a component is described as being "directly connected" or "directly coupled" to another component, there are no intervening components present.

請參閱圖1,其為依據本申請的RS-485電路的一實施例方塊圖。如圖1所示,在本實施例中,RS-485電路100設置於包括處理模組(未繪製)的電子裝置(未繪製)中,且RS-485電路100包括:RS-485介面晶片110、啟動偵測器120、積體匯流排電路130與計數器140,積體匯流排電路130連接所述處理模組與計數器140,啟動偵測器120與計數器140分別連接RS-485介面晶片110;RS-485介面晶片110可通過RS-485匯流排50與其他RS-485介面晶片(未繪製)連接,以使配置有RS-485介面晶片110的電子裝置通過RS-485匯流排50與配置有所述其他RS-485介面晶片的電子裝置(未繪製)進行資料發送和接收。其中,由於積體匯流排電路130具有佔用的空間非常小的優勢,可減少了電子裝置的印刷電路板的空間,降低了互連成本;另外,積體匯流排電路130僅具有兩條信號線,對使用者而言,操作上更顯得簡單且方便,且可減少與其連接的所述處理模組的引腳數量,避免浪費所述處理模組的I/O資源。Please refer to FIG. 1 , which is a block diagram of an embodiment of an RS-485 circuit according to the present application. As shown in Figure 1, in this embodiment, the RS-485 circuit 100 is set in an electronic device (not shown) including a processing module (not shown), and the RS-485 circuit 100 includes: an RS-485 interface chip 110 , start the detector 120, the integrated bus bar circuit 130 and the counter 140, the integrated bus bar circuit 130 is connected to the processing module and the counter 140, the start detector 120 and the counter 140 are respectively connected to the RS-485 interface chip 110; The RS-485 interface chip 110 can be connected with other RS-485 interface chips (not shown) through the RS-485 bus bar 50, so that the electronic device configured with the RS-485 interface chip 110 can be connected with the RS-485 bus bar 50 and configured with The electronic devices (not shown) of the other RS-485 interface chips carry out data transmission and reception. Wherein, because the integrated busbar circuit 130 has the advantage of occupying a very small space, the space of the printed circuit board of the electronic device can be reduced, and the interconnection cost is reduced; in addition, the integrated busbar circuit 130 only has two signal lines , for the user, the operation is more simple and convenient, and the number of pins of the processing module connected thereto can be reduced, so as to avoid wasting the I/O resources of the processing module.

在本實施例中,RS-485介面晶片110的預設狀態為資料接收狀態且包括:資料輸入端111與致能端112,資料輸入端111用以接收資料信號;致能端112用以接收啟動信號後,使RS-485介面晶片110處於資料發送狀態;及用以接收切換信號後,使RS-485介面晶片110處於資料接收狀態。需注意的是,RS-485介面晶片110預設為資料接收狀態時,所述資料信號可預設但不限於高準位信號,致能端112接收到的信號可預設但不限於高準位信號;當所述資料信號開始發生信號狀態轉換(即所述資料信號包括信號邊緣)時,代表配置有RS-485介面晶片110的裝置要開始傳輸資料,RS-485介面晶片110需切換為資料發送狀態,但本實施例並非用以限定本發明。舉例而言,RS-485介面晶片110預設為資料接收狀態時,所述資料信號也可預設為低準位信號,致能端112接收到的信號也可預設為低準位信號。In this embodiment, the default state of the RS-485 interface chip 110 is the data receiving state and includes: a data input terminal 111 and an enabling terminal 112, the data input terminal 111 is used for receiving data signals; the enabling terminal 112 is used for receiving After the start signal, the RS-485 interface chip 110 is in the data sending state; and after receiving the switching signal, the RS-485 interface chip 110 is in the data receiving state. It should be noted that when the RS-485 interface chip 110 is preset to receive data, the data signal can be preset but not limited to a high-level signal, and the signal received by the enable terminal 112 can be preset but not limited to Micro Motion bit signal; when the data signal begins to undergo a signal state transition (that is, the data signal includes a signal edge), it means that the device equipped with the RS-485 interface chip 110 will start to transmit data, and the RS-485 interface chip 110 needs to switch to The data sending status, but this embodiment is not intended to limit the present invention. For example, when the RS-485 interface chip 110 is preset to receive data, the data signal can also be preset as a low-level signal, and the signal received by the enabling terminal 112 can also be preset as a low-level signal.

在一實施例中,當RS-485介面晶片110預設為資料接收狀態且致能端112接收到的信號可預設為高準位信號時,所述啟動信號可為低準位信號,所述切換信號可為高準位信號。在另一實施例中,當RS-485介面晶片110預設為資料接收狀態且致能端112接收到的信號可預設為低準位信號時,所述啟動信號可為高準位信號,所述切換信號可為低準位信號。In one embodiment, when the RS-485 interface chip 110 is preset to the data receiving state and the signal received by the enabling terminal 112 can be preset as a high level signal, the start signal can be a low level signal, so The switching signal can be a high level signal. In another embodiment, when the RS-485 interface chip 110 is preset to the data receiving state and the signal received by the enabling terminal 112 can be preset as a low-level signal, the start signal can be a high-level signal, The switching signal can be a low level signal.

在一實施例中,RS-485介面晶片110還可包括:差分信號收發端113,當RS-485介面晶片110處於資料發送狀態時,RS-485介面晶片110基於資料輸入端111所接收到的資料信號通過差分信號收發端113輸出差分信號至RS-485匯流排50;當RS-485介面晶片110處於資料接收狀態時,RS-485介面晶片110通過差分信號收發端113接收來自RS-485匯流排50的另一差分信號。更詳細地說,差分信號收發端113可包括差分信號引腳113a與差分信號引腳113b,當RS-485介面晶片110處於資料發送狀態時,RS-485介面晶片110基於資料輸入端111所接收到的資料信號通過差分信號引腳113a與差分信號引腳113b輸出差分信號至RS-485匯流排50;當RS-485介面晶片110處於資料接收狀態時,RS-485介面晶片110通過差分信號引腳113a與差分信號引腳113b接收來自RS-485匯流排50的另一差分信號。In one embodiment, the RS-485 interface chip 110 may further include: a differential signal transceiver terminal 113. When the RS-485 interface chip 110 is in the state of data transmission, the RS-485 interface chip 110 receives the signal based on the data input terminal 111. The data signal outputs a differential signal to the RS-485 bus 50 through the differential signal transceiver terminal 113; Another differential signal for row 50. In more detail, the differential signal transceiver 113 may include a differential signal pin 113a and a differential signal pin 113b. The received data signal outputs the differential signal to the RS-485 bus bar 50 through the differential signal pin 113a and the differential signal pin 113b; The pin 113 a and the differential signal pin 113 b receive another differential signal from the RS-485 bus 50 .

在一實施例中,RS-485介面晶片110還可包括:資料輸出端114,當RS-485介面晶片110處於資料接收狀態時,RS-485介面晶片110基於差分信號收發端113接收到的另一差分信號通過資料輸出端114輸出另一資料信號。In one embodiment, the RS-485 interface chip 110 may further include: a data output terminal 114. When the RS-485 interface chip 110 is in the data receiving state, the RS-485 interface chip 110 receives another signal based on the differential signal transceiver terminal 113. A differential signal outputs another data signal through the data output terminal 114 .

在一實施例中,RS-485介面晶片110包括傳送邏輯單元60與接收邏輯單元70,其中,傳送邏輯單元60的輸入端連接資料輸入端111,傳送邏輯單元60的輸出端連接差分信號收發端113,傳送邏輯單元60的控制端連接致能端112;接收邏輯單元70的輸入端連接差分信號收發端113,接收邏輯單元70的輸出端連接資料輸出端114,接收邏輯單元70的控制端連接致能端112。需注意的是,當RS-485介面晶片110預設為資料接收狀態時,傳送邏輯單元60不會進行運作,接收邏輯單元70會進行運作;當RS-485介面晶片110預設為資料發送狀態時,傳送邏輯單元60會進行運作,接收邏輯單元70不會進行運作。In one embodiment, the RS-485 interface chip 110 includes a transmission logic unit 60 and a reception logic unit 70, wherein the input terminal of the transmission logic unit 60 is connected to the data input terminal 111, and the output terminal of the transmission logic unit 60 is connected to the differential signal transceiver terminal. 113, the control terminal of the transmission logic unit 60 is connected to the enabling terminal 112; the input terminal of the receiving logic unit 70 is connected to the differential signal transceiver terminal 113, the output terminal of the receiving logic unit 70 is connected to the data output terminal 114, and the control terminal of the receiving logic unit 70 is connected to Enable terminal 112 . It should be noted that when the RS-485 interface chip 110 is preset to the data receiving state, the transmitting logic unit 60 will not operate, but the receiving logic unit 70 will operate; when the RS-485 interface chip 110 is preset to the data sending state When , the transmitting logic unit 60 will operate, and the receiving logic unit 70 will not operate.

在本實施例中,啟動偵測器120用以偵測到資料信號的第一個信號邊緣而產生啟動信號至致能端112。換句話說,當所述資料信號開始發生信號狀態轉換(即所述資料信號包括信號邊緣)時,代表配置有RS-485介面晶片110的裝置要開始傳輸資料,因此,啟動偵測器120偵測到所述資料信號的第一個信號邊緣時即產生並傳輸所述啟動信號至致能端112,以使RS-485介面晶片110切換為資料發送狀態。其中,當所述資料信號預設為高準位信號時,所述第一個信號邊緣可為下降緣;當所述資料信號預設為低準位信號時,所述第一個信號邊緣可為上升緣,可依據實際需求進行調整。In this embodiment, the enable detector 120 is used to detect the first signal edge of the data signal and generate the enable signal to the enable terminal 112 . In other words, when the data signal starts to undergo a signal state transition (that is, the data signal includes a signal edge), it means that the device configured with the RS-485 interface chip 110 will start to transmit data, so the start detector 120 detects When the first signal edge of the data signal is detected, the start signal is generated and transmitted to the enabling terminal 112, so that the RS-485 interface chip 110 is switched to the data sending state. Wherein, when the data signal is preset as a high-level signal, the first signal edge may be a falling edge; when the data signal is preset as a low-level signal, the first signal edge may be It can be adjusted according to actual needs.

在一實施例中,當啟動偵測器120偵測到資料信號的第一個信號邊緣時,產生另一啟動信號給計數器140,以啟動計數器140。In one embodiment, when the enable detector 120 detects the first signal edge of the data signal, another enable signal is generated to the counter 140 to enable the counter 140 .

在一實施例中,啟動偵測器120還可用以持續偵測資料信號的信號邊緣,當啟動偵測器120於一預設時間內未偵測到信號邊緣時,則於該預設時間後第一次偵測到信號邊緣時產生啟動信號。換句話說,所述資料信號的第一個信號邊緣可為但不限於在該預設時間後第一次偵測到的信號邊緣。其中,所述預設時間的大小可依據實際需求進行調整。In one embodiment, the activation detector 120 can also be used to continuously detect the signal edge of the data signal. When the activation detector 120 does not detect the signal edge within a preset time, then after the preset time A start signal is generated when a signal edge is detected for the first time. In other words, the first signal edge of the data signal may be but not limited to the first detected signal edge after the preset time. Wherein, the preset time can be adjusted according to actual needs.

在本實施例中,計數器140包括暫存器142,來自所述處理模組的計數值通過積體匯流排電路130儲存於暫存器142,使得計數器140基於計數值進行計數,並於計數到期時輸出切換信號至致能端112。其中,當計數器140計數到所述計數值時,代表計數器140計數到期,也代表資料傳輸完畢(因為所述處理模組基於資料信號的資料長度與鮑率產生所述計數值)。其中,所述資料信號的資料長度係可為但不限於所述資料信號的第一個信號邊緣到最後一個信號邊緣之間的長度,所述鮑率為傳輸所述資料信號的速率。需注意的是,所述資料信號的倒數第二個信號邊緣與最後一個信號邊緣之間的時序差不可大於上述預設時間。In this embodiment, the counter 140 includes a temporary register 142, and the count value from the processing module is stored in the temporary register 142 through the integrated bus circuit 130, so that the counter 140 counts based on the count value, and counts to Periodically output the switching signal to the enabling terminal 112 . Wherein, when the counter 140 counts to the count value, it means that the count of the counter 140 expires, and it also means that the data transmission is completed (because the processing module generates the count value based on the data length and baud rate of the data signal). Wherein, the data length of the data signal may be, but not limited to, the length between the first signal edge and the last signal edge of the data signal, and the baud rate is the transmission rate of the data signal. It should be noted that the timing difference between the penultimate signal edge and the last signal edge of the data signal cannot be greater than the aforementioned preset time.

在一實施例中,積體匯流排電路130與計數器140有相對應的鮑率,即可在相對應的鮑率下,於計數器140計數到期時告知致能端112,使致能端112控制RS-485介面晶片110切換為資料接收狀態。此外,由於積體匯流排電路130與計數器140有相對應的鮑率,所以計數器140不會單單只計數一種鮑率,而需要有計數不同鮑率的功能。In one embodiment, the integrated bus circuit 130 and the counter 140 have a corresponding baud rate, that is, at the corresponding baud rate, when the count of the counter 140 expires, the enabling terminal 112 is notified, so that the enabling terminal 112 Control the RS-485 interface chip 110 to switch to the data receiving state. In addition, since the integrated bus circuit 130 and the counter 140 have corresponding baud rates, the counter 140 does not only count one baud rate, but needs to have the function of counting different baud rates.

請參閱圖2,其為依據本申請的通訊系統的一實施例方塊圖。在本實施例中, 通訊系統200包括:處理模組210、通訊匯流排220與RS-485電路100,其中,RS-485電路100通過通訊匯流排220連接處理模組210。其中,資料輸入端111通過通訊匯流排220接收來自處理模組210的資料信號,資料輸出端114通過通訊匯流排220輸出另一資料信號至處理模組210;處理模組210可為但不限於微處理器、中央處理器或單晶片且基於資料信號的資料長度與鮑率產生所述計數值;通訊匯流排220可為但不限於通用異步接收發射器(UART)匯流排。Please refer to FIG. 2 , which is a block diagram of an embodiment of a communication system according to the present application. In this embodiment, the communication system 200 includes: a processing module 210 , a communication bus 220 and an RS-485 circuit 100 , wherein the RS-485 circuit 100 is connected to the processing module 210 through the communication bus 220 . Wherein, the data input terminal 111 receives the data signal from the processing module 210 through the communication bus 220, and the data output terminal 114 outputs another data signal to the processing module 210 through the communication bus 220; the processing module 210 can be but not limited to A microprocessor, a central processing unit or a single chip generates the count value based on the data length and baud rate of the data signal; the communication bus 220 can be but not limited to a Universal Asynchronous Receiver Transmitter (UART) bus.

因此,配置有本申請實施例的RS-485電路100或通訊系統200的多個電子裝置之間進行資料發送和接收時,傳輸資料的電子裝置的RS-485介面晶片110可因其資料輸入端111發生信號狀態轉換而切換為資料發送狀態,而接收資料的其他電子裝置的RS-485介面晶片110仍維持為資料接收狀態(因其資料輸入端111未發生信號狀態轉換而維持為預設狀態),使得該些電子裝置之間能順利完成資料的傳送與接收;而當傳輸資料的電子裝置完成資料的傳送時,即可基於其具有的計數器140到期而將其具有的RS-485介面晶片110切換為預設的資料接收狀態。Therefore, when data is sent and received between a plurality of electronic devices configured with the RS-485 circuit 100 or the communication system 200 of the embodiment of the present application, the RS-485 interface chip 110 of the electronic device that transmits the data can be connected by its data input terminal. 111 has a signal state transition and switches to the data sending state, while the RS-485 interface chip 110 of other electronic devices receiving data remains in the data receiving state (because the data input terminal 111 has no signal state transition and remains in the default state ), so that the transmission and reception of data can be successfully completed between these electronic devices; and when the electronic device that transmits data completes the transmission of data, the RS-485 interface that it has can be based on the expiration of the counter 140 it has. The chip 110 is switched to a preset data receiving state.

綜上所述,本申請實施例的RS-485電路可通過啟動偵測器、控制模組與計數器的設置,使得RS-485電路可由硬體方式自動判斷RS-485介面晶片的資料傳輸方向及傳輸時間,避免因資料尚未完全傳送完畢便將傳輸方向進行切換或者資料傳輸完畢卻未及時切換傳輸方向,而造成資料傳輸上的錯誤,也可解決現有技術中存在因需要在裝置的處理模組上增加額外的軟體代碼來實現狀態切換的控制,而造成增加軟體開發的工作量,浪費研發的人力資源的問題。In summary, the RS-485 circuit of the embodiment of the present application can automatically determine the direction of data transmission of the RS-485 interface chip and the Transmission time, to avoid errors in data transmission caused by switching the transmission direction before the data is completely transmitted or not switching the transmission direction in time after the data transmission is completed, and can also solve the existing problems in the prior art due to the need for processing modules in the device Adding additional software codes on the computer to realize the control of state switching will increase the workload of software development and waste human resources for research and development.

雖然在本申請的圖式中包含了以上描述的組件,但不排除在不違反發明的精神下,使用更多其他的附加組件,已達成更佳的技術效果。Although the above-described components are included in the drawings of the present application, it is not excluded to use more other additional components to achieve better technical effects without violating the spirit of the invention.

雖然本發明使用以上實施例進行說明,但需要注意的是,這些描述並非用於限縮本發明。相反地,此發明涵蓋了所屬技術領域中的技術人員顯而易見的修改與相似設置。所以,申請專利範圍須以最寬廣的方式解釋來包含所有顯而易見的修改與相似設置。While the invention has been described using the above examples, it should be noted that these descriptions are not intended to limit the invention. On the contrary, this invention covers modifications and similar arrangements obvious to those skilled in the art. Therefore, the claims must be construed in the broadest manner to include all obvious modifications and similar arrangements.

50:RS-485匯流排 60:傳送邏輯單元 70:接收邏輯單元 100:RS-485電路 110:RS-485介面晶片 111:資料輸入端 112:致能端 113:差分信號收發端 113a, 113b:差分信號引腳 114:資料輸出端 120:啟動偵測器 130:積體匯流排電路 140:計數器 142:暫存器 200:通訊系統 210:處理模組 220:通訊匯流排 50: RS-485 bus 60:Transfer logic unit 70: Receive logic unit 100: RS-485 circuit 110: RS-485 interface chip 111: data input terminal 112: enable end 113: Differential signal transceiver 113a, 113b: differential signal pins 114: data output terminal 120:Start detector 130: Integrated busbar circuit 140: Counter 142: Temporary register 200: Communication system 210: Processing module 220: communication bus

此處所說明的圖式用來提供對本申請的進一步理解,構成本申請的一部分,本申請的示意性實施例及其說明用於解釋本申請,並不構成對本申請的不當限定。在圖式中: 圖1為依據本申請的RS-485電路的一實施例方塊圖;以及 圖2為依據本申請的通訊系統的一實施例方塊圖。 The drawings described here are used to provide a further understanding of the application and constitute a part of the application. The schematic embodiments and descriptions of the application are used to explain the application and do not constitute an improper limitation to the application. In the schema: Fig. 1 is an embodiment block diagram according to the RS-485 circuit of the present application; And FIG. 2 is a block diagram of an embodiment of a communication system according to the present application.

50:RS-485匯流排 50: RS-485 bus

60:傳送邏輯單元 60:Transfer logic unit

70:接收邏輯單元 70: Receive logic unit

100:RS-485電路 100: RS-485 circuit

110:RS-485介面晶片 110: RS-485 interface chip

111:資料輸入端 111: data input terminal

112:致能端 112: enable end

113:差分信號收發端 113: Differential signal transceiver

113a,113b:差分信號引腳 113a, 113b: differential signal pins

114:資料輸出端 114: data output terminal

120:啟動偵測器 120:Start detector

130:積體匯流排電路 130: Integrated busbar circuit

140:計數器 140: counter

142:暫存器 142: Temporary register

Claims (10)

一種RS-485電路,設置於包括一處理模組的一電子裝置中,該RS-485電路包括: 一RS-485介面晶片,該RS-485介面晶片的一預設狀態為一資料接收狀態,該RS-485介面晶片包括: 一資料輸入端,用以接收來自該處理模組的一資料信號;以及 一致能端,用以接收一啟動信號後,使該RS-485介面晶片處於一資料發送狀態;及用以接收一切換信號後,使該RS-485介面晶片處於該資料接收狀態; 一啟動偵測器,連接該資料輸入端與該致能端,用以偵測到該資料信號的第一個信號邊緣而產生該啟動信號至該致能端; 一積體匯流排電路(Inter-Integrated Circuit,I 2C),連接該處理模組;以及 一計數器,連接該積體匯流排電路與該致能端,包括一暫存器,來自該處理模組的一計數值通過該積體匯流排電路儲存於該暫存器,使得該計數器基於該計數值進行計數,並於計數到期時輸出該切換信號至該致能端,其中,該處理模組基於該資料信號的一資料長度與一鮑率產生該計數值。 An RS-485 circuit, set in an electronic device including a processing module, the RS-485 circuit includes: an RS-485 interface chip, a default state of the RS-485 interface chip is a data receiving state, The RS-485 interface chip includes: a data input terminal for receiving a data signal from the processing module; state; and after receiving a switch signal, make the RS-485 interface chip in the data receiving state; a start detector, connected to the data input end and the enabling end, for detecting the data signal The start signal is generated to the enabling terminal by the first signal edge; an integrated bus circuit (Inter-Integrated Circuit, I 2 C) is connected to the processing module; and a counter is connected to the integrated bus circuit and the enable end, including a temporary register, a count value from the processing module is stored in the temporary register through the integrated bus circuit, so that the counter counts based on the count value, and when the count expires Outputting the switching signal to the enabling terminal at the same time, wherein the processing module generates the count value based on a data length and a baud rate of the data signal. 如請求項1所述的RS-485電路,其中,該RS-485介面晶片還包括:一差分信號收發端,當該RS-485介面晶片處於該資料發送狀態時,該RS-485介面晶片基於該資料信號通過該差分信號收發端輸出一差分信號至一RS-485匯流排;及當該RS-485介面晶片處於該資料接收狀態時,該RS-485介面晶片通過該差分信號收發端接收來自該RS-485匯流排的另一差分信號。The RS-485 circuit as described in claim 1, wherein the RS-485 interface chip also includes: a differential signal transceiver, when the RS-485 interface chip is in the data transmission state, the RS-485 interface chip is based on The data signal outputs a differential signal to an RS-485 bus through the differential signal transceiver end; and when the RS-485 interface chip is in the data receiving state, the RS-485 interface chip receives the signal from Another differential signal for the RS-485 bus. 如請求項2所述的RS-485電路,其中,該RS-485介面晶片還包括:一資料輸出端,當該RS-485介面晶片處於該資料接收狀態時,該RS-485介面晶片基於該另一差分信號通過該資料輸出端輸出另一資料信號。The RS-485 circuit as described in claim 2, wherein, the RS-485 interface chip also includes: a data output terminal, when the RS-485 interface chip is in the data receiving state, the RS-485 interface chip is based on the Another differential signal outputs another data signal through the data output terminal. 如請求項1所述的RS-485電路,其中,當該啟動偵測器偵測到該資料信號的該第一個信號邊緣時,產生另一啟動信號給該計數器,以啟動該計數器。The RS-485 circuit as claimed in claim 1, wherein when the enable detector detects the first signal edge of the data signal, it generates another enable signal to the counter to activate the counter. 如請求項1所述的RS-485電路,其中,該第一個信號邊緣為下降緣或上升緣。The RS-485 circuit according to claim 1, wherein the first signal edge is a falling edge or a rising edge. 如請求項1所述的RS-485電路,其中,該啟動偵測器還用以持續偵測該資料信號的一信號邊緣,當該啟動偵測器於一預設時間內未偵測到該信號邊緣時,則於該預設時間後第一次偵測到該信號邊緣時產生該啟動信號。The RS-485 circuit as described in claim 1, wherein, the start detector is also used to continuously detect a signal edge of the data signal, when the start detector does not detect the signal edge within a preset time When the signal edge is detected, the start signal is generated when the signal edge is detected for the first time after the preset time. 如請求項1所述的RS-485電路,其中,該啟動信號為高準位信號,該切換信號為低準位信號。The RS-485 circuit according to claim 1, wherein the start signal is a high level signal, and the switching signal is a low level signal. 如請求項1所述的RS-485電路,其中,該啟動信號為低準位信號,該切換信號為高準位信號。The RS-485 circuit according to claim 1, wherein the start signal is a low level signal, and the switching signal is a high level signal. 如請求項1所述的RS-485電路,其中,該積體匯流排電路與該計數器有相對應的鮑率。The RS-485 circuit according to claim 1, wherein the integrated bus circuit and the counter have corresponding baud rates. 一種通訊系統,其包括: 一處理模組,用以基於一資料信號的一資料長度與一鮑率產生一計數值; 一通訊匯流排;以及 一RS-485電路,通過該通訊匯流排連接該處理模組,該RS-485電路包括: 一RS-485介面晶片,該RS-485介面晶片的一預設狀態為一資料接收狀態,該RS-485介面晶片包括: 一資料輸入端,用以接收來自該處理模組的該資料信號;以及 一致能端,用以接收一啟動信號後,使該RS-485介面晶片處於一資料發送狀態;及用以接收一切換信號後,使該RS-485介面晶片處於該資料接收狀態; 一啟動偵測器,連接該資料輸入端與該致能端,用以偵測到該資料信號的第一個信號邊緣而產生該啟動信號至該致能端; 一積體匯流排電路,連接該處理模組;以及 一計數器,連接該積體匯流排電路與該致能端,包括一暫存器,來自該處理模組的該計數值通過該積體匯流排電路儲存於該暫存器,使得該計數器基於該計數值進行計數,並於計數到期時輸出該切換信號至該致能端。 A communication system comprising: a processing module for generating a count value based on a data length and a baud rate of a data signal; a communication bus; and An RS-485 circuit, connected to the processing module through the communication bus, the RS-485 circuit includes: An RS-485 interface chip, a default state of the RS-485 interface chip is a data receiving state, and the RS-485 interface chip includes: a data input terminal for receiving the data signal from the processing module; and An enabling terminal is used to make the RS-485 interface chip in a data sending state after receiving a start signal; and is used to make the RS-485 interface chip in the data receiving state after receiving a switching signal; an enable detector, connected to the data input terminal and the enable terminal, for detecting the first signal edge of the data signal and generating the enable signal to the enable terminal; an integrated bus circuit connected to the processing module; and A counter, connected to the integrated bus circuit and the enable terminal, includes a temporary register, the count value from the processing module is stored in the temporary register through the integrated bus circuit, so that the counter is based on the The count value is counted, and the switching signal is output to the enabling terminal when the count expires.
TW110119565A 2021-05-28 2021-05-28 Rs-485 circuit and communication system TWI769840B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
TW110119565A TWI769840B (en) 2021-05-28 2021-05-28 Rs-485 circuit and communication system
CN202111137448.4A CN115408324A (en) 2021-05-28 2021-09-27 RS-485 circuit and communication system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW110119565A TWI769840B (en) 2021-05-28 2021-05-28 Rs-485 circuit and communication system

Publications (2)

Publication Number Publication Date
TWI769840B TWI769840B (en) 2022-07-01
TW202246992A true TW202246992A (en) 2022-12-01

Family

ID=83439524

Family Applications (1)

Application Number Title Priority Date Filing Date
TW110119565A TWI769840B (en) 2021-05-28 2021-05-28 Rs-485 circuit and communication system

Country Status (2)

Country Link
CN (1) CN115408324A (en)
TW (1) TWI769840B (en)

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE102013219277A1 (en) * 2013-09-25 2015-03-26 Dr. Johannes Heidenhain Gmbh Position measuring device and method for checking a working clock signal
DE102014212288A1 (en) * 2014-06-26 2015-12-31 Dr. Johannes Heidenhain Gmbh Device and method for generating a trigger signal in a position measuring device and position measuring device for this purpose

Also Published As

Publication number Publication date
TWI769840B (en) 2022-07-01
CN115408324A (en) 2022-11-29

Similar Documents

Publication Publication Date Title
US8761031B2 (en) Physical layer loopback
US10180927B2 (en) Device, system and method for communication with heterogeneous physical layers
JP5930025B2 (en) USB isolator integrated circuit with USB 2.0 high speed mode and automatic speed detection
US9141496B2 (en) Methods and systems for testing electrical behavior of an interconnect having asymmetrical link
US9734116B2 (en) Method, apparatus and system for configuring a protocol stack of an integrated circuit chip
KR101129748B1 (en) Optimizing exit latency from an active power management state
CN108920401B (en) Multi-master multi-slave I2C communication method, system and node equipment
KR20150109259A (en) Method, apparatus and system for single-ended communication of transaction layer packets
US9880895B2 (en) Serial interface with bit-level acknowledgement and error correction
CN113792003A (en) Single bus communication unit, system and method
US20230229607A1 (en) Variable Speed Data Transmission Between PHY Layer and MAC Layer
TW202246992A (en) Rs-485 circuit and communication system
CN216873219U (en) Communication circuit and multi-master communication system
TWI786890B (en) Rs-485 circuit and communication system
US20200285602A1 (en) eUSB2 to USB 2.0 Data Transmission with Surplus Sync Bits
TW202241110A (en) Pcie interface and interface system
CN108234252B (en) Multi-path Ethernet communication system
US11630795B2 (en) RS-485 circuit and communication system
US9880968B2 (en) Bi-directional communication between electronic components
CN114942866B (en) LIN main testing device
US20190121763A1 (en) Method for communicating with another electronic device and associated electronic device
JP3203751B2 (en) Error counting device
KR20030075118A (en) Apparatus for interfacing of utopia level in atm system
JPWO2012140783A1 (en) Autonomous initialization method for opposite port of semiconductor integrated circuit and semiconductor integrated circuit
JPH0675904A (en) Ic for arbitration and bi-directional signal mutual converter