CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

How to blink text without using delay_ms() function?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
tonkostz



Joined: 07 May 2011
Posts: 40
Location: Bulgaria

View user's profile Send private message

How to blink text without using delay_ms() function?
PostPosted: Thu Jun 13, 2013 1:05 am     Reply with quote

I want to blink a whole text line on the lcd but without using the delay_ms() function?
I mean that this variant is not good for me:
Code:
   
lcd_gotoxy(1,1);
printf(lcd_putc,"    Blinking   ");
delay_ms(500);
lcd_gotoxy(1,1);
printf(lcd_putc,"               ");
delay_ms(500);

I want something based on a timer counter for example:
Code:

 if(blink_flag==1)
 {   
  counter_blink++;
 }
 else
 {
  counter_blink=0;
 }
 if(counter_blink==50)
 {       
  counter_blink=0;
  blink=1;
 }

The problem is that i don't know how to reset the counter after the first blink and make it blink continuously.
oxo



Joined: 13 Nov 2012
Posts: 219
Location: France

View user's profile Send private message

PostPosted: Thu Jun 13, 2013 1:09 am     Reply with quote

Look at using the RTOS. Its easy to set up a task which repeats, and have it turn your display on and off.

Code:
#use rtos(timer=0, minor_cycle = 10ms)

#task (rate = 200ms, max = 10ms)
void display_task(void)
{
   lcd_gotoxy(1,1);
   blink = !blink;
   if(blink)
       printf(lcd_putc,"    Blinking   ");
   else
      printf(lcd_putc,"               ");
}
tonkostz



Joined: 07 May 2011
Posts: 40
Location: Bulgaria

View user's profile Send private message

PostPosted: Thu Jun 13, 2013 1:27 am     Reply with quote

Thank you very much! It works!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group