11-12-06, Microprocessors Lab Manual, LAB 9, More Applications on 586 Engine 9: More Applications on 586 Engines 1. Introduction The objectives of this lab are:A- To learn how to interface the 586 engine with an AD_557 8 bits Digital to analog converter. B- To enable the student to conduct a code converters using a 7483 and 7485 chips with the 586 engine board. 2. Theory The AD557 DACPORT® is a complete voltage-output 8-bit digital-to-analog converter, including output amplifier, full microprocessor interface and precision voltage reference on a Single monolithic chip. No external components or trims are required to interface, with full accuracy, an 8-bit data bus to an analog system. The low cost and versatility of the AD557 DACPORT are the result of continued development in monolithic bipolar technologies. The complete microprocessor interface and control logic is Implemented with integrated injection logic (I2L), the internal precision voltage reference is the patented low-voltage band-gap circuit which permits full-accuracy performance on a single 5 V power supply and it gives from 0-2.55 Volt. Thin-film silicon-chromium resistors provide the stability required for guaranteed monotonic operation over the entire operating temperature range, while laser-wafer trimming of these thin-film resistors permits absolute calibration at the factory to within 2.5 LSB; thus, no user-trims for gain or offset are required. A new circuit design provides voltage settling to 1/2 LSB for a full-scale step in 800 ns. The AD557 is available in two package configurations. The AD557JN is packaged in a 16-lead plastic, 0.3"wide DIP. For surface mount applications, the AD557JP is packaged in a 20-lead JEDEC-standard PLCC. Both versions are specified over the operating temperature range of 0C to 70C. The AD557 consists of four major functional blocks fabricated on a single monolithic chip (see the appendix). The main D/A converter section uses eight equally weighted laser-trimmed current sources switched into a silicon-chromium thin-film R/2R resistor ladder network to give a direct but un buffered 0 mV to 400 mV output range. The transistors that form the DAC switches are PNPs; this allows direct positive-voltage logic interface and a zero-based output range. Also in this experiment, two important MSI circuits will be used to implement some useful operations: 4-bit adder (7483A) and 4-bit comparator (7485). TTL 4-bit active high comparator, used to compare two inputs (A, and B) and indicate whatever A>B, A<B, A=B in the output part, if A (a3a2a1a0) is greater than B (b3b2b1b0) then the pin A>B gives High, and so on. The two chips are used in the Lab. to construct a Binary (Hex) to BCD code converter. A 4-bit binary number between 0000 and 1001 (decimal 9) is the same as the BCD number. If a zero is added to these numbers, no change would occur in the result. Binary numbers from 1010 (ten) to 1111 (fifteen) can be converted to BCD by adding 0110 (six) to them. Here is a simple table illustrating the idea: 1/20 Microprocessors Lab Manual, LAB 9, More Applications on 586 Engines Table9.1: Code Conversion from Binary to BCD Comparator A>B Output 0 1 Adder Input Comment B4 0 0 B3 0 1 B2 0 1 B1 0 0 Input <10, add 0000 Input >9, add 0110 In the same manner, it could be detected hoe to convert from Binary to Excess 3. The rule is demonstrated in the following table: Table9.2: Conversion from Binary to Excess 3 Comparator A>B Output 0 1 Adder Input Comment B4 0 1 B3 0 0 B2 1 0 B1 1 1 Input <10, add 0011 Input >9, add 1001 3. Equipment Used EZ-586 Tutor from AMS that contains a 586 (5E) controller from Tern. (Note that PIO 6, 7, 8, and 9 are not working). Paradigm C/C++ Software Oscilloscope ETS-7000 Analogue and Digital trainer board. As shown below. The required IC chips are AD557, 7483, 7485, 7404, 7411, 7432 and others. 4. Procedures Part I 4.1 Conduct a free running (with out the 586 engine), DAC using the AD557, and create a table showing a 15 readings (check the appendix before your starting the connection). 4.2 Connect your connected DAC circuit to the 586 engine; select any eight bits from I/O ports, exclude 6, 7, 8, 9 pins. And load the following program 2/20 Microprocessors Lab Manual, LAB 9, More Applications on 586 Engines # # # # include include include include <string.h> <stdlib.h> <dos.h> "586.h" #define #define #define #define #define #define #define #define d0 d1 d2 d3 d4 d5 d6 d7 10 11 12 14 15 16 17 18 #define #define #define #define #define #define #define #define #define #define #define #define #define #define #define #define d0_hi d0_lo d1_hi d1_lo d2_hi d2_lo d3_hi d3_lo d4_hi d4_lo d5_hi d5_lo d6_hi d6_lo d7_hi d7_lo pio_wr(d0,1) pio_wr(d0,0) pio_wr(d1,1) pio_wr(d1,0) pio_wr(d2,1) pio_wr(d2,0) pio_wr(d3,1) pio_wr(d3,0) pio_wr(d4,1) pio_wr(d4,0) pio_wr(d5,1) pio_wr(d5,0) pio_wr(d6,1) pio_wr(d6,0) pio_wr(d7,1) pio_wr(d7,0) void pio_setup(void); void out_data(unsigned char); void main(void) { unsigned char count=0; sc_init(); pio_setup(); } while (1) { out_data(count); count ++; delay_ms(1); } void pio_setup(void) { pio_init(d0,2); pio_init(d1,2); pio_init(d2,2); pio_init(d3,2); pio_init(d4,2); pio_init(d5,2); pio_init(d6,2); pio_init(d7,2); } void out_data(unsigned char dat) { if(dat&0x08) d3_hi; else d3_lo; if(dat&0x04) d2_hi; else d2_lo; 3/20 Microprocessors Lab Manual, LAB 9, More Applications on 586 Engines } if(dat&0x02) d1_hi; else d1_lo; if(dat&0x01) d0_hi; else d0_lo; if(dat&0x80) d4_hi; else d4_lo; if(dat&0x40) d5_hi; else d5_lo; if(dat&0x20) d6_hi; else d6_lo; if(dat&0x10) d7_hi; else d7_lo; 4.3 Repeat what we did in lab 8, by developing programs to generate square, triangle, saw tooth, and sine wave. PART II 4.4 Free Running modes, A- Using MultiSIM version 9.0, to conduct a free test for the 4-bit adder using 7483 with the provided data sheet, assume that we have a counter input from 0-ff, then connect your circuit to the 586 Engine and use the above program to perform the free test. [Practically Done: --------] LAB6, EED, QU, AL-ANI 4-BITS FULL ADDER. XWG1 16 0 U5 U1 O O O X X X 12 14 3 5 A4 A3 A2 A1 11 15 2 6 B4 B3 B2 B1 7 C0 SUM_4 SUM_3 SUM_2 SUM_1 10 13 1 4 CO 2.5 V DCD_HEX C4 9 74HC283N_6V 31 15 T R Figure (9.1) a free running test for the 4-bits 7483 Full adder circuit (EWB9) 4/20 Microprocessors Lab Manual, LAB 9, More Applications on 586 Engines B- Using Proteus 6, and run a free test for the 4-bit comparator using 7485 with A (1011) and B (1111, then 0011, the 1011), then instead of using SW1 and SW2 use the 586 Engine and repeat the comparison, after developing a simple program. [Practically Done: --------] THUMBSWITCH-BCD U1 SW1 10 12 13 15 9 11 14 1 2 3 4 C 5 SW2 C 4 THUMBSWITCH-BCD A0 A1 A2 A3 B0 B1 B2 B3 A<B A=B A>B QA<B QA=B QA>B 7 6 5 D2 D3 7485 D1 U1(A=B) LED-RED LED-RED LED-RED Figure (9.2) a free running test for the comparator 7485 circuit (Using Proteus 6) 4.5- Binary to BCD converter, Connect the Binary to BCD code converter as shown below; the purpose of this circuit is to display the 4-bit binary number on a 7-segment or LEDs in decimal. The idea behind this circuit is to add 6 (0110) to the number after it goes over 9 (1001 in binary) so that the first 4-bits will start counting from zero again and a carry is to the LED. Check table 6.1 to understand the concept, and the functionality. Don’t forget to connect sum1 till sum4 to LEDs then to 7-segment, your I/O ports must connect to A1 till A3; a simple program must develop to perform the task. [Practically done: --------], see fig (9.3) 4.6- Binary to Excess 3 converter, Construct the following circuit that converts from binary to Excess 3 codes. I/O ports must connect to A1 till A3; the table shown in the theory explains the concept of converting a 4-bit unsigned binary number to Excess 3 system. [Practically done: --------], see fig (9.4) 5/20 Microprocessors Lab Manual, LAB 9, More Applications on 586 Engines Figure 9.3: Binary to BCD converter using (OrCAD 9) [ if A>B (9), then Add 6 to A, Else add 0 to A] 6/20 Microprocessors Lab Manual, LAB 9, More Applications on 586 Engines Figure (9.4) Binary to Excess 3 [ if A>B (9) the Add 9 to A, Else Add 3 to A] 7/20 Microprocessors Lab Manual, LAB 9, More Applications on 586 Engines 4.7- Range Comparison In this part of the experiment you are asked to connect the following circuit, and the LED will lit only if the inputs are between a specific range, determine the range, practically then simulate the circuit by Multisim. [Practically Done: --------] Figure (9.5) Range comparison [Led off if 12>A>9] 5- Discussion Conclude your experiment and commend the obtained results. 8/20 Microprocessors Lab Manual, LAB 9, More Applications on 586 Engines 6. Appendix Functional Description Measuring 3.6 x 2.3 x 0.3 inches, the 586-Engine (5E) is a C/C++ programmable microprocessor module based on a 100/133 MHz, 32-bit CPU (ElanSC520, AMD). Features such as its low cost, compact size, surface-mount flash, high performance floating point coprocessor, and reliability make the 5E ideal for industrial process control and applications requiring intensive mathematical computation. It is designed for embedded applications that require compactness and high reliability. The 586-Engine (5E) integrates an Am586 CPU and high performance ANSI/IEEE 754 compliant hardware floating point unit (FPU). It provides arithmetic instructions to handle various numeric data types and formats and transcendental functions for sine, cosine, tangent, logarithms, etc, useful for intensive computational applications. Special Note: The core of the Am520 CPU operates at +2.5V and the I/O operation at +3.3V. Also, the input for the I/O is +5V compatible. Stresses above these can cause permanent damage to the SC520 CPU. Operation above these values is not recommended, and can effect device reliability. Functional block diagram of the 586-Engine 9/20 Microprocessors Lab Manual, LAB 9, More Applications on 586 Engines The 586-Engine boots up from on-board 512KB ACTF Flash, and supports up to 512KB batterybacked SRAM. No SDRAM, PCI, or DMA supported. The on-board Flash has a protected boot loader and can be easily programmed in the field via serial link. Users can download a kernel into the Flash for remote debugging. With the DV and ACTF Flash Kit support, user application codes can be easily field programmed into and run out of the Flash. A real-time clock* (RTC72423) provides information on the year, month, date, hour, minute, and second, in addition to a 100-year calendar and 114 bytes of general purpose battery-backed RAM. This RAM is used by the real-time clock, as well as the ACTF to store the jump address as the pointer to the users application code. Two industry-standard UARTs support high-speed, reliable serial communication at a rate of up to 1.152 M baud via RS-232 drivers. One synchronous serial interface (SSI) supports full-duplex bidirectional communication. An optional UART SCC2691 may be added in order to have a third UART on-board. All three serial ports support 8-bit and 9-bit communication. There is one programmable interval timer (PIT) providing 3 16-bit PIT timers and 3 16-bit GP timers, and a software timer. The timers support timing or counting external events. The software timer provides a very efficient hardware time base with microsecond resolution. In addition, there are two supervisor chips that monitor for power failure, watchdog and system reset. The 586-Engine provides 32 user-programmable, multifunctional I/O pins from the CPU. Most of the PIO lines share pins with other functions. The 586E supports up to 15 external interrupts. No repair support is available for the 388 pin BGA SC520. A high-speed, up to 300K samples per second, 8-channel, 12-bit parallel ADC* (AD7852) can be installed. This ADC includes sample-and-hold and precision internal reference, and has an input range of 0-5 V. The 586-Engine also supports a 4-channel, high-speed parallel DAC* (DA7625, 02.5V). An optional 12-bit serial ADC (P2543) has 11 channels of analog inputs with sample-and-hold and a 5V reference that facilitate radiometric conversion, scaling, and isolation of analog circuitry from logic and supply noise, supporting conversion up to a sample rate of approximately 10 KHz. Up to two optional 2-channel, 12-bit serial DAC (LT1446) that provides 0-4.095V analog voltage outputs capable of sinking or sourcing 5mA is also available. Overall the 5E can support up to 8 analog outputs and 19 analog inputs. 1.2 Features Dimensions: 3.6 x 2.3 x 0.3 inches Temperature:-40°C to +80°C 133MHz, 32-bit CPU (ElanSC520, AMD), Intel 80x86 compatible Easy to program in C/C++ Power consumption: 440 mA at 5V Power input: +5V regulated DC, or + 9V to +12V unregulated DC with P100 expansion board installed* 512 KB SRAM, 512 KB, 114 byte internal RAM 8-channel 300 KHz parallel 12-bit ADC (AD7852) with 0-5V analog input* 4-channel 200 KHz parallel 12-bit DAC (DA7625) with 0-2.5V analog output* 2 channels serial 12-bit DAC (LT1446), 10 KHz * 11 channels serial 12-bit ADC (P2543), 10 KHz * high performance floating point coprocessor Up to 1GB memory expansion via MemCard-A 10/20 Microprocessors Lab Manual, LAB 9, More Applications on 586 Engines Up to 3 serial ports (2 from ElanSC520, plus one optional SCC2691 UART) support 8-bit or 9-bit asynchronous communication * 15 external interrupts with programmable priority 32 multifunctional I/O lines from ElanSC520, 1 SSI, 7 16-bit timers 114 bytes internal battery-backed RAM. Supervisor (691) for power failure, reset and watchdog Real-time clock (RTC72423), lithium coin battery* P100 I/O expansion board for regulated 5V power, RS-232/485 drivers, and TTL I/O lines optional Physical Description The physical layout of the 586-Engine is shown below Physical layout of the 586-Engine SC520 PIOs The SC520 supports 32 user-programmable I/O lines (PIO). Each of these pins can be used as a user programmable input or output signal, if the interface function is not needed. The 586-Engine PIO pins are 3.3V output and all inputs are 5V tolerant. Absolutely no voltage greater than 5V should be applied to any pins. Over 5V voltage input can cause permanent damage. After power-on/reset, PIO pins default to various configurations. The initialization routine, sc_init();, provided by TERN libraries reconfigures some of these pins as needed as: P27=/GPCS0=J2.37 for 16-bit I/O operation of on-board ADC/DAC P31=J2.38 as input for STEP2 jumper reading P0 as output for on-board LED control P1=/GPBHE=J1.11 as /BHE for 16-bit data bus high byte enable signal Other 28 PIO pins on the J2 header are free to use. PIO 2-26 and PIO 28, 29, 30 A PIO line can be 11/20 Microprocessors Lab Manual, LAB 9, More Applications on 586 Engines configured to operate as a output or an input with a weak internal pull-up or pull-down resistor. A PIO pin’s behavior, either pull-up or pull-down, is pre-determined and shown in the table below. These configurations, as well as the processor-internal peripheral usage configurations, are listed below in next Table. I/O pin default configuration after power-on or reset C function in the library 586.lib can be used to initialize and to operate PIO pins. void pio_init(char bit, char mode); Where bit = 0-31 and mode = 0 (for interface function), 1 (for input), or 2 (for output). 12/20 Microprocessors Lab Manual, LAB 9, More Applications on 586 Engines Example: pio_init(31, 2); will set P31 as output pio_init(1, 0); will set P1 as /GPBHE void pio_wr(char bit, char dat); pio_wr(31,1); set P31 pin high and the LED is off, if P31 is in output mode pio_wr(31,0); set P31 pin low and the LED is on, if P31 is in output mode unsigned int pio_rd(char port); pio_rd (0); return 16-bit status of P0-P15, if corresponding pin is in input mode, pio_rd (1); return 16-bit status of P16-P31, if corresponding pin is in input mode, Some of the I/O lines are used by the 586-Engine system for on-board components (Table 3.2). We suggest that you not use these lines unless you are sure that you are not interfering with the operation of such components (i.e., if the component is not installed). 13/20 Microprocessors Lab Manual, LAB 9, More Applications on 586 Engines 14/20 Microprocessors Lab Manual, LAB 9, More Applications on 586 Engines 8. Appendix (IC Used) This week we are having a hands-on experience hooking up chips. You will be given a couple chips and will need to determine which logic function each chip performs. On standard chip packages, there is a "notch" or a "cut-out" on one side of the chip; you can think of this are being the "top" of the chip. To the left of the notch is pin 1, and counterclockwise, to the right is pin 14. The rest of the pins are labeled as shown here. Notice they increase going down the left side, and then continue coming up the right side (counterclockwise). Place the chip on your breadboard straddling the middle divider. In order to be able to use these chips, you will need to provide power, Vcc with a typical value of 5V; you should therefore set your power supply to 5V. Typical with most 74xxx series chips, you will need to connect power to pin 14 on the chip, and connect pin 7 to ground. This is what provides power to the chip. (For some chips that have 16 pins, connect power to pin 16 and ground to pin 8). The chip is now ready for testing. * Each chip we will be using contains 4 logic gates on each chip. They are all the same, meaning for example that it has 4 OR gates on it, or 4 AND gates, or any of the other gates you have encountered so far. Your job is to determine which logic gate that each "Mystery Chip" has on-board. REMEMBER: SAFETY FIRST! TURN OFF POWER BEFORE CHANGING ANYTHING ON YOUR CIRCUIT!! CAREFULLY CHECK THE INPUT/OUTPUT CONNECTIONS!!! Here we have some chips 7486 (XOR), 7408 (AND), 7432 (OR), 7400 (NAND), and 7402 (NOR) (see following chip symbol images). Therefore, on each chip, there are FOUR logic gates. For example, for 7432, 1Y (pin 3) =1A (pin1)+1B (pin2), 2Y (pin6) = 2A (pin4)+2B(pin5), 3Y(pin8)= 3A (pin9)+ 3B (pin10), and 4Y(pin11) = 4A(pin12)+ 4B(pin13). "VCC" is connected to the power supply (5V) and "GND" to the ground. Y is considered the output and A, B are the inputs. 15/20 Microprocessors Lab Manual, LAB 9, More Applications on 586 Engines *74-series IC data sheet can be found in many sites, check these for example, http://rabbit.eng.miami.edu/info/datasheets/ http://www.datasheetcatalog.com/ 16/20 Microprocessors Lab Manual, LAB 9, More Applications on 586 Engines 17/20 Microprocessors Lab Manual, LAB 9, More Applications on 586 Engines 18/20 Microprocessors Lab Manual, LAB 9, More Applications on 586 Engines 19/20 Microprocessors Lab Manual, LAB 9, More Applications on 586 Engines 20/20