0% found this document useful (0 votes)
23 views

Programme en Assembleur

This document contains a program written in assembly language for an ATmega328P microcontroller. The program turns on an LED connected to port B pin 1 by setting it high, waits for a delay, then turns it off by setting the pin low and waits again before repeating in a loop. It initializes ports and stacks before the main program loop.

Uploaded by

Bruno Djukalema
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Programme en Assembleur

This document contains a program written in assembly language for an ATmega328P microcontroller. The program turns on an LED connected to port B pin 1 by setting it high, waits for a delay, then turns it off by setting the pin low and waits again before repeating in a loop. It initializes ports and stacks before the main program loop.

Uploaded by

Bruno Djukalema
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

***

...SET\PROJET_ATmega328P\projet01\naro001\naro001\main.asm 1
;
; naro001.asm
;
; Created: 28/01/2022 13:11:07
; Author: dell
;
;**********************************************************************************
******
;***** MON PREMIER PROGRAMME : ALLUMAGE D'UNE LED
******* ;*****************************************************************************
***** ******
.DEVICE ATMEGA328P ; type de uC utilisé
.INCLUDE "m328Pdef.inc"; fichier de definition du ATmega328p
.CSEG
.ORG $0000
cli
clr r16
out PORTB,
r16 ; initialisation portB
; initialisation de la pile
ldi r16, low(RAMEND)
ldi r17, high(RAMEND)
out SPL, r16
out SPH, r17
;configuration des ports
Ser r16
out DDRB, r16
; programme principal
nop
sbi PORTB, 1
main: sbi PORTB, 3
call delay cbi PORTB, 3
call delay
jmp main
; PROGRAMME DELAI
delay : ldi r28, low(20)
ldi r29, high(20)
ldi r30, low(100)
ldi r31, high(100)
sub_delay : sbiw r30, 1
nop
brne sub_delay
sbiw r28, 1
brne sub_delay
ret

You might also like