beautypg.com

Renesas RJJ10J1643-0101 User Manual

Page 19

background image

Rev.1.01 2007.02.16
RJJ10J1643-0101

17

Program example

#include "rapi_ad_r8c_13.h"

void main( void )
{
unsigned int status, data;

/* Set up A/D converter as one short mode */
__CreateADC( RAPI_ONE_SHOT|RAPI_AN0|RAPI_FAD2|
RAPI_WITH_SAMPLE_HOLD|
RAPI_AD_OFF|RAPI_10BIT, 1, 0, 0 );

while( 1 ){
/* Disable A/D converter */
__EnableADC( RAPI_AN0| RAPI_AD_ON, 1 );

/* Check a flag bit of A/D converter interrupt */
do{
__GetADCStatus( &status );
} while( (*status & 0x0001) == 0 )

/* Get A/D convertered datas of A/D register */
__GetADC( &data );

/* Clear status of A/D convertered */
__ClearADCStatus( 0 );
}
}