교육콘텐츠 When the QScreen Controls the Network
페이지 정보
본문
RS-485 supports inexpensive local networks and multidrop communications links, using the same differential signaling over twisted pair as RS-422. In fact, the program works the same as it did before, but now it is using the secondary serial port instead of the primary port -- and you didn’t even have to recompile the code! In fact, rs485 cable you have been using it all along as you worked through the examples in this document. Data translation between different machines can be performed with ease, and applications that communicate via the primary serial port can be debugged using the secondary channel. 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. For example, at 4800 baud (bits per second), each bit lasts about 200 microseconds (µs), and if communications are full duplex (e.g., if the QScreen Controller echoes each incoming character), then there is a serial interrupt every 100 µs or so.
Thus, as a rough approximation, operating at 4800 baud full duplex requires about 40 to 50% of the 6811's CPU time (that is, an average of approximately 40 to 50 µs service time every 100 µs). 1200 is the baud rate that you choose; you can specify any standard baud rate up to 4800 baud. If A is negative with respect to B, the state is binary 1. The reversed polarity (A positive with respect to B) is binary 0. The standard does not assign any logic function to the two states. The terminal’s serial receiver chip re-inverts the signal to its positive sense. The RS232 protocol specifies the use of two separate grounds, a signal ground and a protective (or "chassis") ground. If your application requires RS485, use the primary serial port (serial1) for RS485 communications, and use the secondary serial port (Serial 2) to program and debug your application code using the RS232 protocol.
We’ll use code from the GETSTART.C program. The default serial routines used by the onboard kernel assume that full duplex communications are available, so you cannot use the RS485 protocol to program the controller. If you have not yet compiled the GETSTART program and you want to do the exercises here, open GETSTART.C in your TextPad editor, click on the Make Tool, and after the compilation is done, enter Mosaic Terminal by clicking on the terminal icon and use the "Send File" menu item to send GETSTART.DLF to the QScreen Controller. If you do this now, remember to move the QScreen Controller’s serial connector back to Serial Port 1, and to change the terminal’s baud rate back to 19200 baud using the "Comm" item under the terminal’s "Settings" menu. Now select the "Comm" item in the "Settings" menu of the Terminal program, and click on 1200 baud (or whatever baud rate you selected in the command above).
If you have already downloaded the program, you are ready to go. Before running the program, let’s switch to the secondary serial port. Let’s do a quick experiment to see how easy it is. There are three flag bits implemented in the SPSR (SPI status register). The SPIF is set when a data transfer is complete, and is cleared by a read of the SPSR status register, followed by a read or write to the SPDR data register. A data transfer is initiated by a master device when it stores a message byte into its SPDR register. Given a properly wired network and a properly configured SPCR control register, a master device may transmit a message by simply storing the byte to the SPDR data register. These signals may alternatively be redirected to the digital inputs and outputs used by the second serial port if hardware handshaking is required. Its simplest implementation requires only three wires: one to transmit serial data, a second to receive serial data, and a third to provide a common ground reference. In summary, the code provided for implementing the second serial port is very flexible and can be used to support dual concurrent communications ports.
- 이전글Ten Things Everybody Is Uncertain About The Word "Assessment In Mental Health." 24.06.06
- 다음글Cars Locksmiths Tools To Make Your Everyday Lifethe Only Cars Locksmiths Trick That Every Person Must Learn 24.06.06
댓글목록
등록된 댓글이 없습니다.