- #1
phsyics_197
- 11
- 0
Homework Statement
Write a program that shifts two 1's from left to right and back as output of Ports C & B
by sending the patterns shown below to PORTC & PORTB in the following order: Pattern 1,
2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, ... and repeat the cycle indefinitely.
Homework Equations
The Attempt at a Solution
When the program is run, the LED's should look like:
PC7 PC6 PC5 PC4 PC3 PC2 PC1 PC0 PB7 PB6 PB5 PB4 PB3 PB2 PB1 PB0
Pattern 1: ( )( ) ( ) ( ) ( ) ( ) ( ) (O) (O) ( ) ( ) ( ) ( ) ( ) ( ) ( )
Pattern 2: ( ) ( ) ( ) ( ) ( ) ( ) (O) (O) (O) (O) ( ) ( ) ( ) ( ) ( ) ( )
Pattern 3: ( ) ( ) ( ) ( ) ( ) (O) (O) ( ) ( ) (O) (O) ( ) ( ) ( ) ( ) ( )
Pattern 4: ( ) ( ) ( ) ( ) (O) (O) ( ) ( ) ( ) ( ) (O) (O) ( ) ( ) ( ) ( )
Pattern 5: ( ) ( ) ( ) (O) (O) ( ) ( ) ( ) ( ) ( ) ( ) (O) (O) ( ) ( ) ( )
Pattern 6: ( ) ( ) (O) (O) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) (O) (O) ( ) ( )
Pattern 7: ( ) (O) (O) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) (O) (O) ( )
Pattern 8: (O) (O) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) (O) (O)
I am having trouble with creating this program because I do not fully understand how it works. I was wondering if someone could at least help me out with a "Flow chart" by explaining step-by-step instructions, and then from there, maybe, I could actually write the program.
Thanks.