Pin 3 of PortA is the Serial2 enter, and pin four of PortA is the Serial2 output. Thus, the grasp has just one input, MISO, which is the slave’s only output. Alternatively, the secondary serial port (Serial2) is carried out using hardware pins PA3 (input) and PA4 (output), and is managed by the related interrupts IC4/OC5 and OC4, respectively. The secondary serial port is applied by a software program UART that controls two pins on PortA. To make sure that no two devices drive the network at the identical time, it is important that each slave gadget be able to disable it’s personal RS-485 information transmitter. In the commonest multi-drop RS-485 protocol, one pc is designated as a "grasp" and the remainder of the computer systems or devices on the serial bus are designated as "slaves". The remaining "inactive" slaves could actively obtain, or listen to, information on the communications line, however only one slave at a time can transmit a message. This part describes the QED-Forth routines that control the RS485 transceiver, and presents some concepts that will show useful in designing a multi-drop information change protocol. Make sure you account for these effects when designing your application.

If you're working Serial2 at 4800 baud, the remainder of your software should be able to function correctly utilizing the remaining portion of the CPU time. Because the necessities of each multi-drop application are so distinctive, it's troublesome to specify or design a software protocol that meets everyone’s wants. Consult the data sheets for any peripheral units that you are interfacing to the SPI and, if a different configuration is needed, observe the instructions under to set up the appropriate SPI information transfer protocol. The flexibleness and energy of the 68HC11’s serial peripheral interface helps high pace communication between the 68HC11 and other synchronous serial units. Override the default USART SERIAL driver if you use a USART peripheral that doesn't belong to the default chosen SD1 driver. The first serial port, Serial1, is supported by the 68HC11's on-chip hardware UART (generally called a USART), and does not require interrupts to work properly. Although the utmost commonplace baud charge of the first serial port is 19200 baud, nonstandard baud rates of over eighty Kbaud will be attained by the 68HC11's on-chip UART and the onboard RS232 driver. The utmost Serial2 communications price is 4800 baud. The utmost sustainable baud price on the secondary serial port is 4800 baud.
In fact, this system works the same because it did earlier than, however now it is utilizing the secondary serial port as an alternative of the first port -- and you didn’t even should recompile the code! We've got constructed subtle devices utilizing the QScreen Controller that function very reliably utilizing multiple interrupts in addition to the software program UART. Using the first serial port is easy. Before running the program, let’s switch to the secondary serial port. Data translation between completely different machines can be carried out with ease, and purposes that communicate through the first serial port might be debugged utilizing the secondary channel. You may also consider operating the secondary serial port at a lower baud fee to chill out the timing constraints. The QScreen Controller controls the RS485 transceiver with bit 5 of Port D of the processor. If SPIF is about, reading the acquired information or initiating a new data switch automatically clears the SPIF bit.
Most of this design work is solely reading the datasheets for the elements and following the suggestions there. For instance, at 4800 baud (bits per second), every bit lasts about 200 microseconds (µs), and if communications are full duplex (e.g., if the QScreen Controller echoes each incoming character), then there's a serial interrupt every a hundred µs or so. Thus, as a rough approximation, working at 4800 baud full duplex requires about 40 to 50% of the 6811's CPU time (that's, an average of roughly 40 to 50 µs service time each a hundred µs). Moreover, if Serial2 is working full duplex at 4800 baud, any other interrupt service routine that takes longer than 100 µs is likely to cause a problem. At the tip of a received character, the service routine takes about 45 µs. The Silence() routine searches the incoming serial characters for a pre-decided key phrase (for instance, the ascii "title" of this specific slave). A jumper, J3, configures the primary serial port for either RS232 or RS485 operation.
|
|