17.02.2015 Views

CCS C Compiler Manual PCB / PCM / PCH

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Returns:<br />

Function:<br />

Availability:<br />

Requires:<br />

Examples:<br />

Also See:<br />

None<br />

This function can only be used in an RTOS task. This function stops the<br />

execution of the current task and returns control of the processor to<br />

rtos_run(). When the next task executes, it will start it's execution on<br />

the line of code after the rtos_yield().<br />

All devices<br />

#USE RTOS<br />

void yield(void)<br />

{<br />

printf(“Yielding...\r\n”);<br />

rtos_yield();<br />

printf(“Executing code after yield\r\n”);<br />

}<br />

None<br />

set_adc_channel( )<br />

Syntax:<br />

Parameters:<br />

set_adc_channel (chan [,neg]))<br />

chan is the channel number to select. Channel numbers start at 0 and are labeled in<br />

the data sheet AN0, AN1. For devices with a differential ADC it sets the positive<br />

channel to use.<br />

neg is optional and is used for devices with a differential ADC only. It sets the negative<br />

channel to use, channel numbers can be 0 to 6 or VSS. If no parameter is used the<br />

negative channel will be set to VSS by default.<br />

Returns:<br />

Function:<br />

Availability:<br />

Requires:<br />

Examples:<br />

undefined<br />

Specifies the channel to use for the next read_adc() call. Be aware that you must wait a<br />

short time after changing the channel before you can get a valid read. The time varies<br />

depending on the impedance of the input source. In general 10us is good for most<br />

applications. You need not change the channel before every read if the channel does<br />

not change.<br />

This function is only available on devices with A/D hardware.<br />

Nothing<br />

set_adc_channel(2);<br />

delay_us(10);<br />

value = read_adc();<br />

264

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!