1
\$\begingroup\$

In the following video(at 10min):

https://www.youtube.com/watch?v=YELGX5XDCiY&list=PLgwJf8NK-2e55CdbY_WnY6pejPHoojCkJ&index=18

The microcontroller used in the video series is ATmega32.

Let's take the following assembly instruction to read the content of location 0x005F of EEPROM into PORTB

LDI R16,0xFF
OUT DDRB,R16 ; These instruction used to configure PORTB as output
WAIT: 
 SBIC EECR,EEWE ;
 RJMP WAIT
 .
 .
 .
 .

It says that the loop is used to wait for EEWE to become zero. SBIC is an immediate subtraction with carry; is used to subtruct a bit (EEWE) from its own control 8bit register and yet check if EECR is zero (I expect to check the bit EEWE and not the whole register)

Could anyone please explain to me how SBIC works together with RJMP to check EEWE ? Could anyone explain to me how these two instructions (SBIC and RJMP)

asked Apr 18, 2024 at 4:37
\$\endgroup\$
0

1 Answer 1

3
\$\begingroup\$

SBIC isn't "subtract immediate with carry", that's SBCI.

SBIC is "skip [the next instruction] if bit [in an I/O register] is clear".

So the SBIC tests whether the bit EEWE in EECR is set. If it's set, the next instruction executes, and that instruction is a jump back to the SBIC. On the other hand, if that bit is zero, the RJMP is skipped and execution continues at the "...".

answered Apr 18, 2024 at 5:11
\$\endgroup\$

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.