Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Push Button Response using RTOS

Status
Not open for further replies.

w_bwr

Member level 3
Joined
Feb 4, 2010
Messages
66
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
Karachi, Pakistan
Activity points
1,810
I am using PIC 18f452 and CCS compiler with its built in RTOS, which is not Pre-emptive.
I just want to increase the count on the GLCD when a button is pressed. I have written the code and it works fine.
But if I press the button continuously, it misses some inputs. I want to make it smooth and need help doing that.
Here is the code:

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

#task (rate=500ms, max=10ms)
void Button()
{
if (!input(PIN_A4))
{
dt_lcd_gotoxy(100,2);printf(dt_lcd_printchar,"%Lu",timer0);
timer0++;
}
}

There are others tasks running too! their frequency is:

Code:
#task (rate=500ms, max=10ms)
void Sel_ADC_Channel()


#task (rate=100ms, max=40ms)
void Get_voltage()


#task (rate=1s, max=100ms)
void Update LCD()
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top