D
D
Dmitry819232021-12-13 23:14:38
Atmel AVR
Dmitry81923, 2021-12-13 23:14:38

What is the simplest way to apply voltage to 7 pins in turn?

Hello.
In general, I study the work of AVR in assembler. Here, let's say I need to do sbi for each port. What is the easiest way to do this?
Here is an example with an error that shows my goal

ldi       r16, 0x0
loopPortD:
                    sbi       0x12, r16 ; Тут ошибка ; Подать напряжение на PDx(0-7)
                    inc       r16
                    cpi       r16, 0x7
                    brne      loopPortD

It is important that it be sequential (just apply to all 7 pins - not what you need)

UPD: I know that sbi accepts a constant. I mean, to do 7 pins - you need 7 calls to this sbi. How to make it easier? With a loop? Is there a way to transfer the register there?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
evgeniy_lm, 2021-12-15
@Dmitry81923

ldi r16, 1
loopPortD:
out PORTD, r16
; maybe a pause is needed here
lsl r16
brcc loopPortD

V
VT100, 2021-12-14
@VT100

The second operand sbi is a constant.
www.gaw.ru/html.cgi/txt/doc/micros/avr/asm/sbi.htm

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question