interfacing the ads1210 converter with an atmega8535 microcontroller author: eng. magnelli luca

22
INTERFACING THE ADS1210 CONVERTER INTERFACING THE ADS1210 CONVERTER WITH AN ATmega8535 WITH AN ATmega8535 MICROCONTROLLER MICROCONTROLLER Author: Eng. Magnelli Luca

Upload: arabella-harrington

Post on 17-Jan-2016

226 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: INTERFACING THE ADS1210 CONVERTER WITH AN ATmega8535 MICROCONTROLLER Author: Eng. Magnelli Luca

INTERFACING THE ADS1210 INTERFACING THE ADS1210 CONVERTER WITH AN ATmega8535 CONVERTER WITH AN ATmega8535 MICROCONTROLLERMICROCONTROLLERAuthor: Eng. Magnelli Luca

Page 2: INTERFACING THE ADS1210 CONVERTER WITH AN ATmega8535 MICROCONTROLLER Author: Eng. Magnelli Luca

Index Project Objectives ADS1210: 24-bit ADC - Hardware Connections – Three Wire AVR Assembler Program Flowchart

Main Body Interrupt Data_Ready

Results RESET sequence – timing Serial interface – timing Conclusions

Page 3: INTERFACING THE ADS1210 CONVERTER WITH AN ATmega8535 MICROCONTROLLER Author: Eng. Magnelli Luca

Project Objectives Serial sinchronous interface

between ADS1210 and ATmega8535 Based on ADC serial interface timing Useful for sending commands and data

receiving Commmands transmission to ADC

from keyboard PC – ATmega8535 interface: USART

Send the converted data to the screen in Volts

Page 4: INTERFACING THE ADS1210 CONVERTER WITH AN ATmega8535 MICROCONTROLLER Author: Eng. Magnelli Luca

ADS1210: 24-bit ADC - Effective Resolution: 23-bits@10Hz e 20-

bits@1kHz On chip self-calibration Internal/External Reference (VREF) Programmable Gain Amplifier (PGA) Turbo Mode (TMR, aumenta fSAMP)

Digital filter programmabile

Decimation Ratio (DR) può variare tra 19 e 8191

High Resolution

Measurement application, strumentazione, pressure and temperature transducers, industrial process control

INSAMP

X •TMR•PGAf = max= 312kHz

512

INDATA

X •TMRf = max= 15kHz

512 DR+1

Page 5: INTERFACING THE ADS1210 CONVERTER WITH AN ATmega8535 MICROCONTROLLER Author: Eng. Magnelli Luca

ADS1210: 24-bit ADC - Internal MicroController

Registers: INSR, CMR, DOR, Calibration Serial Interface (Master/Slave MODE)

Page 6: INTERFACING THE ADS1210 CONVERTER WITH AN ATmega8535 MICROCONTROLLER Author: Eng. Magnelli Luca

Hardware Connections – Three Wire Digital Supply: VTG (5V) e GND – STK500

Analog Supply: AREF (5V) e GND – ATmega8535

XIN=3.6864MHz – STK500 ADS1210 in Slave MODE Serial Interface ATmega8535 – ADS1210

SDIO<->PB5, SCLK <-PB7, -> PD2 (INT0)

Serial Interface ATmega8535 – PC PD0 (RXD)<->RXD (RS232 SPARE – STK500) PD1 (TXD)<->TXD (RS232 SPARE – STK500)

DRDY

Page 7: INTERFACING THE ADS1210 CONVERTER WITH AN ATmega8535 MICROCONTROLLER Author: Eng. Magnelli Luca

Hardware Connections – Three Wire

SW5

DGND

SW0

RXD

AGND

SW1

AGND SW6

VTG(IN)

DGND

LED6

SW2

SW7

RS232 SPARE

R2

10kLED3

AREF(IN)

AGND

SW3

VTG(IN)

DGND

LED1

UNIPOLAR INPUT

LED7

ADS1210P

1

2

4

11

12

13

17

18

6

14

15

5

7

8

3

9

16

10

AIN+

AIN-

VBIAS

SCLK

SDIO

SDOUT

REFOUT

REFIN

DSYNC

DRDY

MODE

CS

XIN

XOUT

AGND

DGND

AVDD

DVDDVTG(IN)

AREF(OUT)

SW4

LED4

ATmega8535

RESET

XTAL2XTAL1

AGNDAREF

DGNDVCC

PC7/TOSC2PC6/TOSC1

PC5PC4PC3PC2

PC1/SDAPC0/SCL

PD0/RXDPD1/TXDPD2/INT0PD3/INT1PD4/OC1BPD5/OC1APD6/ICP1 PD7/OC2

PB0/T0/XCKPB1/T1PB2/AIN0/INT2PB3/AIN1/OC0PB4/SSPB5/MOSIPB6/MISOPB7/SCK

PA0/AD0PA1/AD1PA2/AD2PA3/AD3PA4/AD4PA5/AD5PA6/AD6PA7/AD7

AVCC

TXD

LED2

LED0DGND

C1

0.1uF

LED5

Page 8: INTERFACING THE ADS1210 CONVERTER WITH AN ATmega8535 MICROCONTROLLER Author: Eng. Magnelli Luca

Set Up

Write CMR3:0 onADS1210

Enable Data_ReadyInterrupt on

falling edge of DRDY

Has been receiveda character in UDR

via USART?

N

Receive new configurationvia USART and send it

to ADS1210

Y

Main body

Page 9: INTERFACING THE ADS1210 CONVERTER WITH AN ATmega8535 MICROCONTROLLER Author: Eng. Magnelli Luca

Interrupt Data_Ready

ReadDOR2:0 from

ADS1210

Load counters100_10-1_10-2_10-3_10-4_10-5_10-6

with values converted in Volts

Transmit the value converted in Volts to PC via USART

Exit from interrupt

DRDY Falling edge(external interrupt 0 enabled)

Page 10: INTERFACING THE ADS1210 CONVERTER WITH AN ATmega8535 MICROCONTROLLER Author: Eng. Magnelli Luca

Set Up Load SRAM

Comparison values for VFS=5, 2.5, 1.25V Counters for binary data conversion tIN cycles for the RESET sequence

Transmit RESET sequence on SCLK Initializing USART

Baud rate=115.2kbps, 8-bit data, 2 stop bits Enable External Interrupt 0 for Data Ready

Interrupt on falling edge of INT0 Load initial values on INSR e CMR3:0

Bias off, REFout, 2’s complement, Bipolar bit, MSByte ed MSB first, Normal mode, Gain=1, TMR=16, Decimation Ratio=8191

fSAMP=115.3kHz e fDATA=14.1Hz @ XIN=3.69MHz

Page 11: INTERFACING THE ADS1210 CONVERTER WITH AN ATmega8535 MICROCONTROLLER Author: Eng. Magnelli Luca

Write CMR3:0 on ADS1210

ATmega8535 generates 8 serial clock and

transmit INSR via SDIO

ADS1210 is inSleep Mode?

DRDYFalling edge?

NN

Y

Y

ATmega8535 generates32 serial clock and

transmits CMR3:0 via SDIO

ADS1210 takesDRDY HIGH

Enable Data_ReadyEnable Data_ReadyInterrupt on Interrupt on

falling edge of DRDYfalling edge of DRDYin Main Body

orTransmit to PC via Transmit to PC via USART: Line Feed USART: Line Feed

and Carriage Returnand Carriage ReturnIn: Receive new configuration

via USART and send itto ADS1210 (1)

Page 12: INTERFACING THE ADS1210 CONVERTER WITH AN ATmega8535 MICROCONTROLLER Author: Eng. Magnelli Luca

Receive new configuration via USART and send it to ADS1210 (1)

Disable ExternalInterrupt 0

N

First is ‘m’? Second is ‘0’? Second is ‘1’? Second is ‘6’?N N

N

Y

YY

Normal Mode Self Calibr. Sleep Mode

YYY

Has been received a new character in UDR

via USART?

First is ‘g’? Second is ‘1’? Second is ‘2’? Second is ‘3’?N NY

Gain=1 Gain=2 Gain=4

YYY

First is ‘t’? Second is ‘1’? Second is ‘2’? Second is ‘3’?N NY

TMR=16 TMR=8 TMR=4

YYY

N

N

N

N

N

Page 13: INTERFACING THE ADS1210 CONVERTER WITH AN ATmega8535 MICROCONTROLLER Author: Eng. Magnelli Luca

Receive new configuration via USART and send it to ADS1210 (2)

First is ‘d’?

II is 2?

II is 3?

II is 4?

II is 5?

II is 6?

II is 1?DR=1FFF

SI

N

DR=17F9

DR=0FF5

DR=03E9

DR=01FF

DR=0013

Y

Y

Y

Y

Y

Y

N

N

N

N

N

Write CMR3:0 onADS1210

Transmit to PC via USART: Line Feed

and Carriage Return

Save CMR2

Enable ExternalInterrupt 0

Has been receivedHas been receiveda character in UDR a character in UDR

via USART? via USART? In: Main Body

N

Page 14: INTERFACING THE ADS1210 CONVERTER WITH AN ATmega8535 MICROCONTROLLER Author: Eng. Magnelli Luca

Read DOR2:0 from ADS1210

ATmega8535 generates 8 serial clock and

transmit INSR via SDIO

ATmega8535 generates24 serial clock and

receives CMR3:0 via SDIO

SDIO becomes output

Load countersLoad counters101000_10_10-1-1_10_10-2-2_10_10-3-3

_10_10-4-4_10_10-5-5_10_10-6-6

with values converted with values converted in Volts in Volts

in: Interrupt Data_Ready

Page 15: INTERFACING THE ADS1210 CONVERTER WITH AN ATmega8535 MICROCONTROLLER Author: Eng. Magnelli Luca

Load counters 100_10-1_10-2_10-3_10-4_10-5_10-6 with values converted in Volts (1)

Set to zero counters100_10-1_10-2_10-3_10-4_10-5_10-6

Gain=1?

Gain=2?

Load in ZL the SRAM location ofLSByte comparison binary code of

1V with VFS=5V

Load in ZL the SRAM location ofLSByte comparison binary code of

1V with VFS=2.5V

Load in ZL the SRAM location ofLSByte comparison binary code of

1V with VFS=1.25V Load in XL the SRAM locationof counter 100

N

N

Y

Y

Page 16: INTERFACING THE ADS1210 CONVERTER WITH AN ATmega8535 MICROCONTROLLER Author: Eng. Magnelli Luca

Load counters 100_10-1_10-2_10-3_10-4_10-5_10-6 with values converted in Volts (2)

The number in DOR0:2 (24bit) islower than the comparison code?

Increase the counter value

Subtract to DOR0:2the comparison code

Increase XL

XL point at the SRAM locationnext to counter 10-6?

Load in ZL the SRAM location ofLSByte comparison code equals to

the previous/10

Y

N

N

Y

Transmit the valueTransmit the valueconverted in Volts toconverted in Volts to

PC via USARTPC via USARTin: InterruptData_Ready

Page 17: INTERFACING THE ADS1210 CONVERTER WITH AN ATmega8535 MICROCONTROLLER Author: Eng. Magnelli Luca

Transmit the value converted in Volts to PC via USART (1)Load in ZL the SRAM location

of the counter 100

Counter=9?

Counter=8?

Counter=7?

Counter=6?

Counter=5?

Counter=4?

Counter=3?

Counter=2?

Counter=1?

temp register<=9 ASCII

temp register<=8 ASCII

temp register<=7 ASCII

temp register<=6 ASCII

temp register<=5 ASCII

temp register<=4 ASCII

temp register<=3 ASCII

temp register<=2 ASCII

temp register<=1 ASCII

temp register<=0 ASCII

Send temp register to PC via USART

Has been sentcounter 100?

Send to PC via USART: . ASCII

NO

SI

N

N

N

N

N

N

N

N

N

Y

Y

Y

Y

Y

Y

Y

Y

Y

Increase ZL

ZL point at theSRAM location next to

counter 10-6?

NO

SI

Page 18: INTERFACING THE ADS1210 CONVERTER WITH AN ATmega8535 MICROCONTROLLER Author: Eng. Magnelli Luca

Transmit the value converted in Volts to PC via USART (2)

Send to PC via USART: space and V

ASCII

Send to PC via USART: Line feed

and Carriage Return

Exit from interruptExit from interruptin: Interrupt Data_Ready

Page 19: INTERFACING THE ADS1210 CONVERTER WITH AN ATmega8535 MICROCONTROLLER Author: Eng. Magnelli Luca

RESET sequence – timing ADS1210 RESET

Sequence on PB7->SCLK t1=82.4µs =304 tIN (>256 e <400 tIN)

t2=3.78µs =14 tIN (>5.5 tIN)

t3=163µs =601 tIN (>512 e <900 tIN)

t4=286µs =1055 tIN (>1024 e <1200 tIN)

Page 20: INTERFACING THE ADS1210 CONVERTER WITH AN ATmega8535 MICROCONTROLLER Author: Eng. Magnelli Luca

Serial interface – timing ADS1210 Receives

fSCLK=227.3kHz =XIN/16 t38=6.36µs =23tIN (>5.5tIN) t19=3.8µs =14tIN (>5.5tIN) t20=1.42µs =5tIN (>4tIN)

ADS1210 Transmits fSCLK=263.2kHz =XIN/14 t38=7.1µs =26tIN (>5.5tIN) t19=6.7µs =25tIN (>5.5tIN) t20=2µs =7tIN (>4tIN)

Page 21: INTERFACING THE ADS1210 CONVERTER WITH AN ATmega8535 MICROCONTROLLER Author: Eng. Magnelli Luca

Conclusions ADS1210 offers:

High Resolution Good flexibility … but low conversion speed

ATmega8535 after received 24-bits data has the time for: Execute arithmetic operations for data

conversion in Volts Transmit data converted to PC

From the keyboard is possible to send 15 different instructions exploit the majority converter functions

Page 22: INTERFACING THE ADS1210 CONVERTER WITH AN ATmega8535 MICROCONTROLLER Author: Eng. Magnelli Luca

INSTRUCTION SET SUMMARY

Instruction code Descriptionm0 Normal Modem1 Self Calibration Modem6 Sleep Modeg1 PGA=1g2 PGA=2g3 PGA=4t1 TMR=16t2 TMR=8t3 TMR=4d1 Decimation Ratio=0x1FFFd2 Decimation Ratio=0x17F9d3 Decimation Ratio=0x03E9d4 Decimation Ratio=0x1FFFd5 Decimation Ratio=0x01FFd6 Decimation Ratio=0x0013