Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The book has this example but is not working at compbf it shows in red and it su

ID: 1845833 • Letter: T

Question

The book has this example but is not working at compbf it shows in red and it suppose to appear in blue please help me to fix it the same code I cannot change anything

R1 EQU 0x25
R2  EQU 0x26
PORTB EQU     0x30
COUNT_1  EQU d'10'
COUNT_2  EQU d'70'
    ORG 0H
    movlw 0x55          ;WREG = 55h
movwf PORTB         ;PORTB = 55h
movlw COUNT_1       ;WREG = 10, outer loop count value
    movwf R1            ;load 10 into location 25h (outer loop count)
LOP_1 movlw COUNT_2     ;WREG = 70 inner loop count value
    movwf R2            ;load 70 into location 26h
LOP_2 comPf PORTB, f    ;complement Port B SFR HERE IS THE PROBLEM!!!!!!
    decf R2,f           ;dec fileREg loc 26 ( inner loop
bnz LOP_2           ;repeat it 70 times
decf R1,f           ;dec fileREg loc 25 (outer loop)
    bnz LOP_1           ;repeat it 10 times
end

Explanation / Answer

I don't see a problem with this code. I theorize the color value is given to the wrong channel. There are 3 channels, Red,Green,Blue, so if red has the value instead of blue that might be your problem, solid red or blue is usually at a value of 255 and the other channels being 0. So check the channel values if you can.

Hope this helped, good luck.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote