Hi,
I want realize the single channel data simpling by adc, and there is just a simple about adcdisplay in HAL.
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,
I want realize the single channel data simpling by adc, and there is just a simple about adcdisplay in HAL.
Hi,
Firstly,Thanks for your reply.
I find the example named adcDisplay in HAL-software example package.After analysing this example,and I have some
questions about it. I hope that you can give me some answers with your experience.
The follows is one part of the main code:
while(1) /* ... continue forever */
{
/* trigger using gio port b, pin 0 */
gioSetBit(gioPORTB, 0, 1);
/* ... wait and read the conversion count */
while((adcIsConversionComplete(adcREG1,adcGROUP1))==0);
ch_count = adcGetData(adcREG1, adcGROUP1,&adc_data[0]);
/* conversion results : */
/* adc_data[0] -> should have conversions for Group1 channel1 */
/* adc_data[1] -> should have conversions for Group1 channel2 */
id = adc_data[0].id;
value = adc_data[0].value;
gioSetBit(gioPORTB, 0, 0);
//通过sci进行输出
UartPrintf("CH.ID=%2x\tValue=%12d\r\n",id,value);
id = adc_data[1].id;
value = adc_data[1].value;
UartPrintf("CH.ID=%2x\tValue=%12d\r\n",id,value);
wait(0xFFFFFF);
};
Questions:
Q1,I know that the adc1 is triggering by GIOB0 with set the output of GIO pin high.And what I confused is that the
connection between GIO and ADC? or what is the process between set GIO to high with ADC works? There is a signal which GIO
send to ADC or the ADC checks the status of the GIO0?
Q2,Is it a hardware Triggling about setting GIO high? And Can you show me the other methods to trigger the adc works
such as SW_Interrupt、Clock and DMA and so on.
3,The follow is the function of adcGetData():
if(mode == ADC_12_BIT_MODE)
{
/** - Get conversion data and channel/pin id */
for (i = 0U; i < count; i++)
{
buf = adc->GxBUF[group].BUF0;
/*SAFETYMCUSW 45 D MR:21.1 <APPROVED> "Valid non NULL input parameters are only allowed in this driver" */
ptr->value = (uint16)(buf & 0xFFFU);
ptr->id = (uint32)((buf >> 16U) & 0x1FU);
/*SAFETYMCUSW 567 S MR:17.1,17.4 <APPROVED> "Pointer increment needed" */
ptr++;
}
}
Q3,The code use for-loop to get the data and store into a array.the main code is buf = adc->GxBUF[group].BUF0; I run
step by step to check the data, and everytime the data is different, I don't know the reason. And during the circulation,the
value of the INTCR is changed from 14 to 16 circularly.I hope that you can give me some answers.
Q4,At the same time, Every cycle of the main code, the INTFLG set to 8.If there is not the gioSetBit(gioPORTB, 0, 0),
the value of the INTFLG is 4, and in next cycle it will in the while((adcIsConversionComplete(adcREG1,adcGROUP1))==0)
always.What I want to know is that the trigger is the status or the process of polling up and polling down?
If you can give me the answer and I will be appreciate it very much, and I will wait for your reply with regards.
thanks!
Hi,Anthony
Thanks for your reply.After learning from your answers, it is more light
about the process of hardware event-triggered.
I am using the board of TMS570LS3137, And I know that there are some other
methods to realize the Single Channel Data Simpling.
In the former answers, you make mention of the software triggered.And now, I want to use the other meathods to realize it.
In the future, I want to realize the SoftWare Check and DMA Check triggered.
Could you tell me that the process of them and Is there an example about it? I have found in the DataSheet Document, and find nothing about the realization methods. If it is convenient for you, Please give me a process in detail or some useful documents. thanks.