示例#1
0
void processMat() {
    int i;
    int j;
    for (i = 0; i < HEIGHT; ++i) {
        for (j = 0; j < WIDTH; ++j) {
            configureMat(i,j);
            // Start ADC conversion. Wait for next value, then stop conversion.
            ADC_SAR_1_StartConvert();
            ADC_SAR_1_IsEndConversion(1);
            adcResult = ADC_SAR_1_GetResult16();
            ADC_SAR_1_StopConvert();
            adcValues[i * WIDTH + j] = cV(adcResult);

        }
    }
}
示例#2
0
/*******************************************************************************
* Function Name: main
********************************************************************************
*
* Summary:
*  Main function performs following functions:
*   1. Start the LCD and PWM
*   2. Print 'Hello World' on the LCD
*
* Parameters:
*  None.
*
* Return:
*  None.
*
*******************************************************************************/
int main()
{
	/* Start LCD and PWM */
	LCD_Char_Start();
	PWM_Start();
	
	/* Print Hello World on LCD */

    /* Loop forever */
    char vout[15] = {'\0'};
	for(;;)
    {
        // TODO: get voltage at pot and control period of PWM using
        // PWM_WritePeriod(period)
        sprintf(vout, "%f", ADC_SAR_1_GetResult16());
        LCD_Char_PrintString(vout);
        vout[0] = '\0';
        
    }
}