himam
Newbie
I can't get any changes on digital oscillation changes on my atmega8515.
Here is my assembly code,
ibb.co/Mk2MGg1
I attached screen shots
Here is screenshot
Here is my assembly code,
Code:
;**********************************************************************
;Ïðîãðàììà 1.1 äëÿ ìèêðîêîíòðîëëåðîâ ATx8515:
;ïåðåêëþ÷åíèå ñâåòîäèîäîâ (ÑÄ) ïðè íàæàòèè íà êíîïêó START (SW0),
;ïîñëå íàæàòèÿ êíîïêè STOP (SW1) ïåðåêëþ÷åíèå ïðåêðàùàåòñÿ è
;âîçîáíîâëÿåòñÿ c ìåñòà îñòàíîâêè ïðè ïîâòîðíîì íàæàòèè íà êíîïêó START
;Ñîåäèíåíèÿ: SW0-PD0, SW1-PD1, LED-PB
;**********************************************************************
;.include "8515def.inc" ;ôàéë îïðåäåëåíèé äëÿ AT90S8515
.include "m8515def.inc" ;ôàéë îïðåäåëåíèé äëÿ ATmega8515
.def temp = r16 ;âðåìåííûé ðåãèñòð
.def reg_led = r20 ; ðåãèñòð ñîñòîÿíèÿ ñâåòîäèîäîâ
.equ START = 0 ;0-é ðàçðÿä ïîðòà
.equ STOP = 1 ;1-é ðàçðÿä ïîðòà
.org $000
rjmp init
INIT: ldi reg_led,0xFE ;ñáðîñ reg_led.0 äëÿ âêëþ÷åíèÿ LED0
sec ;C=1
set ;T=1 – ôëàã íàïðàâëåíèÿ
ser temp ;èíèöèàëèçàöèÿ
out DDRB,temp ; ïîðòà PB íà âûâîä
out PORTB,temp ;ïîãàñèòü ÑÄ
clr temp ;èíèöèàëèçàöèÿ
out DDRD,temp ; ïîðòà PD íà ââîä
ldi temp,0x03 ;âêëþ÷åíèå ïîäòÿãèâàþùèõ
out PORTD,temp ; ðåçèñòîðîâ ïîðòà PD
WAITSTART: ;îæèäàíèå
sbic PIND,START ; íàæàòèÿ
rjmp WAITSTART ; êíîïêè START
LOOP: out PORTB,reg_led ;âêëþ÷åíèå ÑÄ
ldi r16,11
d0: ldi r17,237
d1: ldi r18,255
d2: dec r18
brne d2
dec r17
brne d1
dec r16
brne d0
sbic PIND,STOP ;åñëè çàìêíóòà êíîïêà STOP, òî
rjmp MM ; ïåðåõîä
rjmp WAITSTART ; äëÿ ïðîâåðêè êíîïêè START,
MM: brts LEFT ;ïåðåõîä, åñëè ôëàã T óñòàíîâëåí
sbrs reg_led,0
set ;T=1 - ïåðåêëþ÷åíèå ôëàãà íàïðàâëåíèÿ
ror reg_led ;ñäâèã reg_led âïðàâî íà 1 ðàçðÿä
rjmp LOOP
LEFT: sbrs reg_led,7
clt ;T=0 – ïåðåêëþ÷åíèå ôëàãà íàïðàâëåíèÿ
rol reg_led ;ñäâèã reg_led âëåâî íà 1 ðàçðÿä
rjmp LOOP
ibb.co/Mk2MGg1
I attached screen shots
--- Updated ---
Here is screenshot
Attachments
Last edited by a moderator: