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

Problem with 'fast_io"

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







Problem with 'fast_io"
PostPosted: Sat Nov 22, 2008 10:08 am     Reply with quote

I am having a problem using the fast_io directive. I am trying to blink two LEDs, one on A0 and the other on A1. When I '#use standard_io(all)', everything works great. When I '#use fast_io(all)' and include ' set_tris_a(0xC0) in the Do...While loop in Main, the outputs don't toggle.

I am working with a 16F871 with Compiler version 4.082.

Any suggestions would be greatly appreciated!!

Thanks,
Code:
 
#include "C:\Test Project\main.h"
#use rtos(timer=0,minor_cycle=100us)
//#use fast_io(all)
#use standard_io(all)

byte Blinker,BlinkOut;
byte Blinker1,BlinkOut1;


#task(rate=100us,max=100us)
void Handler();
#task(rate=250ms,max=100us)
void Blink();

void Blink() {
   ++Blinker;
   BlinkOut = Blinker & 0x01;
   If (BlinkOut == 0)
      Output_Bit(Pin_A0,0);
   else
      Output_Bit(Pin_A0,1);
}

void Handler () {
   ++Blinker1;
   BlinkOut1 = Blinker1 & 0x01;
   If (BlinkOut1 == 0)
      Output_Bit(Pin_A1,0);
   else
      Output_Bit(Pin_A1,1);
}

void main()
{

   setup_adc_ports(NO_ANALOGS);
   setup_adc(ADC_OFF);
   setup_psp(PSP_DISABLED);
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);

   // TODO: USER CODE!!
   rtos_run();
   
   
   do {
//   set_tris_a(0xC0);

   }while (1);
   
}
RLScott



Joined: 10 Jul 2007
Posts: 465

View user's profile Send private message

Re: Problem with 'fast_io"
PostPosted: Sat Nov 22, 2008 12:53 pm     Reply with quote

Just a guess, but I think that when you call rtos_run() in the main program, the main program is suspended until the rtos shuts down. Therefore your set_tris_a is never executed. Call set_tris_a just once before calling rtos_run().

As for getting rid of your e-mail, you can do that yourself. Just click on "Profile" at the top the page and edit your own profile. Uncheck the box that says "Always show e-mail address.". If that doesn't work retroactively, then just delete the first posting entirely. Do that by clicking on the "X" on the right of the posting.
_________________
Robert Scott
Real-Time Specialties
Embedded Systems Consulting
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