Vous êtes sur la page 1sur 20

EXPERIMENT

Objective: Reading the output of A/D converter and observing the response of D/A converter

Theory:

A/D converter:
Analog to digital converter converts an analog signal into weighted binary voltage signals.
ADC0804 is installed on the base board which is an 8-bit A/D converter and works on TTL
standards. Following figure shows the complete working block diagram of ADC0804.
ADC0804 is a multi-feature device and can be operated in free running mode where it just converts
the in coming signal into digital form sends it to its output data bus or it can be interfaced with
microprocessor based devices through its four control lines, which are:

- CS - RD - WR -INTR

On the high-to-low transition of the WR input, the internal SAR latches and the shift-register stages
are reset, and the INTR output will be set high. As long as the CS input and WR input remain low,
the A/D will remain in a reset state. Conversion will start from 1 to 8 clock periods after at least
one of these inputs makes a low-to- high transition. After the requisite number of clock pulses to
complete the conversion, the INTR pin will make a high-to-low transition. This can be used to
interrupt a processor, or otherwise signal the availability of a new conversion. A RD operation
(with CS low) will clear the INTR line high again.

Following timing diagram shows how to command ADC to start conversion:

Next timing diagram shows how to read the data from ADC which shows timing details after the
INTR pin has generated an interrupt signal by getting low in upper diagram.
After this procedure INTR will automatically set high to “1”.

For timing units refer to device datasheet and also to run ADC in free running mode i.e. without
microprocessor/microcontroller, refer to device datasheet.

D/A converter:
DAC0800 used in this board is a dual supply 8-bit DAC which converts eight binary weighted
voltage signals into a single analog voltage signal. DAC by default gives analog voltage at output
with full scale of -10V to +10V which gas been passed through passive summer then an op-amp
with adjustable gain and offset to lemmatize the output voltage in positive scale. Following figure
shows the typical DAC circuit given in device datasheet and has been implemented on the board.

Hardware setup:
To setup the hardware for A/D converter refer to following schematic.
 Connect “Analog Source” to “Analog IN” for analog input to ADC.
 Set 2.5V on Vref/2 test point by varying V ref/2 variable.
 Connect J12, Digital out of ADC to Port B/1 of microcontroller.
 Connect J13, control pins of ADC to Port C/2 of microcontroller.
 Connect J8, LED’s to Port A/0 of microcontroller.

Code:
Hardware setup:
To setup the hardware for D/A converter refer to following schematic.

Initial Calibration
 Connect switches port J9 to DAC data port J14.
 Position the switches at 00000000 and measure the o/p voltage at Analog O/P.
 Position the switches at 11111111 and again measure the o/p voltage at Analog O/P.
 Position the switches at 00000001 and again measure the o/p voltage at Analog O/P.
 We have noted the DAC output at maximum, minimum and center values.
 Now adjust the switches, so we get 01H and note the voltage value of DAC.
 Similarly tabulate the voltage value of DAC for different binary values as shown in Table.
TABLE
Hex DAC Output
Value
00
01
02
03
04
05
06
07
08
0A
0B
0C
0D
0E
0F
EXPERIMENT 6

Objective: Data exchange between computer and microcontroller through USB – UART
interface
In normal desktop computers serial port communicates on RS-232 protocols in which voltage
levels for “binary 1” and “binary 0” are different from TTL standards.

Logic TTL standard RS-232 standard


0 0V +12V
1 +5 V -12V

To make a communication channel between computer and microcontroller an interface circuitry is


required which converts TTL standard signal to RS-232 standard and vice versa. Many IC based
solutions are available in market. MAX-232 IC is implemented on the trainer board which is
commonly available in market and it’s a very cost effective solution.

RS-232 port is not installed in current PC / Laptops available in the market. Still RS-232 protocol
is used in many applications. Devices also support this interface. In order to circumvent this issue
USB – UART converters are available. These devices create a virtual COM port on PC and provide
standard Tx / Rx signal for communication with any standard serial device.

Keeping in view the current trend, a USB – UART device is included in this training system as
shown in figure below:
USB – UART Driver Installation:
1. Connect USB – UART interface and PC using USB cable.
2. Driver Installation Wizard will appear. Select Yes, this time only radio button and click next.
3. Select the option as shown in Fig. 6.1 and click Next

Fig. 6.1

4. Select the folder \USB_DRIVER located in Software CD, as shown in Fig. 6.2
Fig. 6.2

5. After installing drivers for USB Device, the wizard will ask for USB Serial Converter Drivers
as shown in Fig. 6.3

Fig. 6.3
6. Select the option shown in Fig. 8.3 and Click Next. If the Wizard is unable to locate the
required driver file, then provide the same path as given in Step 4.
7. After successful installation, verify the Virtual COM port created using Device Manager as
shown in Fig. 6.4
Fig. 6.4

8. This COM port number may vary from PC to PC as the driver automatically selects the
available COM port.

Hardware setup:
 Connect TTL-Tx pin on main board with RXD pin on 8051 daughter card.
 Connect TTL-Rx pin on main board with TXD pin on 8051 daughter card.
 Connect Port A/0 with LEDs.
On computer make a hyper terminal connection to exchange data from microcontroller.

Use the procedure as follows to make a new connection in hyper terminal.

First open the hyper terminal as in above figure. After clicking on Hyper terminal in above figure
following screen appears on your computer. Write the name of connection and press “OK”.
After pressing “OK” following screen appears in which COM Port has to be selected. Select the
COM installed as shown in Fig. 6.4. Select the COM port that is installed on your computer. This
COM port will also appear in hyper terminal drop down list.

After selecting the com port following screen appears in which setting has to be done according to
the figure below. Setting should be 4800-8-N-1
Press “Apply” button then press “Ok”. After that main window appears on the screen, and port
becomes connected, now press “properties” button on tool bar in main window.

Code:
Conclusion:
EXPERIMENT

Objective: Interfacing EEPROM at I2C protocols

I2C (Inter Integrated Circuit) is one of the most widely used serial communication protocol. It uses
only tow wires one for data transfer (bi- directional) and other, is for clocking.

EEPROMS in market are available with various types of interface, both parallel and serial but I2C
is one of the most significant and widely used protocols due to its hardware simplicity. Atmel has
a wide series of I2C EEPROMs which is 24Cxx.

In trainer board, 2 EEPROMs, 24C64 are available with common data (SDA) and clock (SCL)
lines and their address can be configured by jumpers available in the I2C section.

Following figures shows the I2C protocols in interfacing the EEPROM 24C64.

Stop and Start signals

Start Signal: SCL is kept high and SDA is given a high to low transition
Stop Signal: SCL is kept high and SDA is given a low to high transition
Device Address

1 0 1 0 A2 A1 A0 R/W
MSB LSB

Device address: A2, A1 and A0 give the device address of the device. Since there are bits
therefore, maximum eight devices can be connected to same data and clock lines.
Two devices on the same data (SDA) and clock (SCL) lines cannot have same addresses.

Output Acknowledge

Acknowledgement: EEPROM gives an acknowledgement signal after each byte transfer. It can be
read on SDA line at 9th clock pulse on SCL line after start signal (after start signal 8 clock pulses
are use to transfer a byte). If EEPROM successfully gets a byte it makes SDA line “0” on 9th clock
pulse to acknowledge a successful transfer otherwise it becomes hi-Z.
Write Sequence

Byte Write

Page Write

Read Sequence

Current Address Read


Random Read

Sequential Read

Note: In transferring the byte MSB is transferred 1st and LSB is last. Similarly in reading the data
byte MSB is read 1st and LSB is last.
Hardware setup:

 Connect SCL pin on MCU Add-On module with SCL pin in I2C EEPROM section with
2mm patch cord.
 Connect SDA pin on MCU Add-On module with SDA pin in I2C EEPROM section with
2mm patch cord.
 In I2c EEPROM interface section, set the jumper position carefully as following:
 Jumpers WP, A2 in EEPROM#1 are connected to GND.
Jumper A2 in EEPROM#2 is connected to 5V.
 Connect Port 2 with LEDs.

Code:
Result:

Vous aimerez peut-être aussi