Other Parts Discussed in Thread: HALCOGEN
Hi,
Can you send me the code used in 'Hercules How to Tutorial: 12bit ADC' because I am unable to read it from the video due to the poor clarity.
Many thanks,
Shiromini
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi,
Can you send me the code used in 'Hercules How to Tutorial: 12bit ADC' because I am unable to read it from the video due to the poor clarity.
Many thanks,
Shiromini
void main(void){
adcData_t adc_data; //ADC Data Structure
adcData_t *adc_data_ptr = &adc_data; // ADC Dat Pointer
unsigned int NumberOfChars, value; // variables
sciInit();
adcInit();
while(1)
{
adcStartConversion(adcREG1, adcGROUP1); // Start ADC conversion
while(!adcIsConversionComplete(adcREG1, adcGROUP1)); // wait for ADC conversion
adcGetData(adcREG1, adcGROUP1, adc_data_ptr); //Store conversion into ADC pointer
value = (unsigned int)((*adc_data_ptr).value);
NumberOfChars = ltoa(value, (char *)command);
sciSend(scilinREG, 2, (unsigned char *)"0x");
sciSend(scilinREG, NumberOfChars, command);
sciSend(scilinREG, 2, (unsigned char *)"\r\n");
}
}
You do not have to write notification functions because they are included in notification.c file which is generated by HalCoGen automatically.