Microprocessor Program: Shifting Two 1's on Ports C & B

  • Thread starter Thread starter phsyics_197
  • Start date Start date
Click For Summary
SUMMARY

The discussion focuses on creating a microprocessor program that shifts two 1's across Ports C and B, generating specific LED patterns. The patterns are defined in a sequence from 1 to 8 and then back down to 1, creating a visual animation on an LED array. The user seeks assistance in developing a flowchart and step-by-step instructions to facilitate the programming process, emphasizing the need for clarity in understanding how to manipulate the port pins to achieve the desired output.

PREREQUISITES
  • Understanding of microprocessor architecture and port manipulation
  • Familiarity with LED array configurations and binary representation
  • Knowledge of programming concepts relevant to embedded systems
  • Experience with flowchart creation for algorithm design
NEXT STEPS
  • Research how to manipulate GPIO pins on microcontrollers
  • Learn about binary counting and its application in LED control
  • Study flowchart design techniques for algorithm visualization
  • Explore programming languages commonly used in embedded systems, such as C or Assembly
USEFUL FOR

Embedded systems developers, electronics enthusiasts, and students learning about microprocessor programming and LED control techniques will benefit from this discussion.

phsyics_197
Messages
11
Reaction score
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.
 
Physics news on Phys.org
Your program will generate data that will drive the port pins of the two 8-bit data ports (B and C) as specified in your question, resulting in an "animation" of the LED array.

This assignment is mildly cool, so I hope you figure it out.

Maybe the alignment is confusing you so I straightened it out:

I take it "(O)" means the LED is on and that this happens when a "1" is written to the corresponding port pin.


Code:
           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)
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 7 ·
Replies
7
Views
4K
  • Sticky
  • · Replies 169 ·
6
Replies
169
Views
241K
  • · Replies 1 ·
Replies
1
Views
28K
  • · Replies 2 ·
Replies
2
Views
10K