close

Вход

Забыли?

вход по аккаунту

?

Отчет(7)

код для вставкиСкачать
Министерство Образования и науки Российской Федерации
ГОУ ВПО КубГТУ
Факультет компьютерных технологий и автоматизированных систем
Кафедра АПП
Отчёт по лабораторной работе №3
Выполнил: Студент группы 10-К-УИ1
Ишкараев А.А.
Проверил: Кандидат технических наук
Посмитный Е.В.
г. Краснодар 2012
Задание:
Организовать циклический ввод данных с двух каналов АЦП (с каждого – результат 8
разрядов). Данные канала ADC0 выводить на первый разряд семисегментного
индикатора, данные канала ADC1 – на третий разряд в виде одной цифры (0-F).
Код программы:
.include "m128def.inc"
.cseg
.org $0000
rjmp start
.org $002A
rjmp ADC_end
.org $80
start:
ldi r16,Low(RAMEND)
out spl,r16
ldi r16,High(RAMEND)
out sph,r16
ldi r16,0xff
out ddrc,r16
sbi ddre,4
sbi ddre,6
ldi
r16,0b10001000
out ADCSRA,r16
ldi
r16,0b00100000
out ADMUX,r16
sei
main:
sbi adcsra,adsc
m1:
ldi r20,1
sbic adcsra,adsc
rjmp m1
sbi adcsra,adsc
;0 для MUX
ldi r20,0
sbic adcsra,adsc
rjmp m2
;1 для MUX
m2:
rcall ooo
cbi porte,4
out portc,r21
ldi
r23,255
k1:
nop nop nop nop nop nop
dec r23
brne k1
sbi porte,4
rcall yyy
cbi porte,6
out portc,r22
ldi
r23,255
k2:
nop nop nop nop nop nop
dec r23
brne k2
sbi porte,6
rjmp main
ADC_end:
in r0,sreg
cpi r20,1
breq m3
rjmp m4
m3:
sbi
admux,0
in r17,adch
rjmp m5
m4:
m5:
cbi admux,0
in r18,adch
rjmp m5
out sreg,r0
reti
/* ------------------------------- */
/*---Проверка adch по диапазонам---*/
ooo:
s0:
cpi r17,1
brsh s16
rjmp c0
s16:cpi r17,17
brlo t0
rjmp s17
t0: rjmp c0
s17:cpi r17,17
brsh s32
rjmp s0
s32:cpi r17,33
brlo t1
rjmp s33
t1: rjmp c1
s33:cpi r17,33
brsh s48
rjmp s0
s48:cpi r17,49
brlo t2
rjmp s49
t2: rjmp c2
s49:cpi r17,49
brsh s64
rjmp s0
s64:cpi r17,65
brlo t3
rjmp s65
t3: rjmp c3
s65:cpi r17,65
brsh s80
rjmp s0
s80:cpi r17,81
brlo t4
rjmp s81
t4: rjmp c4
s81:cpi r17,81
brsh s96
rjmp s0
s96:cpi r17,97
brlo t5
rjmp s97
t5: rjmp c5
s97:cpi r17,97
brsh s112
rjmp s0
s112:cpi r17,113
brlo t6
rjmp s113
t6: rjmp c6
s113:cpi r17,113
brsh s128
rjmp s0
s128:cpi r17,129
brlo t7
rjmp s129
t7: rjmp c7
s129:cpi r17,129
brsh s144
rjmp s0
s144:cpi r17,145
brlo t8
rjmp s145
t8: rjmp c8
s145:cpi r17,145
brsh s160
rjmp s0
s160:cpi r17,161
brlo t9
rjmp s161
t9: rjmp c9
s161:cpi r17,161
brsh s176
rjmp s0
s176:cpi r17,177
brlo t10
rjmp s177
t10: rjmp c10
s177:cpi r17,177
brsh s192
rjmp s0
s192:cpi r17,193
brlo t11
rjmp s193
t11: rjmp c11
s193:cpi r17,193
brsh s208
rjmp s0
s208:cpi r17,209
brlo t12
rjmp s209
t12: rjmp c12
s209:cpi r17,209
brsh s224
rjmp s0
s224:cpi r17,225
brlo t13
rjmp s225
t13: rjmp c13
s225:cpi r17,225
brsh s240
rjmp s0
s240:cpi r17,241
brlo t14
rjmp s241
t14: rjmp c14
s241:cpi r17,241
brsh s255
rjmp s0
s255:cpi r17,255
brlo t15
t15: rjmp c15
rjmp s0
yyy:
g0:
cpi r18,1
brsh g16
rjmp bl0
g16:cpi r18,17
brlo f0
rjmp g17
f0: rjmp bl0
g17:cpi r18,17
brsh g32
rjmp g0
g32:cpi r18,33
brlo f1
rjmp g33
f1:rjmp bl1
g33:cpi r18,33
brsh g48
rjmp g0
g48:cpi r18,49
brlo f2
rjmp g49
f2:rjmp bl2
g49:cpi r18,49
brsh g64
rjmp g0
g64:cpi r18,65
brlo f3
rjmp g65
f3:rjmp bl3
g65:cpi r18,65
brsh g80
rjmp g0
g80:cpi r18,81
brlo f4
rjmp g81
f4:rjmp bl4
g81:cpi r18,81
brsh g96
rjmp g0
g96:cpi r18,97
brlo f5
rjmp g97
f5:rjmp bl5
g97:cpi r18,97
brsh g112
rjmp g0
g112:cpi r18,112
brlo f6
rjmp g128
f6:rjmp bl6
g113:cpi r18,113
brsh g128
rjmp g0
g128:cpi r18,129
brlo f7
rjmp g129
f7:rjmp bl7
g129:cpi r18,129
brsh g144
rjmp g0
g144:cpi r18,145
brlo f8
rjmp g145
f8:rjmp bl8
g145:cpi r18,145
brsh g160
rjmp g0
g160:cpi r18,161
brlo f9
rjmp g161
f9:rjmp bl9
g161:cpi r18,161
brsh g176
rjmp g0
g176:cpi r18,177
brlo f10
rjmp g177
f10:rjmp bl10
g177:cpi r18,177
brsh g192
rjmp g0
g192:cpi r18,193
brlo f11
rjmp g193
f11:rjmp bl11
g193:cpi r18,193
brsh g208
rjmp g0
g208:cpi r18,209
brlo f12
rjmp g209
f12:rjmp bl12
g209:cpi r18,209
brsh g224
rjmp g0
g224:cpi r18,225
brlo f13
rjmp g225
f13:rjmp bl13
g225:cpi r18,225
brsh g240
rjmp g0
g240:cpi r18,241
brlo f14
rjmp g241
f14:rjmp bl14
g241:cpi r18,241
brsh g255
rjmp g0
g255:cpi r18,255
brlo f15
f15:rjmp bl15
rjmp s0
/* Цифры семисегментника */
c0: ldi r21,0b11000000
ret
c1: ldi r21,0b11111001
ret
c2: ldi r21,0b10100100
ret
c3: ldi r21,0b10110000
ret
c4: ldi r21,0b10011001
ret
c5: ldi r21,0b10010010
ret
c6: ldi r21,0b10000010
ret
c7: ldi r21,0b11111000
ret
c8: ldi r21,0b10000000
ret
c9: ldi r21,0b10010000
ret
c10:ldi r21,0b10001000
ret
c11:ldi r21,0b10000011
ret
c12:ldi r21,0b11000110
ret
c13:ldi r21,0b10100001
ret
c14:ldi r21,0b10000110
ret
c15:ldi r21,0b10001110
ret
bl0: ldi r22,0b11000000
ret
bl1: ldi r22,0b11111001
ret
bl2: ldi r22,0b10100100
ret
bl3: ldi r22,0b10110000
ret
bl4: ldi r22,0b10011001
ret
bl5: ldi r22,0b10010010
ret
bl6: ldi r22,0b10000010
ret
bl7: ldi r22,0b11111000
ret
bl8: ldi r22,0b10000000
ret
bl9: ldi r22,0b10010000
ret
bl10:ldi r22,0b10001000
ret
bl11:ldi r22,0b10000011
ret
bl12:ldi r22,0b11000110
ret
bl13:ldi r22,0b10100001
ret
bl14:ldi r22,0b10000110
ret
bl15:ldi r22,0b10001110
ret
Документ
Категория
Программирование, Базы данных
Просмотров
9
Размер файла
255 Кб
Теги
отчет
1/--страниц
Пожаловаться на содержимое документа