Display circularly scrolling text on the LCD in AVR studio and save the state when boot key is pressed

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

Here I have to write the program for display circularly scrolling text on the LCD in AVR studio for Atmega 2560. In this program, the text is scrolling as expected and it is moving circular. But Another thing that i have to add is that The text should hold its position as long as boot switch is pressed and should resume scrolling when the switch is released. I don't understand how to do this...Please help me with this...

This topic has a solution.
Last Edited: Sun. Feb 11, 2018 - 06:40 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How are you moving it? Do you use a timer or a delay? Either way the timer needs to stop or the delay be held indefinitely while the button is held.

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

This is my function for moving string

 

 

 

Last Edited: Fri. Jan 26, 2018 - 04:53 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

???

Presumably you have some function to move the text on the display.

Don't call that function if the button is pressed.

poojapatel wrote:
boot switch i
  What is a "boot switch" ???

In an AVR there is a register which holds some bits with info of the last reset.

Maybe you can do something with that. I believe the register is called "MCUCSR".

 

Another option is to put variables in a "no_init" section.

Variables in that section are not touched by startup code and remains unchanged during resets.

 

Edit:

Our posts crossed...

I don't see any reference to "boot" nor to "switch" in your code.

Your code is also difficult to find between al the whitespace, so I didn't spend much time there.

Doing magic with a USD 7 Logic Analyser: https://www.avrfreaks.net/comment/2421756#comment-2421756

Bunch of old projects with AVR's: http://www.hoevendesign.com

Last Edited: Fri. Jan 26, 2018 - 03:45 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
                        _delay_ms(500);

As it stands that goes off into a look at sits there for half a second. You need to modify this to break it into small delays then after each you check to see if the button is pressed. If not you then just continue to do the delays but if it is held you need to simply sit and wait until you see the switch revert to the inactive state

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

What does this mean?

poojapatel wrote:
//Please do not make any changes in the main function
I think there should not be any _delay_ms(); in your scroll function.

Build your software modularly.

Write it in such a way that your scroll() function just shifts the contents of the display 1 character (or pixel).

Then build more functionality around that in separate functions.

You might want to add a second parameter to the scroll() function, which would be the amount of characters the data has to be shifted.

Doing magic with a USD 7 Logic Analyser: https://www.avrfreaks.net/comment/2421756#comment-2421756

Bunch of old projects with AVR's: http://www.hoevendesign.com

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

yes, I can write it in such a way that scroll() function just shifts the contents of the display 1 character (or pixel) but i have to also display string in circular manner.

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
 }
                    while(swIsPressed); //stay here until sw is released
                        _delay_ms(500);
                        lcd_clear();

 

Jim

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

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

Thank you so much...@Raving Lunatic

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

poojapatel wrote:

Thank you so much...@Raving Lunatic

Join the club Jim smiley

 

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

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

ki0bk wrote:

 }
                    while(swIsPressed); //stay here until sw is released
                        _delay_ms(500);
                        lcd_clear();

 

Jim

Except that on the occasion that the switch is pressed do you ALSO want the 500ms delay as well? That is the very reason I suggested splitting up the 500ms into lots of small chunks (say 500 lots of 1ms?). In this case you either let the 500 lots of delay execute OR you find the switch held - wait while it is then abandon the rest of the current delay (so scrolling resumes as soon as the button is released).

 

Of course maybe that is not what is required?

 

(me, I'd be using a timer not _delay_ms() and also, like Paul said, I'd decouple the scrolling and anything to do with the delay)

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

This looks like some homework assignment:

poojapatel wrote:
Here I have to write the program for display circularly

poojapatel wrote:
//Please do not make any changes in the main function
( Original text deleted by OP).

Doing magic with a USD 7 Logic Analyser: https://www.avrfreaks.net/comment/2421756#comment-2421756

Bunch of old projects with AVR's: http://www.hoevendesign.com

Topic locked