led rotation

Go To Last Post
7 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi guys

I have a project  to do an 8 led rotation using t0 timer to do time delay.Also using interupts 0 and 1 to up and down the frequency of the rotation

Any similar post to guide me?
MC: ATmega 32 

prefere assembler but I m ok with c
thanks a lot

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

For starters, please define what you mean by "rotation"!

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I mean turning on the leds one after another in a loop

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Are they being driven directly from port pins?

 

Jim

 

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, they are.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Then think of what you need on the port pins:

 

Step one    0x00000001

Step two    0x00000010

Step three  0x00000100

 

It clearly behaves like a left shift except for the special case of step 8 to step 9.

 

You should be able to do this very easily in assembler. I would set up a timer to generate interrupts at the shift interval. In the interrupt, shift the value in the port (or handle the end-around case). The latter is particularly easy in assem since you have access to the carry bit. 

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

Last Edited: Sat. Mar 16, 2019 - 12:05 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I see, ok I ll try it.Thanks a lot