Beruflich Dokumente
Kultur Dokumente
Figure 1 shows the interaction between the 68HC11 and the LM3911 sensor.
Procedure was to test the LM6911 and record data off of the temperature reading of
an ice bath that is gradually heated.
Then on the input of the terminal tell the 68HC11 to read and display the temp and
the corresponding LED number for the given temp as well.
LM3911
would
10
Thermomitor
12
14
16
18
68HC11
For the
Testing, we had a
bath of ice water inside for the water bath heater. To allow for consistent results we
also included a mercury thermometer. I took readings from the lowest point we
Conclusion
This report shows how the 68HC11 hardware and software combined with the
LM3911 can be used to make a viable temperature sensor. While all of the reading
were not exactly as read by either the thermometer or the water bath sensor, this
could be fine-tuned by either the resistors used or through code changes. The LED
lights connected to the Temperature readings was the easiest part of the coding.
This A/D conversion lab was completed properly and thoroughly introduced
me to the A/D converter.
Appendix:
Figure 1 shows an accurate representation of the 68HC11 hardware. This picture
was taken from the internet and shows a slight problem. My code uses the PE1 port
and not the PE2 port on the 68HC11. The second problem is that the figure was
designed for 20-90 degrees F and not 0-100 degrees C.
Flow Chart
ASM Code
*ENGR 4240 Introduction to Microcontrollers
*A/D Converter
*Static Variables
OUTRHLF
OUTA
EQU
EQU
$FFB5
$FFB8
OUTSTRG
EQU
$FFC7
OUTCRLF
EQU
$FFC4
OUTSTRGO
EQU
$FFCA
INCHAR
EQU
$FFCD
ADCTL
EQU
$1030
EQU
$1032
*Dynamic Variables
d1
EQU
$DB01
d2
EQU
$DB02
d3
EQU
$DB03
d4
EQU
$DB04
d5
EQU
$DB05
PortB
EQU
org
DIGITAL
$1004
$8000
RMB
VOLTAGE
RMB
TEMP
RMB
;Reserve bytes
ORG
Prompt
$9000
FCC
FCB
Celsius
$04
FCC
FCB
*Main loop
ORG
BACK
$A000
LDX
#Prompt
JSR
OUTSTRG
JSR
OUTCRLF
JSR
INCHAR
JSR
TEMPSUB
;Input
;Converts to decimal
LEDSUB
JSR
BINBCD
JSR
JMP
BACK
;Turn on LEDs
;Convert to decimal
;Prints temperature
*Temp SR
ORG
$B000
LDAA
#%00000001
STAA
ADCTL
LDAB
#16
TEMPSUB
Time
DECB
BNE
Time
LDAA
PE1
STAA
DIGITAL
LDAB
#20
MUL
STD
VOLTAGE
LDAA
DIGITAL
LDAB
#4
;voltage in millivolts
;step size
MUL
STD
TEMP
RTS
*LED SR
ORG
$C000
LEDSUB
LDAA DIGITAL
stored in port B)
;Led 1 turns on from a range from values from 0-31 (all results
#31
STAB
$CF00
CMPA
$CF00
BHI
TWO
LDAA
#%00000001
STAA
PortB
JMP
DONE
TWO
LDAA
DIGITAL
LDAB
#63
STAB
$CF00
CMPA
$CF00
BHI
THREE
LDAA
#%00000011
STAA
PortB
JMP
DONE
THREE
LDAA
DIGITAL
LDAB
#91
STAB
$CF00
CMPA
$CF00
BHI
FOUR
LDAA
#%00000111
STAA
PortB
JMP
DONE
FOUR
LDAA
DIGITAL
#127
STAB
$CF00
CMPA
$CF00
BHI
FIVE
LDAA
#%00001111
STAA
PortB
JMP
FIVE
LDAA
#158
STAB
$CF00
CMPA
$CF00
SIX
LDAA
#%00011111
STAA
PortB
JMP
DONE
LDAA
DIGITAL
LDAB
#190
STAB
$CF00
CMPA
$CF00
BHI
SEVEN
LDAA
#%00111111
STAA
PortB
JMP
SEVEN
DIGITAL
LDAB
BHI
SIX
DONE
DONE
LDAA
DIGITAL
LDAB
#222
STAB
$CF00
CMPA
$CF00
LDAA
#%01111111
STAA
PortB
JMP
EIGHT
EIGHT
DONE
LDAA
STAA
PortB
DONE
RTS
*Conversion SR
ORG
$D000
LDD
TEMP
LDX
#1000
BINBCD
;load digital value
IDIV
XGDX
STAB
d2
XGDX
LDX
#100
IDIV
XGDX
STAB
d3
XGDX
LDX
#10
IDIV
XGDX
STAB
d4
XGDX
STAB
d5
RTS
*Printing SR
ORG
$D800
LDAA
d2
JSR
LDAA
JSR
LDAA
JSR
LDAA
JSR
LDAA
OUTRHLF
d3
OUTRHLF
d4
OUTRHLF
#$2E
OUTA
d5
JSR
OUTRHLF
LDX
#Celsius
JSR
OUTSTRGO
JSR
OUTCRLF
RTS