Sample Multiasking source code for 16F877A

Discussion about projects that used PIC Microcontroller, Hardware Interface, Programming Algorithm and etc......

Sample Multiasking source code for 16F877A

Postby A.Palaniappen » Thu May 17, 2012 12:15 am

hye everyone,
i'm doing final year project "Automatic Plant watering systems"
i need sample multiasking source code for 16F877A.
multiasking program to control watering pump and water level control and at the same time cut off watering pumps signal when day is raining.
i'm using two type of sensor
=>detect water level in tank.
=> Humidity sensor.
while(1)
{
if
{
timer to contorl watering pump to on
}

else if
{
contol water level
}

else if
{
cut off watering pump signal
}
}
program like this i think is not suit to control my fyp.
any comment/help
A.Palaniappen
Freshie
 
Posts: 6
Joined: Thu Mar 15, 2012 2:56 pm

Re: Sample Multiasking source code for 16F877A

Postby zhenning » Thu May 17, 2012 12:27 am

A.Palaniappen WROTE:hye everyone,
i'm doing final year project "Automatic Plant watering systems"
i need sample multiasking source code for 16F877A.
multiasking program to control watering pump and water level control and at the same time cut off watering pumps signal when day is raining.
i'm using two type of sensor
=>detect water level in tank.
=> Humidity sensor.
while(1)
{
if
{
timer to contorl watering pump to on
}

else if
{
contol water level
}

else if
{
cut off watering pump signal
}
}
program like this i think is not suit to control my fyp.
any comment/help


You can try Real Time Operating System : RTOS : FreeRTOS or micrium. Scheduling is also one of the multitasking method.
zhenning
Enthusiast
 
Posts: 351
Joined: Thu Dec 30, 2010 12:32 am

Re: Sample Multiasking source code for 16F877A

Postby zhenning » Thu May 17, 2012 12:32 am

You can also try Salvo RTOS. there is an example of using it from microchip:

http://ww1.microchip.com/downloads/en/A ... 00777b.pdf
zhenning
Enthusiast
 
Posts: 351
Joined: Thu Dec 30, 2010 12:32 am

Re: Sample Multiasking source code for 16F877A

Postby A.Palaniappen » Thu May 17, 2012 12:40 am

Thank's for your reply.
A.Palaniappen
Freshie
 
Posts: 6
Joined: Thu Mar 15, 2012 2:56 pm

Re: Sample Multiasking source code for 16F877A

Postby Brian Griffin » Thu May 17, 2012 9:55 am

The BoostC Professional contains small RTOS too. You can try it actually. :)
PIC - UIC00B from Cytron (replacement for my broken PICKit 2), Pickit 3, MikroC for PIC
dsPIC - MikroC for dsPIC, mikromedia board (dsPIC33)
AVR - AVR Dragon
Parallax - Prop tool
User avatar
Brian Griffin
Enthusiast
 
Posts: 403
Joined: Mon Jan 17, 2011 9:36 am

Re: Sample Multiasking source code for 16F877A

Postby robosang » Thu May 17, 2012 8:57 pm

That do not require a RTOS I think. Just a simple task. And the RTOS is not really multi-tasking, just distributing every task into smaller section and doing it in sequence so that you see them as multi-tasking.
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm

Re: Sample Multiasking source code for 16F877A

Postby A.Palaniappen » Tue May 22, 2012 1:52 am

haixx....i try ready..the rtos source code that you attach to me...is not working..
A.Palaniappen
Freshie
 
Posts: 6
Joined: Thu Mar 15, 2012 2:56 pm

Re: Sample Multiasking source code for 16F877A

Postby yonghui » Tue May 22, 2012 9:01 am

ya i agree with robosang that is task do not need any RTOS. i guess water level or humidity wont increase so fast until faster your while loop time in PIC16F877. and this case to use RTOS is only wasting the tasks switching overhead. RTOS divide task into small piece of running time and switch between it and at the same time consider the priority of each task, that is wat RTOS do.
thanks&regards,
yh
yonghui
Moderator
 
Posts: 732
Joined: Mon Sep 28, 2009 3:27 pm

Re: Sample Multiasking source code for 16F877A

Postby A.Palaniappen » Tue May 22, 2012 9:38 am

so....how to overcome with my problem....
A.Palaniappen
Freshie
 
Posts: 6
Joined: Thu Mar 15, 2012 2:56 pm

Re: Sample Multiasking source code for 16F877A

Postby Brian Griffin » Tue May 22, 2012 10:33 am

Can you use a timer to work on this first? There are examples like that in the net. One of them is a "pseudo-multitasking" which doesn't need RTOS. :)
PIC - UIC00B from Cytron (replacement for my broken PICKit 2), Pickit 3, MikroC for PIC
dsPIC - MikroC for dsPIC, mikromedia board (dsPIC33)
AVR - AVR Dragon
Parallax - Prop tool
User avatar
Brian Griffin
Enthusiast
 
Posts: 403
Joined: Mon Jan 17, 2011 9:36 am

Next

Return to PIC Microcontroller

Who is online

Users browsing this forum: No registered users and 11 guests