17.02.2015 Views

CCS C Compiler Manual PCB / PCM / PCH

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Built-in Functions<br />

ready to be read. For example a return value of 0x0041 means that ADC pair 6,<br />

AN12 and AN13, and ADC pair 0, AN0 and AN1, are ready to be read.<br />

Function:<br />

Availability:<br />

Requires:<br />

Examples:<br />

Can be polled to determine if the ADC has valid data to be read.<br />

Only on dsPIC33FJxxGSxxx devices.<br />

None<br />

int16 result[2]<br />

setup_high_speed_adc_pair(1, INDIVIDUAL_SOFTWARE_TRIGGER);<br />

setup_high_speed_adc( ADC_CLOCK_DIV_4);<br />

read_high_speed_adc(1, ADC_START_ONLY);<br />

while(!high_speed_adc_done(1));<br />

read_high_speed_adc(1, ADC_READ_ONLY, result);<br />

printf(“AN2 value = %LX, AN3 value = %LX\n\r”,result[0],result[1]);<br />

Example<br />

Files:<br />

Also See:<br />

None<br />

setup_high_speed_adc(), setup_high_speed_adc_pair(),<br />

read_high_speed_adc()<br />

i2c_init( )<br />

Syntax:<br />

Parameters:<br />

Returns:<br />

Function:<br />

Availability:<br />

Requires:<br />

Examples:<br />

Example Files:<br />

i2c_init([stream],baud);<br />

stream – optional parameter specifying the stream defined in<br />

#USE I2C.<br />

baud – if baud is 0, I2C peripheral will be disable. If baud is 1, I2C<br />

peripheral is initialized and enabled with baud rate specified in #USE I2C<br />

directive. If baud is > 1 then I2C peripheral is initialized and enabled to<br />

specified baud rate.<br />

Nothing<br />

To initialize I2C peripheral at run time to specified baud rate.<br />

All devices.<br />

#USE I2C<br />

#USE I2C(MASTER,I2C1, FAST,NOINIT)<br />

i2c_init(TRUE); //initialize and enable I2C peripheral to baud<br />

rate specified in //#USE I2C<br />

i2c_init(500000); //initialize and enable I2C peripheral to a<br />

baud rate of 500 //KBPS<br />

None<br />

199

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

Saved successfully!

Ooh no, something went wrong!