0% found this document useful (0 votes)
40 views4 pages

Solution: Flow Chart:: For Part C) Directly Because It Contains The Entire Questions)

This document contains a flow chart and code for a microcontroller program. The flow chart shows a start point that calls an initialization subroutine and turns off LEDs. It then loops, checking the value of a port and either rotating the bits left or right before delaying. The code implements the flow chart, initializing a port, checking its value in a loop and conditionally rotating the bits left or right with delays.

Uploaded by

Omar F'Kassar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views4 pages

Solution: Flow Chart:: For Part C) Directly Because It Contains The Entire Questions)

This document contains a flow chart and code for a microcontroller program. The flow chart shows a start point that calls an initialization subroutine and turns off LEDs. It then loops, checking the value of a port and either rotating the bits left or right before delaying. The code implements the flow chart, initializing a port, checking its value in a loop and conditionally rotating the bits left or right with delays.

Uploaded by

Omar F'Kassar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Solution :

Flow chart :

S ta r t

C o n fi + In it

LEDs O FF

H '80 'LEDs H '0 1 '(b )

C a ll D e la y 1 4 0 0 m S
LED = H 'F F ' ( b )
200 m S ( b )
N
C a rry = 0 R o ta te R ig h t
LED = H '01 '
C a rry = 1 ( b ) R o ta te le ft ( b )

Code: ( for part c) directly because it contains the entire questions )

MAIN1 MOVLW H'80'

MOVWF PORTB

NEXT1 CALL DELAY1400MS

MOVF PORTB,W
SUBLW H'01'

BTFSC STATUS,Z

GOTO MAIN2

BCF STATUS,C

RRF PORTB,F

GOTO NEXT1

DELAY1400MS MOVLW D'7'

MOVWF REF3

REFILL2 MOVLW D'255'

MOVLW REF2

REFILL1 MOVLW D'255'

MOVLW REF1

CORE1 DECFSZ REF1,F

GOTO CORE1
DECFSZ REF2,F

GOTO REFILL1

DECFSZ REF3,F

GOTO REFILL2

RETURN

MAIN2 MOVLW H'01'

MOVWF PORTB

NEXT2 CALL DELAY200MS

MOVF PORTB,W

SUBLW H'FF'

BTFSC STATUS,Z

GOTO MAIN1

BSF STATUS,C

RLF PORTB,F

GOTO NEXT2
DELAY200MS MOVLW D'1'

MOVWF REF6

REFILL5 MOVLW D'255'

MOVLW REF5

REFILL4 MOVLW D'255'

MOVLW REF4

CORE2 DECFSZ REF4,F

GOTO CORE2

DECFSZ REF5,F

GOTO REFILL4

DECFSZ REF6,F

GOTO REFILL5

RETURN

 Objective is completed

You might also like