Understanding RS-485 Communication > 커뮤니티 카카오소프트 홈페이지 방문을 환영합니다.

본문 바로가기

커뮤니티

커뮤니티 HOME


Understanding RS-485 Communication

페이지 정보

작성자 Gail Weigall 댓글 0건 조회 11회 작성일 24-08-04 22:57

본문

A ground connection is also necessary to ensure that the communicating devices have a common voltage reference. This diagram shows how to connect a FieldServer FS20 series to an ICD102A optical isolator using a 2-wire RS 485 connection. On the other hand, the secondary serial port (Serial2) is implemented using hardware pins PA3 (input) and PA4 (output), and is controlled by the associated interrupts IC4/OC5 and OC4, respectively. Routines that temporarily disable interrupts for significant periods of time can also interfere with the Serial2 port. It provides a convenient means of connecting the QScreen Controller to a variety of peripheral devices, including analog to digital and digital to analog converters, real time clocks, and other computers which use high speed communication. There are a variety of ways the MOSI, MISO, SCK and /SS pins on your QScreen Controller can be connected. The QScreen allows the details of the synchronous communications protocol to be customized for compatibility with a variety of peripherals. To use a QScreen as a slave in a multi-drop network, simply define a word, (named Silence(void), for example) that when executed calls RS485Receive() to wait for any pending character transmission to complete, then disable the transmitter, and then execute a routine such as Key() to listen to the communications on the serial bus.



RS485Receive() clears bit PD5 to place the transceiver in receive mode, and RS485Transmit() sets bit PD5 to place the transceiver in transmit mode. The DWOM bit (port D wired-or mode) should always be set to 0. Setting DWOM to 1 takes away the processor’s ability to pull the Port D signals high unless there is a pull-up resistor on each bit of the port. When it is low, the transceiver is in receive mode. When the /SS input goes low, the slave (or QScreen in this case) transfers data in response to the SCK clock input that is initiated by the master. By setting this output LOW, the slave’s input /SS is pulled LOW. When the network master wants to talk to this particular slave, what is rs485 cable it outputs the slave’s ascii name onto the serial bus. The only difference between the master and slave devices is that the master initiates the transmission. The device that initiates a data transfer is the master, and all other devices on the network are slaves. If not only the electrical parameters are to be monitored, but also the energy consumption, measuring instruments which also have active and reactive energy metering should be selected. Only one active master may control the network at a time; however, the device that assumes the role of master may change according to an appropriate protocol.



The GROUND line serves as a common voltage reference for the master and slave. The data exchange format may be a line of ascii text. The master and slave could even exchange ascii QED-Forth commands. The Silence() routine searches the incoming serial characters for a pre-determined keyword (for example, the ascii "name" of this particular slave). When the exchange is complete, the slave can again execute the Silence() routine to disable its transmitter and begin listening for its name. In the middle of a character, each interrupt service routine takes about 35 µs. By polling the Port A pin or by setting up an interrupt service routine, you can configure the QScreen to ignore the SCK input when /SS is high and keep MISO in a high-impedance state so that it does not interfere with the SPI bus. If your application requires use of the secondary serial port as well as other interrupt routines, the key is to keep the interrupt service routines short and fast.



Also, several non-serial interrupts can stack up; if they have higher priority than the serial interrupts, they will be serviced before the Serial2 interrupt routine, and again a serial input or output bit may be lost. Because the software UART is interrupt based, competing interrupts that prevent timely servicing of the Serial2 interrupts can cause communications errors on the secondary serial channel. The QScreen Controller’s kernel software contains a complete set of high level driver routines for the Serial2 port, and these functions are summarized in the Control-C Glossary. The Control-C Glossary contains a list of functions that temporarily disable interrupts, and the glossary entries give further information regarding how long interrupts are disabled. This function cannot accept incoming data; consult its glossary entry for details. The BufferToSPI() function implements fast data transfer from a specified buffer in the controller’s memory to an SPI device. This function properly configures the directions of the SPI I/O pins, and configures the data transfer such that data is valid on the falling trailing edge of the clock, with the clock idling in the low state. If the clock idles in the high state, the leading edge of the clock is a falling edge.


댓글목록

등록된 댓글이 없습니다.