Está en la página 1de 3

Deber

Nombre: Santiago Calle

Realizar un barrido de display.


.include "m164pdef.inc"

;.......................................defino variables
.def temp=r16
.def numero=r17
.def numero1=r18
.def centena=r19
.def decena=r20
.def unidad=r21
.def salida=r22
.def valor=r23
.def aux=r24
;..................................declaro puertos de entrada y salida
ser
out
out
clr
out

temp
ddra,temp
ddrc,temp
temp
ddrb,temp

;port a como salida


;port c como salida
;portb como entrada

;.....................inicio el programa
main:
call
call
call
rjmp

datos
conversion
mostrar
main

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;,leo al portico A
datos:
clr temp
clr unidad
clr decena
clr centena
;out portc,temp
in numero,pinb
ret
;;;;;;;;;;;,proceso para convertir de binario a bcd

conversion:
cpi numero,100
brsh centenas
cpi numero,10
brsh decenas
mov unidad,numero

ret
centenas:
inc centena
subi numero,100
rjmp conversion
decenas:
inc decena
subi numero,10
rjmp conversion

mostrar:
mov valor,centena
ldi temp,1
call barrido
mov valor,decena
ldi temp,2
call barrido
mov valor,unidad
ldi temp,4
call barrido
ret
barrido:
ldi
ldi
add
clr
adc
lpm

zl,low(tabla1<<1)
zh,high(tabla1<<1)
zl,valor
aux
zh,aux
salida,z

out portc,temp
out porta,salida
call delay
ret

delay:
ldi r18,255
loop:
dec r18
brne loop
ret
;;;;;;;;;;;;;;;;;;;,tabla nodo comn
tabla1:
.db 0b01000000,0b01111001
.db 0b00100100,0b00110000
.db 0b00011001,0b00010010
.db 0b00000010,0b01111000

;0,1
;2,3
;4,5
;6,7

.db
.db
.db
.db

0b00000000,0b00010000
0b00001000,0b00000011
0b01000110,0b00100001
0b00000110,0b00001110

;8,9
;A,B
;C,D
;E,F

Diagrama circuito

U1
40
41
42
43
44
1
2
3
9
10
11
12
13
14
15
16
29
27
4

PB0/XCK0/T0/PCINT8
PB1/T1/CLKO/PCINT9
PB2/AIN0/INT2/PCINT10
PB3/AIN1/OC0A/PCINT11
PB4/SS/OC0B/PCINT12
PB5/MOSI/PCINT13
PB6/MISO/PCINT14
PB7/SCK/PCINT15
PD0/RXD0/PCINT24
PD1/TXD0/PCINT25
PD2/INT0/RXD1/PCINT26
PD3/INT1/TXD1/PCINT27
PD4/OC1B/XCK1/PCINT28
PD5/OC1A/PCINT29
PD6/ICP/OC2B/PCINT30
PD7/OC2A/PCINT31
AREF
AVCC
RESET
ATMEGA164P

PA0/ADC0/PCINT0
PA1/ADC1/PCINT1
PA2/ADC2/PCINT2
PA3/ADC3/PCINT3
PA4/ADC4/PCINT4
PA5/ADC5/PCINT5
PA6/ADC6/PCINT6
PA7/ADC7/PCINT7
PC0/SCL/PCINT16
PC1/SDA/PCINT17
PC2/TCK/PCINT18
PC3/TMS/PCINT19
PC4/TDO/PCINT20
PC5/TDI/PCINT21
PC6/TOSC1/PCINT22
PC7/TOSC2/PCINT23
XTAL1
XTAL2

37
36
35
34
33
32
31
30
19
20
21
22
23
24
25
26
8
7

P1
P2
P3

1
0
0
0
1
0
0
1

RN1
1
2
3
4
5
6
7
8

16
15
14
13
12
11
10
9
330

P1
P2
P3

También podría gustarte