完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
你好!我使用PSoC CY8C29 466的DelSig和三输入增量ADC。ADC都被设置为签名的数据格式。输入到ADCs的数据来自传感器,传感器本身具有1V到4.9 V之间的输出值。
Delsig被设置为3 MHz时钟频率,脉冲宽度为10。三输入ADC被设置为ADC分辨率为13位,Calc时间为400, 3 MHz时钟频率。 我想知道什么是C代码来改变ADC值为十进制值(基数为10)。 谢谢您! 以上来自于百度翻译 以下为原文 Hello! I am using PSoC CY8C29466's DelSig and Triple input incremental ADC. Both ADC is set to data format as signed. The data input into ADCs is from sensor which the sensor itself have output value between 1V to 4.9 V. Delsig is set to 3 MHz clock frequency and Pulse width is 10. Triple input ADC is set to ADC resolution of 13 bit, Calc time 400, 3 MHz clock frequency. I want to know what is the C code to change the ADCs value into decimal value ( base number of 10). Thank you! |
|
相关推荐
6个回答
|
|
有两种可能性可以做到这一点:
自己做:当你把数字除以10时,余数将给出最后一个数字(0。9),重复直到Nube为零为止。 使用ITOA宏 使用CSPrTNF(缓冲区,“%D”,数字) 使用液晶显示模块的打印功能 快乐解码 鲍勃 以上来自于百度翻译 以下为原文 There are a couple of possibilities to do that: Do it yourself: when you divide the number by 10, the remainder will give the last digit (0..9), repeat until nuber is zero Use itoa macro Use csprintf(Buffer,"%d',Number) Use Print-function of LCD-module Happy de-coding Bob |
|
|
|
ITOA宏是什么?有人能振作起来吗?另一个附加的事情是ADC输出值被转换成十进制值,这个十进制值被用作数据来计算传感器的测量值。进行了标定,获得了将测量电压转化为实测pH值的方程。例如,pH传感器,当读数的输出为3V时,它代表pH 12。所以,我想知道下面的代码能从ADC获得我的测量电压值吗?由于我使用传感器的测量电压来计算测量的传感器值,所以我想知道这些代码是否能够恢复测量的电压值。
pH传感器可检测pH 0至pH 14,传感器电压输出值为1.04 V至4.94 V,最低电压代表pH 0,最高pH代表较高电压。PHADC=TrAdCc11IGETDATA2();/ /从ADC PHDEC=(PHADC)读取数据0.001221001221;/ /将数据从ADC转换为十进制值 PH=(3.683×PHDEC)-4.403;/ /用十进制值计算测得的pH值 谢谢您! 以上来自于百度翻译 以下为原文 What is itoa macro? Can somebody elobrate? Another addition thing is that the ADCs output values which is converted to decimal values;this decimal values is used as data to calculate the measured value of the sensor. I have done the calibration, and acquired the equation to convert the measured voltage into measured pH value. For example, the pH sensor, when the output of the reading is 3V, it represent pH 12. So, I am wondering do the codes below can get my measured voltage value from ADC? Since I am using the measured voltage of sensor to calculate the measured sensor value, I am wondering whether the codes can get back the measured voltage value. The pH sensor can detect pH 0 to pH 14, sensor voltage output values is 1.04 V to 4.94 V with the lowest voltage represent pH 0 and highest pH represent the higherst voltage. pH_adc = TRIADC_1_iGetData2(); // read data from ADC pH_dec=(pH_adc)*0.001221001221; // convert the data from ADC to decimal values pH = (3.683 * pH_dec)-4.403; // calculate the measured pH value from decimal values Thank you! |
|
|
|
我不能测试你的校准数字(虽然可能有一些错误),但是你忘了等待准备好的样本。取决于您的ADC,它将类似于ADCJFISDATAAvabable()和ADCJGETDATACALLID(),与数据表联系。
对于数学:你有一个线性函数,它是F(x)=AX+B。所以你必须进化A和B。一个乘法和一个加法将给你所需的PH值。据我所知,电压是温度依赖的,这可能带来另一个术语。 当一切都工作时,考虑校准例程并将参数存储在EEProm中。 快乐测量 鲍勃 以上来自于百度翻译 以下为原文 I cannot test your calibration-numbers (although there might be some error) but you forgot to wait for a sample beeing ready. Depending on your ADC it will be something like ADC_fIsDataAvailable() and ADC_GetDataClearFlag(), contact the datasheet. For the Math: you have got a linear function which is f(x) = ax +b. So you have to evolve a and b. One multiplication and one addition will give you the desired Ph. As far as I know the voltage is temperature-dependent which might bring in another term. When later everything works, think of a calibration-routine and storing the parameters in EEProm. Happy measuring Bob |
|
|
|
对不起,忘了ITOA。
联系你的C编译器手册(帮助&文档;文档…&编译器和编程文档-GT;C语言COM… 在“ATOI”的PDF搜索(CTRL—F)中 鲍勃 以上来自于百度翻译 以下为原文 Sorry, forgot itoa. Contact your C-compiler handbook (Help -> Documentation... -> Compiler and Programming Documents -> C Language Com... In the PDF search (CTRL-F) for "atoi" Bob |
|
|
|
下面的文章有ITOA的示例代码。
HTTP://www. PrimePoSo.COM/Calpand汇编和C/9转换-AN-ICONTION-ASCII.HTML. 最好的问候, 加内什 PSoC Hacker 以上来自于百度翻译 以下为原文 The article below has example code for itoa. http://www.planetpsoc.com/programming-assembly-and-c/9-converting-an-integer-to-ascii.html Best Regards, Ganesh The PSoC Hacker |
|
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
716个成员聚集在这个小组
加入小组1901 浏览 1 评论
1652 浏览 1 评论
3405 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
1568 浏览 6 评论
1380 浏览 1 评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
186浏览 2评论
183浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
321浏览 2评论
349浏览 1评论
62浏览 1评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-4-24 14:21 , Processed in 0.638801 second(s), Total 79, Slave 63 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号