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 support@ccsinfo.com

Cant compile RTOS PIC16F877A

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



Joined: 13 Apr 2007
Posts: 24

View user's profile Send private message AIM Address

Cant compile RTOS PIC16F877A
PostPosted: Sat Dec 29, 2007 3:57 pm     Reply with quote

Code:

#include "G:\program PIC\16f877A\real_rtos1.h"

#use rtos(timer=0,minor_cycle=500ms)

#task(rate=500ms,max=100ms)
void read_IR( )
{
  printf("hello world");
}

#task(rate=1000ms,max=100ms)
void read_IR1( )
{
  int i;
  printf("hello USA !");
 // delay_ms(50);
  for(i=0;i<50;i++)
  {
  printf("CCS Rocks !!");
  }
}

void main()
{

   setup_adc_ports(NO_ANALOGS);
   setup_adc(ADC_OFF);
   setup_psp(PSP_DISABLED);
   setup_spi(SPI_SS_DISABLED);
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);
   setup_port_a( ALL_ANALOG );
   setup_adc( ADC_CLOCK_INTERNAL );
   set_adc_channel( 0 );
   set_tris_b(0xf0);
   rtos_run();
 


}



Code:

#include <16F877A.h>
#device adc=10

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES HS                       //High speed Osc (> 4mhz)
#FUSES PUT                      //Power Up Timer
#FUSES NOPROTECT                //Code not protected from reading
#FUSES NODEBUG                  //No Debug mode for ICD
#FUSES NOBROWNOUT               //No brownout reset
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD                    //No EE protection
#FUSES WRT_50%                  //Lower half of Program Memory is Write Protected

#use delay(clock=20000000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)

Error

Code:

USE parameter value is out of range :: Minor cycle too short for this timer
One of the values for a parameter to the USE library is not valid for the current environment.


Version : CCS 4.058
This is my first try and I got struck !!
Crying or Very sad

Please help me out !
[/code]
HOHOHAHA



Joined: 13 Apr 2007
Posts: 24

View user's profile Send private message AIM Address

PostPosted: Sun Dec 30, 2007 2:45 am     Reply with quote

No one to help me out ?? Please try ...
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Sun Dec 30, 2007 7:14 am     Reply with quote

Quote:
This is my first try and I got struck !!
If you get stuck on your first attempt it means you are taking a too big step from current knowledge to new territory. Have you looked and played with the 9 RTOS example programs that come with the compiler? They are located in the examples directory of the compiler.

I have never used the RTOS but I think I spotted your error:
Code:
#use rtos(timer=0,minor_cycle=500ms)
Here you have defined that the shortest common active time for all tasks is 500ms, i.e. each task will at least run a multiple of 500ms.

Code:
#task(rate=500ms,max=100ms)
This task is defined to run a maximum of 100ms which is in conflict with the RTOS definition above where you defined each task to run a _minimum_ of 500ms.

Change the 500ms in the first line to 100ms
Code:
#use rtos(timer=0,minor_cycle=100ms)
HOHOHAHA



Joined: 13 Apr 2007
Posts: 24

View user's profile Send private message AIM Address

PostPosted: Sun Dec 30, 2007 12:27 pm     Reply with quote

Code:
/////////////////////////////////////////////////////////////////////////
////                     ex_rtos_demo1_tasks.C                       ////
////                                                                 ////
////  This file demonstrates how to use the ral time operating       ////
////  system to schedule tasks and how to use the rtos_run function  ////
////                                                                 ////
/////////////////////////////////////////////////////////////////////////
////        (C) Copyright 1996,2003 Custom Computer Services         ////
//// This source code may only be used by licensed users of the CCS  ////
//// C compiler.  This source code may only be distributed to other  ////
//// licensed users of the CCS C compiler.  No other use,            ////
//// reproduction or distribution is permitted without written       ////
//// permission.  Derivative programs created using this software    ////
//// in object code form are not restricted in any way.              ////
/////////////////////////////////////////////////////////////////////////

#include <18F452.h>
#use delay(clock=20000000)
#use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7)
// this tells the compiler that the rtos functionality will be needed, that
// timer0 will be used as the timing device, and that the minor cycle for
// all tasks will be 100 miliseconds
#use rtos(timer=0,minor_cycle=100ms)

// each function that is to be an operating system task must have the #task
// preprocessor directive located above it.
// in this case, the task will run every second, its maximum time to run must
// be less than or equal to the minor cycle, and there is no need for a
// queue at this point, so no memory will be reserved.
#task(rate=1000ms,max=100ms)
// the function can be called anything that a standard function can be called
void The_first_rtos_task ( )
{
   printf("1\n\r");
}

#task(rate=500ms,max=100ms)
void The_second_rtos_task ( )
{
   printf("\t2!\n\r");
}

#task(rate=100ms,max=100ms)
void The_third_rtos_task ( )
{
   printf("\t\t3\n\r");
}

// main is still the entry point for the program
void main ( )
{
   // rtos_run begins the loop which will call the task functions above at the
   // schedualed time
   rtos_run ( );
}


Quote:
// this tells the compiler that the rtos functionality will be needed, that
// timer0 will be used as the timing device, and that the minor cycle for
// all tasks will be 100 miliseconds
#use rtos(timer=0,minor_cycle=100ms)


Quote:

// each function that is to be an operating system task must have the #task
// preprocessor directive located above it.
// in this case, the task will run every second, its maximum time to run must
// be less than or equal to the minor cycle,
and there is no need for a
// queue at this point, so no memory will be reserved.
#task(rate=1000ms,max=100ms)


I am totally confused what is given in the examples ... and what you replied...

I tried what you said ... minor_cycle=100ms & max=100ms... but still the problem is not solved......

Please help....
bwhiten



Joined: 26 Nov 2003
Posts: 151
Location: Grayson, GA

View user's profile Send private message

Different Timer
PostPosted: Sun Dec 30, 2007 3:11 pm     Reply with quote

Try using Timer1 or add a prescaler to Timer0. I think the timing duration of 1000ms using a 20MHz clock un-scaled is beyond the 8-bits available with Timer0. Timer1 is a 16 bit timer.

#use rtos(timer=1, minor_cycle=500ms)
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Sun Dec 30, 2007 8:50 pm     Reply with quote

It looks like my previous remark on the minor_cycle time was wrong. Like I said, I never used the RTOS before.

Just curious I spent a bit more time using a procedure you could have used as well. When looking for the cause of a problem it is good practice to start with something that is working and then part by part change it into the final product you want it to be. After every replacement you do a test. When the test fails most likely the last replaced part is causing your problems.

I took the first CCS example, it compiled. Then I changed the processor type from PIC18 to PIC16 and it failed with the same compiler error you got.
A difference between the PIC16 and PIC18 is that on the latter the TIMER0 can be configured to be 16 bit wide while the PIC16 only supports 8 bit. As Bwhiten suggested this can be solved by using timer1 instead of timer0.

Changing to a 16 bit timer is not enough to solve the problem, your 500ms setting still generates a timer overflow with the same compiler error.
When I changed the #rtos line to the one below I got a successful compilation:
Code:
#use rtos(timer=1,minor_cycle=100ms)
HOHOHAHA



Joined: 13 Apr 2007
Posts: 24

View user's profile Send private message AIM Address

Re: Different Timer
PostPosted: Sun Dec 30, 2007 10:45 pm     Reply with quote

bwhiten wrote:
Try using Timer1 or add a prescaler to Timer0. I think the timing duration of 1000ms using a 20MHz clock un-scaled is beyond the 8-bits available with Timer0. Timer1 is a 16 bit timer.

#use rtos(timer=1, minor_cycle=500ms)


Yes I already did it yesterday .. and it worked fine ...thanks to both of you .. for taking the pain to go through my codes.... Many Many thanks ...
HOHOHAHA



Joined: 13 Apr 2007
Posts: 24

View user's profile Send private message AIM Address

PostPosted: Sun Dec 30, 2007 11:02 pm     Reply with quote

I have a new problem now ... is this RTOS seriously lame .... ? If anyone have written a program within an infinite loop a little trickily then this RTOS features can be easily implemented without RTOS functions .... look at this code and the output...
Code:

#include "G:\program PIC\16f877A\real_rtos1.h"

#use rtos(timer=1,minor_cycle=50ms)

#task(rate=1000ms,max=50ms)
void read_IR( )
{
int j;
   for(j=0;j<5;j++)
   {
  printf("\n\rTirthankar Mukherjee");
   }
  //rtos_y();
}

#task(rate=600ms,max=50ms)
void read_IR1( )
{
  int i;
  printf("\nhello USA !");
  delay_ms(50);
  for(i=0;i<10;i++)
  {
  printf("\n\rCCS Rocks !!");
 
  }
 // rtos_terminate();
}

void main()
{

   setup_adc_ports(NO_ANALOGS);
   setup_adc(ADC_OFF);
   setup_psp(PSP_DISABLED);
   setup_spi(SPI_SS_DISABLED);
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
   //setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);
   setup_port_a( ALL_ANALOG );
   setup_adc( ADC_CLOCK_INTERNAL );
   set_adc_channel( 0 );
   set_tris_b(0xf0);
   rtos_run();
 

}


Now the Output ... please take the pain to go through it ...

Code:

OUTPUT

                                                                                                     
Tirthankar Mukherjee\0A                                                                                                   
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
                       hello USA !\0A                                                                                     
CCS Rocks !!\0A                      \0D                                                                                   
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
               hello USA !\0A                                                                                             
CCS Rocks !!\0A              \0D                                                                                           
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
Tirthankar Mukherjee\0A                                                                                                   
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
                       hello USA !\0A                                                                                     
CCS Rocks !!\0A                      \0D                                                                                   
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
               hello USA !\0A                                                                                             
CCS Rocks !!\0A              \0D                                                                                           
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
Tirthankar Mukherjee\0A                                                                                                   
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
                       hello USA !\0A                                                                                     
CCS Rocks !!\0A                      \0D                                                                                   
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
Tirthankar Mukherjee\0A                                                                                                   
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
                       hello USA !\0A                                                                                     
CCS Rocks !!\0A                      \0D                                                                                   
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
               hello USA !\0A                                                                                             
CCS Rocks !!\0A              \0D                                                                                           
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
Tirthankar Mukherjee\0A                                                                                                   
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
                       hello USA !\0A                                                                                     
CCS Rocks !!\0A                      \0D                                                                                   
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
               hello USA !\0A                                                                                             
CCS Rocks !!\0A              \0D                                                                                           
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
Tirthankar Mukherjee\0A                                                                                                   
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
                       hello USA !\0A                                                                                     
CCS Rocks !!\0A                      \0D                                                                                   
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
Tirthankar Mukherjee\0A                                                                                                   
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
                       hello USA !\0A                                                                                     
CCS Rocks !!\0A                      \0D                                                                                   
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
               hello USA !\0A                                                                                             
CCS Rocks !!\0A              \0D                                                                                           
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
Tirthankar Mukherjee\0A                                                                                                   
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
                       hello USA !\0A                                                                                     
CCS Rocks !!\0A                      \0D                                                                                   
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
               hello USA !\0A                                                                                             
CCS Rocks !!\0A              \0D                                                                                           
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
Tirthankar Mukherjee\0A                                                                                                   
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
                       hello USA !\0A                                                                                     
CCS Rocks !!\0A                      \0D                                                                                   
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
Tirthankar Mukherjee\0A                                                                                                   
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
                       hello USA !\0A                                                                                     
CCS Rocks !!\0A                      \0D                                                                                   
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
               hello USA !\0A                                                                                             
CCS Rocks !!\0A              \0D                                                                                           
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
Tirthankar Mukherjee\0A                                                                                                   
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
                       hello USA !\0A                                                                                     
CCS Rocks !!\0A                      \0D                                                                                   
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
               hello USA !\0A                                                                                             
CCS Rocks !!\0A              \0D                                                                                           
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
Tirthankar Mukherjee\0A                                                                                                   
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
                       hello USA !\0A                                                                                     
CCS Rocks !!\0A                      \0D                                                                                   
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
Tirthankar Mukherjee\0A                                                                                                   
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
                       hello USA !\0A                                                                                     
CCS Rocks !!\0A                      \0D                                                                                   
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
               hello USA !\0A                                                                                             
CCS Rocks !!\0A              \0D                                                                                           
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
Tirthankar Mukherjee\0A                                                                                                   
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
                       hello USA !\0A                                                                                     
CCS Rocks !!\0A                      \0D                                                                                   
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
               hello USA !\0A                                                                                             
CCS Rocks !!\0A              \0D                                                                                           
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
Tirthankar Mukherjee\0A                                                                                                   
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
                       hello USA !\0A                                                                                     
CCS Rocks !!\0A                      \0D                                                                                   
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
Tirthankar Mukherjee\0A                                                                                                   
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
Tirthankar Mukherjee\0A\0D                                                                                                 
                       hello USA !\0A                                                                                     
CCS Rocks !!\0A                      \0D                                                                                   
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!\0A\0D                                                                                                         
CCS Rocks !!   \0D                                                                                                         



In my code IR1() I used max=50ms ... and inserted a delay of 50 ms deliberately to check if the task would give any output or not ( as it that time it is getting delayed... and performing no job really) ... but the RTOS seems not to consider the delay_ms(50)... every time it gives more time to that task ... gets it completed though its max=50ms has been defined....

Am I thinking wrong ... and implementing it in a wrong way .... ??

Again lots of thanks to both of you .... "ckielstra"
and "bwhiten"
HOHOHAHA



Joined: 13 Apr 2007
Posts: 24

View user's profile Send private message AIM Address

PostPosted: Sun Dec 30, 2007 11:11 pm     Reply with quote

Quote:


Changing to a 16 bit timer is not enough to solve the problem, your 500ms setting still generates a timer overflow with the same compiler error.
When I changed the #rtos line to the one below I got a successful compilation:
Code:
#use rtos(timer=1,minor_cycle=100ms)


Very well said "ckielstra"thats where your experience comes to play ... and the mistake you did was very small ... you have already posted 1794 so providing quality time for everyone is tough .. I understand that... Thanks a lot .. Guys like you helps the newbies (like me) to move on !!


Last edited by HOHOHAHA on Sun Dec 30, 2007 11:14 pm; edited 1 time in total
bwhiten



Joined: 26 Nov 2003
Posts: 151
Location: Grayson, GA

View user's profile Send private message

Too much time in the task
PostPosted: Sun Dec 30, 2007 11:12 pm     Reply with quote

The delay_50ms inside a task that is supposed to take 50ms or less to complete is some of your problem. Also, multiple printf's inside can take many milliseconds to complete. If you look at the warnings in the documentation I think it states the RTOS cannot (will not) stop a task from running too long based on your max settings. You MUST ensure all tasks will take less time to run than their max settings or odd things will happen, such as skip some tasks or run them at the wrong repeat rate. Try simpler/faster tasks first to see if the code is running.
HOHOHAHA



Joined: 13 Apr 2007
Posts: 24

View user's profile Send private message AIM Address

PostPosted: Mon Dec 31, 2007 9:45 am     Reply with quote

ok, I understand that .. but what is the need of setting the value of "max" then ?.... why does the RTOS need it... are they fooling us ?
bwhiten



Joined: 26 Nov 2003
Posts: 151
Location: Grayson, GA

View user's profile Send private message

PostPosted: Mon Dec 31, 2007 10:34 am     Reply with quote

I'm not sure, other than to give you a point of reference to help make sure your task times are a total of less than the fastest rate time. If not then you will not always run the task with the minimum task rate. I think....... Smile
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