Lecture07-ADC_summary -...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: The
C8051
A/D
Converter
Func>on
Block
 Diagram
(C8051
manual
pg.
75)
 11
 December
31,
2009
 Lecture
#7
 11
 A/D
Conversion
SFR
Summary
 •  In
program
ini>aliza>on:
 –  Configure
analog
input
pins
–
set
desired
A/D
pins
in
P1MDOUT
to
“0”
 and
P1
to
“1”
and
PIMDIN
to
“0”
 –  Configure
Reference
–
set
internal
reference
by
clearing
REF0CN
pin
3:
 REF0CN = 0x03; –  Configure
A/D
converter
gain
–
set
to
gain
of
1:
ADC1CF |= 0x01; –  Enable
converter:
ADC1CN = 0x80; Conduct
A/D
conversion: 
 
 = bbb; //bbb: 000-111 –  Set
pin
to
convert
with
AMX1SL:
AMX1SL = X; //X: 0-7
 –  Clear
conversion
complete
bit:
ADC1CN &= ~0x20;
 –  Start
conversion:
ADC1CN |= 0x10; –  Wait
for
conversion
complete:
while((ADC1CN & 0x20) == 0x00); –  Access
results
register:
ADresult = ADC1; Lecture
#7
 22
 •  •  Read
Results:
 December
31,
2009
 The
C8051
A/D
Converter
 •  Page
56
of
manual
 •  Board
is
hardwired
to
 connect
VREF
to
 VREF1
 •  Code
must

 –  Enable
Bias
 –  Enable
REFBE
amp
 –  Set
ADC1
to
use
VREF1
 •  Note
caps
in
circuit
 –  Capacitors
take
>me
to
 charge.

Readings
will
 be
wrong
for
2ms
a_er
 enabling.

 December
31,
2009
 Lecture
#7
 ...
View Full Document

This note was uploaded on 04/08/2011 for the course ENGR 2350 taught by Professor Fukanari during the Spring '08 term at Rensselaer Polytechnic Institute.

Ask a homework question - tutors are online