|
|
View previous topic :: View next topic |
Author |
Message |
bfoster Guest
|
Problem with 'fast_io" |
Posted: Sat Nov 22, 2008 10:08 am |
|
|
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
|
Re: Problem with 'fast_io" |
Posted: Sat Nov 22, 2008 12:53 pm |
|
|
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 |
|
|
|
|
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
|