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

  • Thread starter phsyics_197
  • Start date
In summary, the task is to write a program that will generate data to drive the port pins of ports B and C in a specific pattern, resulting in an animation of LED lights. The program should send a sequence of patterns to PORTC and PORTB, starting with Pattern 1 and repeating the cycle indefinitely. The LED lights will turn on when a "1" is written to the corresponding port pin. A flow chart or step-by-step instructions may be helpful in understanding the program.
  • #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.
 
Physics news on Phys.org
  • #2
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)
 

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

What is a Microprocessor: MC68HC11?

The MC68HC11 is a microprocessor, or a small computer on a single integrated circuit, designed by Motorola. It was first introduced in 1985 and has been widely used in embedded systems and electronic devices.

What are the main features of the MC68HC11 microprocessor?

The MC68HC11 has a 16-bit central processing unit (CPU) with a clock speed of 2 MHz. It also has 512 bytes of on-chip RAM, 16 KB of on-chip ROM, and an 8-channel analog-to-digital converter. It also has various peripheral modules, such as timers, serial communication ports, and a parallel input/output port.

What programming languages can be used to program the MC68HC11?

The MC68HC11 can be programmed using assembly language, C language, and BASIC. Motorola also provides a software development kit (SDK) for the microprocessor.

Can the MC68HC11 be used in modern electronic devices?

While the MC68HC11 is an older microprocessor, it is still used in some modern electronic devices, particularly in automotive applications. However, it has largely been replaced by more advanced microcontrollers.

What are some common applications of the MC68HC11 microprocessor?

The MC68HC11 has been used in a wide range of applications, including automotive systems, industrial control systems, home appliances, and consumer electronics. It is also commonly used in educational settings for teaching microprocessor and embedded systems programming.

Similar threads

Replies
7
Views
4K
  • Sticky
5
Replies
169
Views
232K
Replies
2
Views
28K
Replies
2
Views
8K
Back
Top