Unformatted text preview: ber and the output would be the seven-segment code for the binary bit pattern. First, the 4-bit binary nibble is converted to one of 16 outputs. These outputs then select the appropriate seven-segment code. Finally, these outputs are passed to a seven-segment display. Load and run the VI Display7.vi, which emulates this operation. Fundamentals of Digital Electronics 10-4 National Instruments Corporation Lab 10 Seven-Segment Digital Displays Figure 10-8. Binary-to-Seven-Segment Front Panel LabVIEW Challenge
Design a two-digit counter that counts from 0 to 99. Use the 8-bit binary counter from Lab 6 modified to count in decimal. Lab 10 Library VIs (Listed in the Order Presented) 7Segment.vi (LabVIEW simulation of a seven-segment display) Bin->Digit.vi (4-bit digital-to-analog converter) Encoder Hex.vi (seven-segment display, hexadecimal version) Display7.vi (hexadecimal encoded binary-to-seven-segment display) National Instruments Corporation 10-5 Fundamentals of Digital Electronics Lab 10 Seven-Segment Digital Displays Notes Fundamentals of Digital Electronics 10-6 National Instruments Corporation Lab 11 Serial Communications
Many instruments, controllers, and computers are equipped with a serial interface. The ability to communicate to these devices over a serial interface opens a whole new world of measurement and control. The standard bit serial format, RS-232, defines the bit order and waveform shape in both time and amplitude. At a minimum, only three communication lines are needed for communication between a computer and an external device: transmit, receive, and a reference ground.
Transmit Line Receive Line Ground Line
Figure 11-1. Serial Communication Lines In serial communications, a high level is called a Mark state, while the low level is called the Space state. In normal operation, the output line is in a high state, often denoted as a 1, or in LabVIEW as a Boolean True. The transmitter signals the receiver that it is about to send data by pulling the transmit line low to the space state (0). This falling edge or negative transition is the signal for the receiver to get ready for incoming data. In RS-232 communication, all data bits are sent and held for a constant period of time. This timing period is the reciprocal of the Baud rate, the frequency of data transmission measured in bits per second. For example, a 300 Baud data rate has a timing period of 1/300 of a second or 3.33 ms. At the start of each timing period, the output line is pulled high or low and then held in that state for the timing period. Together, these transitions and levels form a serial waveform. Consider an 8-bit data byte $3A (or in binary, (0011 1010)). For serial communication, the protocol demands that the least significant bit, b0, be transmitted first and the most significant bit, b7, last. By convention, time is represented as moving from left to right, hence the above data byte would be transmitted as (01011100), in reverse order. National Instruments Corporation 11-1 Fundamentals of Digital Electronics Lab 11 Serial Communications 8-bit data $3A b0 b7 0 1 0 1 1 1 0 0 Figure 11-2. Serial Transmitter Sends the LSB (b0) First The protocol also requires that the data byte be framed by two special bits, the start bit (Space state) and the Stop bit (Mark state).
Start 0 bit
b0 b7 0 1 0 1 1 1 0 0 data byte $3A Stop 1 bit Figure 11-3. Handshaking Bits Start and Stop Frame the Data Byte The addition of these framing bits requires 10 timing periods to send one data byte. If each byte represents one ASCII character, 10 serial bits are sent for each character. For example, a 9600 Baud modem is capable of sending 960 characters per second. In terms of a timing diagram, the RS-232 serial waveform for the $3A data byte looks like the following.
b0 b7 Start 0 0 1 0 1 1 1 0 0 1 Stop Figure 11-4. Serial Waveform for a $3A Data Byte Serial Transmitter
In LabVIEW, a serial transmitter can be designed using a 10-bit shift register and a delay loop that simulates the Baud rate. Launch the VI Serial.vi. Figure 11-5. LabVIEW Simulation of a Serial Transmitter On the front panel, you can load the date byte into the shift register by operating the eight input switches. Note that the bit order in hexadecimal places the most significant bit on the left. Hence, $33 is entered as (0011 0011). However, the data comes out in the reverse order, with the least Fundamentals of Digital Electronics 11-2 National Instruments Corporation Lab 11 Serial Communications significant bit first. The serial output is displayed on the large square LED indicator. Initially, it is in the Mark state. All data bits and framing bits are shown as zeros before execution. As soon as the run button is pressed, $33 is loaded into the shift register, the stop bit becomes a 1, and the start bit becomes a 0. The output bit immediately falls to the off state, signaling the start of transmission. After a delay (1/Baud Rate), the next bit is output. The diagram panel displays the transmitter algorithm. Figure 11-6....
View Full Document
- Spring '09