예제 #1
0
/* Read the ADC value and convert it to 8bits value */
Status Chip_ADC_Read_Byte(LPC_ADC_T *pADC, CHIP_ADC_CHANNEL_T channel, uint8_t *data)
{
	uint16_t temp;
	Status rt;

	rt = IP_ADC_Get_Val(pADC, channel, &temp);
	*data = (uint8_t) temp;

	return rt;
}
예제 #2
0
파일: IR_sharp.c 프로젝트: GIPdA/Hexapode
float fIR_sharp_GetValue(uint8_t channel)
{
	uint32_t  test;
	float calcul;

	IP_ADC_SetChannelNumber	(LPC_ADC,channel,1);

	IP_ADC_SetStartMode	(LPC_ADC, 1);	

	while(!IP_ADC_Get_Val(LPC_ADC,channel,&test));

	calcul=test;
	calcul=calcul/4096*3.3;
	calcul=calcul*0.0416666-0.0075;
	calcul=(1-calcul*0.42)/calcul;

	return calcul;
}