从pic24处理器读取ADC值 [英] read ADC values from pic24 processor

查看:103
本文介绍了从pic24处理器读取ADC值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过USB从pic24读取ADC值,并且需要将这些值转换为温度值.有人可以帮忙吗?

I am trying to read ADC values from pic24 through a usb and I need to convert the values to a temperature value. can anyone help?

推荐答案

我不知道您的pic24是否正在与PC对话,但是如果有,这是一个链接,可以帮助您入门不是:修改固件以使用C#.Net USB [ ^ ].您需要修复pic24编程中的一些代码,以使其响应来自PC的USB命令,并且本文为您提供了实现此目的的工具.

连接后,将USB端口视为串行端口,并且pic24应该以实物响应.

如果您已经进行了足够多的管理,并且只需要转换读取的值,那么它会容易得多. A/D转换器提供以伏特为单位的输出;根据用于感测温度的热电偶的类型,您可以简单地将电压读数乘以从热电偶的响应曲线中得出的适当数值.您可以在此处 [
I don''t know if you have your pic24 talking to the PC yet, but here''s a link to get you started, if not: Modify Firmware to use C#.Net USB[^]. You need to fix some of the code in the pic24 programming to make it respond to USB commands from the PC, and this article gives you the tools to do that.

Once you''re connected, treat the USB port as you would a serial port, and the pic24 should respond in kind.

If you''ve managed that much already, and just need to convert the values read, it''s much easier. The A/D converter provides an output in volts; depending on the type of thermocouple used to sense temperature, you simple multiply the volts reading by the appropriate number taken from the response curve of the thermocouple. You can find the data for the commonest thermocouples here[^]. Note that the temperatures are in Kelvin - add 273.16 to convert to Centigrade. Also note that the output voltage will be in millivolts; you''ll need to scale the pic24 values as needed.

If you don''t require extreme accuracy, I''d just create an array of value pairs and look up the closest match. If greater accuracy is required, you can interpolate between values, or grab a physics book and attempt to formulate an equation that you can make into a function.

Interesting device, the pic24 - I''m tempted to start playing with microcontrollers again. Thanks for the reminder! :-D


这篇关于从pic24处理器读取ADC值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆