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 />

Function:<br />

Availability:<br />

Examples:<br />

Example<br />

Files:<br />

Also See:<br />

To poll the SDRDY bit and if set return the signed 32 bit value stored in the<br />

SD1RESH and SD1RESL registers, and clear the SDRDY bit. The result<br />

returned depends on settings made with the setup_sd_adc() function, but will<br />

always be a signed int32 value with the most significant bits being meaningful.<br />

Refer to Section 66, 16-bit Sigma-Delta A/D Converter, of the PIC24F Family<br />

Reference <strong>Manual</strong> for more information on the module and the result format.<br />

Only devices with a Sigma-Delta Analog to Digital Converter (SD ADC) module.<br />

value = read_sd_adc()<br />

None<br />

setup_sd_adc(), set_sd_adc_calibration(), set_sd_adc_channel()<br />

realloc( )<br />

Syntax:<br />

Parameters:<br />

Returns:<br />

Function:<br />

Availability:<br />

Requires:<br />

Examples:<br />

realloc (ptr, size)<br />

ptr is a null pointer or a pointer previously returned by calloc or malloc or<br />

realloc function, size is an integer representing the number of byes to be<br />

allocated.<br />

A pointer to the possibly moved allocated memory, if any. Returns null<br />

otherwise.<br />

The realloc function changes the size of the object pointed to by the ptr to the<br />

size specified by the size. The contents of the object shall be unchanged up to<br />

the lesser of new and old sizes. If the new size is larger, the value of the newly<br />

allocated space is indeterminate. If ptr is a null pointer, the realloc function<br />

behaves like malloc function for the specified size. If the ptr does not match a<br />

pointer earlier returned by the calloc, malloc or realloc, or if the space has<br />

been deallocated by a call to free or realloc function, the behavior is undefined.<br />

If the space cannot be allocated, the object pointed to by ptr is unchanged. If<br />

size is zero and the ptr is not a null pointer, the object is to be freed.<br />

All devices<br />

#INCLUDE <br />

int * iptr;<br />

iptr=malloc(10);<br />

realloc(iptr,20)<br />

// iptr will point to a block of memory of 20 bytes, if available.<br />

251

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

Saved successfully!

Ooh no, something went wrong!