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

rtos_run & adc

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







rtos_run & adc
PostPosted: Fri Jan 26, 2007 2:48 pm     Reply with quote

Hii friends

I have two short questions

1- should I put rtos_run command in a do-while loop?

2- setup_adc_ports(AN0_TO_AN1 | VSS_VREF)

when I use the line above, should I apply a Vref+ voltage on AN3 pin?

thanks for any reply in advance...

hundil
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jan 26, 2007 6:08 pm     Reply with quote

Quote:
1- should I put rtos_run command in a do-while loop?

I scanned the compiler directory for 'rtos_run' with a text search tool.
It shows nine example files that call that function. None of them put
it in a do-while loop. Most of them just stick it in main(), with nothing
after it. However, one of the examples says this:
Code:

void main ( )
{
   // main is the best place to initialize resources the
   // rtos is dependent upon.
   counter = 0;
   rtos_run ( );
   // Once the rtos_terminate function has been called,
   // rtos_run will return program control back to main.
   printf("RTOS has been terminated\n\r");
}

So if you call the rtos_terminate() function, it will return.
In the example above, CCS then displays a message
and lets the code fall through the closing brace of main().
CCS puts a hidden Sleep instruction there, and because of
that, the PIC will then go to sleep (power down mode).
You have to decide if that's what you want to do.

To prevent the PIC from hitting that Sleep instruction,
it's common to put a while(1); statement at the end of main().

Quote:

2- setup_adc_ports(AN0_TO_AN1 | VSS_VREF)
when I use the line above, should I apply a Vref+ voltage
on AN3 pin?

Yes, you have to. Normally, the Vref+ is set to Vdd.
That's the default case. If you don't use Vdd, then you
must supply an external Vref+ voltage to pin AN3.
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