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 CCS Technical Support

RTOS and PIC18F2525

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



Joined: 07 Dec 2005
Posts: 10
Location: Italy

View user's profile Send private message

RTOS and PIC18F2525
PostPosted: Tue Dec 13, 2005 7:47 am     Reply with quote

Why the example code of ccs about rtos (for pic18f452) not work on pic18f2525. What's are the differences?
bernardinim



Joined: 07 Dec 2005
Posts: 10
Location: Italy

View user's profile Send private message

PostPosted: Wed Dec 14, 2005 2:34 am     Reply with quote

my rtos code not work.....
what is wrong in my code??
(I use a 32Mhz external clock)


#include <18F2525.h>
#device adc=8

#FUSES NOWDT //No Watch Dog Timer
#FUSES WDT128 //Watch Dog Timer uses 1:128 Postscale
#FUSES EC //External clock
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOIESO //Internal External Switch Over mode disabled
#FUSES BROWNOUT //Reset when brownout detected
#FUSES BORV20 //Brownout reset at 2.0V
#FUSES PUT //Power Up Timer
#FUSES NOCPD //No EE protection
#FUSES STVREN //Stack full/underflow will cause reset
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOLVP //Low Voltage Programming on B3(PIC16) or B5(PIC18)
#FUSES NOWRT //Program memory not write protected
#FUSES NOWRTD //Data EEPROM not write protected
#FUSES NOEBTR //Memory not protected from table reads
#FUSES NOCPB //No Boot Block code protection
#FUSES NOEBTRB //Boot block not protected from table reads
#FUSES NOWRTC //configuration not registers write protected
#FUSES NOWRTB //Boot block not write protected
#FUSES NOFCMEN //Fail-safe clock monitor enabled
#FUSES NOXINST //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#FUSES NOPBADEN //PORTB pins are configured as digital I/O on RESET
#FUSES NOLPT1OSC //Timer1 configured for low-power operation
#FUSES MCLR //Master Clear pin enabled



#use delay(clock=32000000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
#use rtos(timer=0,minor_cycle=100ms)

#task(rate=1000ms,max=100ms)
void The_first_rtos_task()
{
output_high(PIN_C0);
delay_ms(50);
output_low(PIN_C0);
}

#task(rate=500ms,max=100ms)
void The_second_rtos_task()
{
output_high(PIN_C0);
delay_ms(50);
output_low(PIN_C0);
}

void main()
{
int i;
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF|ADC_TAD_MUL_0);
setup_spi(FALSE);
setup_wdt(WDT_OFF);
setup_timer_0(RTCC_INTERNAL|0x40);
setup_timer_1(T1_INTERNAL);
setup_timer_2(T2_DISABLED,0,1);
setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
setup_low_volt_detect(FALSE);
setup_oscillator(False);
setup_oscillator(OSC_NORMAL);
printf("start\n\r");
set_timer0(0);
delay_ms(1000);
i=get_timer0();
printf("%d",i);
set_timer0(0);
delay_ms(1000);
i=get_timer0();
printf("%d",i);
rtos_run();


}


Can someone help me???
Guest








PostPosted: Wed Dec 14, 2005 7:46 pm     Reply with quote

does not work means ??

Your question is not complete.....
bernardinim



Joined: 07 Dec 2005
Posts: 10
Location: Italy

View user's profile Send private message

RTOS
PostPosted: Thu Dec 15, 2005 2:34 am     Reply with quote

The task not start... I tried different fuse configurations without success...
The strange thing is that the code work on PIC18F452 and not on PIC18F2525... I not know why... I think that rtos needs only a timer for schedule task...
cstan_02



Joined: 24 Jul 2005
Posts: 13

View user's profile Send private message

PostPosted: Thu Dec 15, 2005 7:43 pm     Reply with quote

Code:

set_timer0(0);
delay_ms(1000);
i=get_timer0();
printf("%d",i);
set_timer0(0);
delay_ms(1000);
i=get_timer0();
printf("%d",i);
rtos_run();


Have you tried assigning a different timer for RTOS, say timer 1 ??
I'm afraid that you may be using the timer0 that is being assigned to the RTOS.
Code:
#use rtos(timer=0,minor_cycle=100ms)
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