Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

rtos_msg_send problem.. ccs c compiler

Status
Not open for further replies.

overmind

New Member
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();
}
 
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.
 
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..
 
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?
 
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..
 
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.
 
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: https://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: https://ccsinfo.com/forum/

Good luck, and have fun!
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top