Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
LinkBack Thread Tools Display Modes
Old 21st January 2008, 05:08 AM   (permalink)
Default rtos_msg_send problem.. ccs c compiler

can anybody tell me whats wrong with my code.. It has an error ("EXPECTING FUNCTION NAME") near rtos_msg_send(the_second_rtos_task,count); please help.. im using ccs c compiler ver. 4

Code:
#include<16f877.h>
#use delay(clock=20000000)
#use rs232 (baud=9600,xmit=PIN_C6,rcv=PIN_C7)
#use rtos(timer=0,minor_cycle=100ms)

#task(rate=1000ms,max=100ms,queue=2)
void the_first_rtos_task();
#task(rate=500ms,max=100ms,queue=2)
void the_second_rtos_task();

void the_first_rtos_task()
{
   int count=0;

   while(true){
      count++;
      rtos_msg_send(the_second_rtos_task,count);
      rtos_yield();
   }
}

void the_second_rtos_task()
{
   if (rtos_msg_poll())
   {
      printf("count is : %i\n\r",rtos_msg_read());
   }
}

void main()
{
   rtos_run();
}
overmind is offline  
Old 21st January 2008, 06:49 AM   (permalink)
Default

That's what happens when you use a RTOS. You just add 1 more level of complexity.

I'm not familiar with the compiler you are using, but could it be something as simple as needing brackets after the function name so it becomes the_second_rtos_task().

Is there not a forum that deals with this RTOS as I don't think anyone here has any experience with it.

Mike.
Pommie is online now  
Old 21st January 2008, 07:22 AM   (permalink)
Default

hi pommie.. thanks for the reply.. anyway i tried your suggestion but it still won't work.. would you be kind enough to tell me the website where people discuss this type of stuff? thank you so much..
overmind is offline  
Old 21st January 2008, 07:31 AM   (permalink)
Default

RTOS, try the compiler site or Microchips site. Why do you need an RTOS? They really aren't practical on teeny tiny controllers like the 16F877, interrupt driven code is the way to go.
Did you ever get your seven segment thing running?
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com
blueroomelectronics is offline  
Old 21st January 2008, 07:40 AM   (permalink)
Default

hi.. yeah.. i have already got my seven segment running and have done already many things with my pic. thanks to you and the people here at electro-tech.. actually i really dont need rtos. it is just out of curiosity sake that i try to study it..
overmind is offline  
Old 21st January 2008, 12:19 PM   (permalink)
Default

Do I have it correct that you are using the CCS supplied RTOS?
IF so place to ask this question is on the CCS support forum.

But Pommie was on the right track. If you are asking this question there is a very good chance you should not be uisng any RTOS. It is as he said one more layer of complexity. You need to master the other layers first. If you had you would not be asking a question that you could solve by looking in the manul.

I do not mean to discourage you in anything other then using RTOS at this time. For the most part it only makes sense to use an RTOS when doing so will decrease the complexity of your code.

Code you application using interrupts or even polling if possible.
3v0 is online now  
Old 21st January 2008, 09:59 PM   (permalink)
Default

I've used CCS quite a bit in the past. I've never used the RTOS, but I happened to have the docs open anyways for another project.

I think what you need is the #TASK preprocessor directive before each of your two tasks, otherwise the functions arent registered as tasks. I suggest reading the relavent RTOS sections of the latest compiler manual from here: http://ccsinfo.com/downloads.php

Also, there are a couple RTOS examples given in the examples directory:

EX_RTOS_DEMO_1_TASKS.C RTOS scheduling and rtos_run
EX_RTOS_DEMO_2_TERMINATION.C Introduction to rtos_terminate
EX_RTOS_DEMO_3_ENABLE_DISABLE.C Introduction to rtos_enable/rtos_disable
EX_RTOS_DEMO_4_MESSAGES.C RTOS messaging functions
EX_RTOS_DEMO_5_YIELD.C Introduction to rtos_yield
EX_RTOS_DEMO_6_SEMAPHORES.C Introduction to rtos_signal/rtos_wait
EX_RTOS_DEMO_7_AWAIT.C Introduction to rtos_await
EX_RTOS_DEMO_8_STATISTICS.C RTOS statistical features
EX_RTOS_DEMO_9_BASIC_KERNAL.C Basic serial command line with RTOS

Finally, CCS also provides a moderately active forum. I'm sure there is a plethora of RTOS threads here: http://ccsinfo.com/forum/

Good luck, and have fun!
Stellarcore is offline  
Old 22nd January 2008, 02:13 AM   (permalink)
Default

thanks guys.. i really appreciate all your help..
overmind is offline  
Reply

Bookmarks

Thread Tools
Display Modes



Similar Threads
Title Starter Forum Replies Latest
Regarding the CCS Compiler 3v0 Micro Controllers 5 24th March 2007 10:22 PM
Big problem!! zezito Electronic Projects Design/Ideas/Reviews 4 29th October 2004 03:05 AM
Problem with My A/D readings. Any suggestions? cubdh23 Micro Controllers 4 24th September 2004 05:22 AM
Mysterious Problem! matasoft Micro Controllers 15 11th September 2004 08:50 PM
Analog output PLC CQM1H problem goekgoek General Electronics Chat 0 24th June 2003 09:08 AM



All times are GMT. The time now is 01:54 AM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

eXTReMe Tracker