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. If you are running Serial2 at 4800 baud, the rest of your application must be able to function properly using the remaining portion of the CPU time. In fact, you have been using it all along as you worked through the examples in this document. 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. We can gain insight into the operation of the RS232 protocol by examining the signal connections used for the primary serial port in Table 9 6. The transmit and receive data signals carry the messages being communicated between the QScreen Controller and the PC or terminal. RS232’s greatest benefit is its universality; practically all personal computers can use this protocol to send and receive serial data. Converters between RS-485 and RS-232 are available to allow a personal computer to communicate with remote devices.
If your computer does not have an RS-232 serial port, low cost USB-to-RS-232 serial cables are available; contact Mosaic Industries for details. This function cannot accept incoming data; consult its glossary entry for details. 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. Moreover, if Serial2 is running full duplex at 4800 baud, any other interrupt service routine that takes longer than 100 µs is likely to cause a problem. 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. If the 68HC11 is initialized as a master by setting the MSTR bit, then bit 5 of the Port D data direction register (PORTD.DIRECTION) determines whether /SS is an input or an output. A mode fault occurs when the SPI senses that a multimaster conflict (MC68HC11F1 Technical Data Manual, p.8-7) exists on the network as explained above in connection with the /SS input.
Another major advantage is that there can be more than one slave in the connection. The primary serial channel can operate at standard speeds up to 19200 baud and can be configured for either RS232 (the default) or RS485 operation. The pinout of the QScreen’s Serial Header (H5), QScreen’s Field Header (H3), and the Serial Connectors are shown in the following tables. There are surface mount resistor pads on the QScreen that will allow you to bring out the secondary serial port to the Field Header on pins 5-6 or 7-8 as shown with the parentheses in Table 11-3. Pads are also available to bring out the RS485 signals to the DB9 Serial 1 Connector. In this case, cable connections must be made to Serial 1 at pins 5 and 6 of the 10-pin Serial Header or pins 7 and 8 on the 24-pin Field Header. The primary and secondary serial communications ports are accessible through the QScreen's 10 pin, dual row Serial Header (H5) which is typically not installed, the 24 pin, dual row Field Header (H3), and through the individual DB-9 Serial 1 and Serial 2 connectors.
The Serial 2 port is dedicated to RS232 communications at up to 4800 baud. Before running the program, let’s switch to the secondary serial port. Let’s do a quick experiment to see how easy it is. The default serial routines used by the onboard kernel assume that full duplex communications are available, what is rs485 cable so you cannot use the RS485 protocol to program the controller. RS232 allows both communicating parties to transmit and receive data at the same time; this is referred to as full duplex communications. Serial 2 is implemented by a software UART in the controller’s QED-Forth Kernel that uses two of the processor’s PortA I/O pins to generate a serial communications channel. The secondary serial port is implemented by a software UART that controls two pins on PortA. It controls the serial-to-parallel and parallel-to-serial conversion and performs all of the timing functions necessary for asynchronous serial communications. Communications capability is essential for many instrument control applications. Although many applications use RS-485 signal levels, the speed, format, and protocol of the data transmission are not specified by RS-485. RS485 is another protocol supported by the primary serial port on the QScreen Controller. Table 9-6 shows the connection diagram for a standard 9-pin serial cable.
댓글 달기 WYSIWYG 사용