完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
你好,同事们,
我试着用YouPro(EVALKIT)和ActhoSACS712来测量交流电流,但我只能测量噪声。我使用的ADC SAR块与4.8VDC作为参考和非常快的采样(125kSAMPPLESPER秒)。ADC SAR块截图附上并附有代码: CysISR(ADCX-SARYA SEQUISISR){if(计数=0){min=4096;max=0;} Read Value= ADClSARYA SEQUGETRESULT16(0);//通道0将我的引脚连接到ACS712输出IF(Read Value&Gt;max)max=Read Valuy;IF(Read ValtualLt.Min)MIN=Read Value;Cl+++;If(Calt & Gt;= 25000)// 0.2秒{ MAP=2.5×(max min);//(1000×0.353×4800)/(4095×166)=2.5//1000是ATO MA,0.353来自VPP ToVRMS,48×MVISVREF,4095是分辨率的比特,166是MyACS712计数=0; 根本问题是马克斯和Min值总是几乎相同(0x5DANDX5B),不管哪种负载(无负载,30Ma,200 MAOR350MA)都是连接的。我认为ADC SAR不是真的采样这么快,这就是为什么我总是测量相同的,你们中有人知道会发生什么吗? 提前感谢, 彼得 AdCl 2Y1.PNG 43.5 K AdCl 1I1.PNG 81.3 K 以上来自于百度翻译 以下为原文 Hello colleagues, I am trying to measure AC current with your PRoC (Eval Kit) and the Allegro's ACS712 but I can just measure noise. I am using the ADC SAR Block with 4.8Vdc as reference and very fast sampling (125ksamples per second). The ADC SAR block screenshots are attached and below is the code: CY_ISR(ADC_SAR_SEQ_ISR) { if (count == 0) { min=4096; max=0; } readValue = ADC_SAR_SEQ_GetResult16(0); // Channel 0 is connected my pin to the ACS712 output if (readValue > max) max = readValue; if (readValue < min) min = readValue; count++; if (count >= 25000) // 0.2 seconds { mamp = 2.5*(max-min); // (1000*0.353*4800)/(4095*166)=2.5 // 1000 is A to mA, 0.353 is from Vpp to Vrms, 4800mV is Vref, 4095 are the bits of resolution and 166 is the mV/A given by my ACS712 count=0; } } The root problem is that Max and min values are always almost the same (0x5D and 0x5B), no matter which load (no load, 30mA, 200mA or 350mA) is connected. I think the ADC SAR is not really sampling so fast and that's why I measuring always the same, does any of you have an idea of what can be happening? Thanks in advance, Peter
|
|
相关推荐
19个回答
|
|
Odissey
我改变了PIN,结果是一样的,min和max总是2047。我加快了PIN的振荡器。我从未见过那些最小值和最大值改变值。我可以用范围和一个DMM进行一些并行测量。附加的,你可以观察到一个范围的屏幕截图,抱歉它很老,而且总是有很多噪音。我还用一个好的DMM进行测量: -当VDD IPROC=4.5,并且没有AC连接时,测量6MVRMS(AC)。这是在VDD=4.5的ACS芯片的预期噪声。 -当VDD IPROC=3.3且没有AC连接时,测量6MVRMS(AC)。这是在VDD=3.3的ACS芯片的预期噪声。 当VDD IPROC=4.5和AC负载约130MAIS连接时,测量一个非常固定的值18MVRMS(AC)。它应该是最小值和最大值之间的差值大约51。根据我的计算,这将是125Ma,或多或少OK… 在ADC的配置中,甚至在PRC中,它必须是非常基础的,你知道所有这些新信息会发生什么吗? 彼得 文氏镜 118.1 K 以上来自于百度翻译 以下为原文 Odissey, I changed the pin and the result is the same, min and max are always 2047. I speeded up the oscillator of the pin and the same. I have never seen those min and max changing the value. I could make some parallel measurement with the scope and a DMM. Attached you can observe a screenshot with the scope, sorry it is very old and it has a lot of noise always. I am also performing measurements with a good DMM: - When Vdd in PRoC= 4.5 and no AC is connected I measure 6mVrms (AC). This is the expected noise of the ACS chip at Vdd=4.5 - When Vdd in PRoC= 3.3 and no AC is connected I measure 6mVrms (AC). This is the expected noise of the ACS chip at Vdd=3.3 - When Vdd in PRoC= 4.5 and AC load of about 130mA is connected I measure a very fix value of 18mVrms (AC). It should be a difference between min and max of about 51. Following my calculations, this would be 125mA, what is more or less ok... It must be something very basic in the configuration of the ADC or even in the PRoC, do you have an idea of what can be happening with all this new information? Peter
|
|
|
|
彼得,在我的项目VIP必须在0至2.048 V范围内,以1.024V为中心。我将参考该项目,稍后您可以更改设置。霍尔传感器的输出以2.5V为中心,在输入范围之外。你需要用两个电阻或锅来缩小输出大约2.5倍。但是,第一次测试,以确保PRC是活着的是缩短输入引脚到地面,观察UART输出将达到最大~(2048)。另一个想法是,你可以通过运行其他程序来测试PRC的ADC是否仍然活着?
以上来自于百度翻译 以下为原文 Peter, In my project Vinp must be in range 0-2.048V, centered at 1.024V. I will refer to that project, while later you can change settings. The output of the Hall sensor is centered at 2.5V, which is outside input range. You need to scale down output about 2.5 times with a couple of resistors or pot. But first test to make sure that PRoC is alive is to short the input pin to the ground, an observe UART output going to max ~ min ~ (-2048). Other thought, can you test if PRoC's ADC is still alive by running some other program? |
|
|
|
nvwuwy 发表于 2019-1-22 19:06 奥迪西 ADC是活着的,因为我测试了DieTempBlock和我得到正确的温度值,即使加热和冷却。 回到这个项目,如果我遵循你的建议和缩小传感器的输出,我将失去2.5的灵敏度,什么不是项目的目标。为什么我不能使用VDD/2选项?我试过了,但也没用。你能用ACS712(例如从2到3V)的波形模拟你的身边,然后发给我操作码吗?这将是完美的, 提前感谢, 彼得 以上来自于百度翻译 以下为原文 odissey, ADC is alive since I tested with the DieTemp Block and I got the temperature value correctly even when heating up and cooling down. Coming back to this project, if I follow your recommendations and scale down the output of the sensor I will lost 2.5 sensitivity, what is not the goal of the project. Why I can not use the option VDD/2? I tried with that but it is not working either. Can you maybe simulate on your side with a waveform like the ACS712 (from 2 to 3V, for example) and send me the operating code? It would be perfect, Thanks in advance, Peter |
|
|
|
彼得,我也认为ADC是好的,你只是在2.048 V以上的限制。为了确认,断开霍尔传感器的输入并将其短路到地面,您必须看到Min=2047,max=2047。如果是这样的话,ADC工作正常,只是输入信号在范围之外。我将查看ADC设置,但为了快速测试,请将VREF从1.024V更改为VDDA/2。
以上来自于百度翻译 以下为原文 Peter, I also think that the ADC is fine, you are just above 2.048V limit. To confirm, disconnect input from Hall sensor and short it to the ground, you must see min= -2047, max =-2047. If that's the case, ADC working fine, it is just that the input signal is outside the range. I will look into ADC setting, but for quick test, please change Vref from 1.024V to Vdda/2. |
|
|
|
nvwuwy 发表于 2019-1-22 19:37 奥迪西,谢谢你的评论。我可以检查一下我用的两个别针是油炸的。我把PIN换成你的DEV套件的另一个表头,现在它正在工作。我甚至使用VDD / 2作为电压输入,我可以看到Ampl 20时,什么都没有连接,100时,什么东西连接,一切如预期。谢谢你四的支持,一切都好了。彼得 以上来自于百度翻译 以下为原文 Odissey, Thanks for your comment. I could check that the two pins I used were fried. I changed the pin to another header of your dev kit and now it is working. I am even using vdd/2 as voltage input and I can see Ampl 20 when nothing is connected and 100 when something is connected, everything as expected. Thanks four your support, everything is fine now. Peter |
|
|
|
我担心每秒25万次中断对于一个进程来说有点太难处理了。尝试对结果进行轮询。下次你可以发布你的完整项目,让我们都可以看看你的所有设置。要做到这一点,使用C造饰者和GT;文件-GT;创建工作区束(最小)并附加结果文件。
鲍勃 以上来自于百度翻译 以下为原文 I am afraid that 250 thousand interrupts per second are a bit too much to handle for a PRoC. Try polling for the result. Next time can you please post your complete project, so that we all can have a look at all of your settings. To do so, use Creator->File->Create Workspace Bundle (minimal) and attach the resulting file. Bob |
|
|
|
|
|
|
|
有一个API AcdIsIsDealTosig(),它查询或等待转换就绪。这将消除处理中断的开销。
鲍勃 以上来自于百度翻译 以下为原文 There is an API ADC_IsEndConversion() which queries or waits for conversion ready. This will remove the overhead for handling the interrupts. Bob |
|
|
|
谢谢你的友好评论。我会尝试,但我不认为它有助于解决这个问题。为了获得计算所需的最小值和最大值,我需要非常快速地读取电流传感器的输出。有了这个API,我将减少时间,但我不认为它能解决我的问题。你有另外的想法吗?
以上来自于百度翻译 以下为原文 Thanks for the kind comment. I will try but I don't think it helps solve the problem. I need to read very fast and many times the output of the current sensor in order to catch the minimum and maximum values needed for the calculations. With that API I will reduce timing but I do not think it solves my issue. Do you have an additional idea so I can try both? |
|
|
|
你可以使用DMA来加快速度,但是你所选的芯片可能没有配备。能否请您发布您的完整项目,以便我们都可以查看您的所有设置。要做到这一点,使用C造饰者和GT;文件-GT;创建工作区束(最小)并附加结果文件。
鲍勃 以上来自于百度翻译 以下为原文 You might use DMA to speed things up, but your selected chip might not be equipped with. Can you please post your complete project, so that we all can have a look at all of your settings. To do so, use Creator->File->Create Workspace Bundle (minimal) and attach the resulting file. Bob |
|
|
|
彼得,你想测量50/60Hz的有效值吗?
以上来自于百度翻译 以下为原文 peter, Are you trying to measure RMS of 50/60Hz main? |
|
|
|
是的,我将在今天下午上传整个项目。
以上来自于百度翻译 以下为原文 Yes odissey, I will upload this afternoon the whole project. |
|
|
|
请查找附件的源代码。一些描述:
PixTrac是激活一个三叉臂,AC可以到达负载。 -当没有负载连接时,我可以测量Max=2048和MIN=2047,这是预期的(动态范围的一半,在这种情况下12比特-gt;4096)。 当连接交流负载(即250mA)时,第一分钟和最大测量值与2047和2038值不同,这导致MAMP值为80, 130,170MbUt,这是随机变化的,它只是第一个值。第二、第三等值又是2047和2048,所以采样一定是错误的。 你知道会发生什么事吗? 提前感谢, 彼得 AcCurrurySysReloSurviv.Cyrjj.Access 01y0.Zip 1.1兆字节 以上来自于百度翻译 以下为原文 Please find attached the source code. Some descriptions: - Pin_Triac is to activate a Triac so the AC can get to the load. - When no load connected, I can measure max=2048 and min=2047 which is expected (Half of the dynamic range, in this case 12 bits -> 4096) - When connecting an AC load (i.e 250mA), the first min and max measurements are different from the 2047 and 2038 values, which results to mamp values of 80, 130, 170mA but this changes randomly and it is only the first value. The second, third and so on values are again 2047 and 2048 so something must be wrong with the sampling. Do you have any idea of what can be happening? Thanks in advance, Peter |
|
|
|
彼得,
附件是工作项目。我用KIT-044 M(PSOC4200 M)测试它,所以您可能需要重新分配引脚以匹配P4100-BLE。您可以玩ADC设置,目前输入范围设置为1.024 +/-1.024V(VREF=1.024是唯一真正的缓冲参考芯片)。终端窗口显示UART输出随输入正弦振幅的变化(从+/-0V到+/-1.024V) AcCurrnEngReloSoRo.02-0000 Cyrkk.Asvivi01.Zip 1.1兆字节 以上来自于百度翻译 以下为原文 peter, attached is working project. I tested it using KIT-044M (PSoC4200M), so you might need to re-assign pins to match P4100-BLE. You can play with ADC settings, currently input range is set to 1.024+/-1.024V (Vref=1.024 is the only real buffered reference on chip). Terminal window shows UART output changes sinchronously with input sine amplitude (from +/-0V to +/-1.024V) |
|
|
|
另一个评论:测量交流幅值测量由于不可避免的噪声贡献最大和最小电压不是好主意。标准的方式提取交流幅度从单频信号(如交流电源)是采用Goertzel滤波器算法,其中许多例子可以在网上找到的。尽管在处理4100有限的硬件选项,它具有快速、高效的CPU,可以处理这样的算法在飞。
http://www.embedded.com/design/configurable-systems/4024443/the-goertzel-algorithm 以上来自于百度翻译 以下为原文 Another comment: it is not good idea to measure maximum and minimum voltage for AC amplitude measurement due to the inevitable noise contribution. Standard way extracting AC amplitude from single-frequency signal (such as AC mains) is to apply a Goertzel filter algorithm, many examples of which can be found online. Despite limited hardware options in PRoC 4100, it has fast and efficient CPU, which can handle such algorithm on-the-fly. http://www.embedded.com/design/configurable-systems/4024443/The-Goertzel-Algorithm |
|
|
|
你好,奥迪西,
谢谢你的友好评论。我看到你在ADC块中选择了一个外部触发器HW,它是由引脚0Y0驱动的。我应该连接什么针?如果我把它打开,我得到的结果和以前一样。如果我在ADC块中选择自由运行,那么我从UART模块根本没有答案。仅仅为了你的信息,ACS712模块在交流电源频率(50或60Hz)之间传递一个0~5V的信号,我不知道这是否会成为ADC块中的一个问题,因为你选择了Vin(1.024V)作为Vref… 你能帮帮我吗? 提前感谢, 彼得 以上来自于百度翻译 以下为原文 Hello Odissey, Thanks for kind comment. I have seen you selected in the ADC Block an external trigger HW which is driven by the pin 0_0. What should I connect to that pin? If I leave it open, then I get the same results as before. If I select free running in the ADC Block, then I get no answer at all from the UART Module. Just for your information, the ACS712 Module is delivering a signal between 0-5V with AC Mains Frequency (50 or 60Hz), I don't know if this can be a problem in the ADC Block as you selected Vinternal (1.024V) as Vref... Can you help me here? Thanks in advance, Peter |
|
|
|
彼得,
ADC被设置为在外部选通模式下工作,以限制ISR呼叫的量到有意义的量。如果左自由运行,最小数量的ADC数据将是大约100k/s,这是不可能处理的。对于50/60 Hz交流,每周期有32个点就足够了,因此触发时钟设置为60x32~1.9kHz。 在P4时钟不能直接驱动ADC,所以标准过程是通过一个引脚将其转换成数字信号。不要连接那个PIN,让它打开(你可以检查一个信号范围)。 第一步将是运行上面提供的项目,并用输入AC信号在0到1V和偏移1.024 V和UART输出到终端的情况下观察它正常运行。然后修改它以适应你的目标。 以上来自于百度翻译 以下为原文 peter, The ADC is set to operate in external strobe mode to limit amount of isr calls to a meaningful amount. If left free-running, minimum amount of ADC data will be about 100k/sec, which is not possible to process. For 50/60 Hz AC, having 32 points per period is enough, so the trigger clock is set to 60x32~1.9kHz. In P4 clock can not drive ADC directly, so standard procedure is to pass it through a pin to convert it to digital signal. Do not connect that pin, leave it open (you may check with a scope that signal). First step would be is to run the project I supplied above and to observe it running properly with input AC signal in range 0 to 1V and offset 1.024 V and with UART output to terminal. Then modify it to suit you goals. |
|
|
|
你好,奥迪西,
谢谢你的友好解释。如果我只是通过更改PIN到我的PROC来运行你的代码,我得到这个UART输出: Ampl:0 MAX:2047分钟:2047 AMPL:0 MAX:2047分钟:2047 AMPL:0 MAX:2047分钟:2047 AMPL:0 MAX:2047分钟:2047 AMPL:最大:: 您确信代码与PROC一起工作吗? 你在用哪一个PSoC Creator?就我所记得的,我的原始代码与PSoC Creator 3.3差不多一年前工作得差不多了(至少它不是总是测量几乎相同的最小值和最大值)。 我还尝试了PSOC4和CYBL-012011,结果总是相同的。 期待您的反馈。 彼得 以上来自于百度翻译 以下为原文 Hello odissey, Thanks for the kind explanation. If I run your code just by changing the pinning to my PRoC, I get this UART output: Ampl: 0 max: 2047 min: 2047 Ampl: 0 max: 2047 min: 2047 Ampl: 0 max: 2047 min: 2047 Ampl: 0 max: 2047 min: 2047 Ampl: 0 max: 2047 min: 2047 Ampl: 0 max: 2047 min: 2047 Are you sure your code works with the PRoC? Which PSoC Creator are you using? As far as I remember my original code was working more or less fine with PSoC Creator 3.3 almost one year ago (at least it was not measuring always almost same min and max values). I also tried with a PSoC4 and the CYBL-012011 and the result is always the same. Looking forward to your feedback. Peter |
|
|
|
彼得,
我怀疑输入引脚没有连接或油炸。试着把它换成另一个别针。正如你从终端窗口看到的,当SigMi为零时,有小的噪声(7),但是当PIN是浮动的,那么2047是你将看到的。 以上来自于百度翻译 以下为原文 peter, i suspect that the input pin is either not connected or fried. Try to change it to another pin. As you see from terminal window, there is small noise (~7) when sigmai is zero, but when pin is floating, then 2047 is what you will see. |
|
|
|
只有小组成员才能发言,加入小组>>
754个成员聚集在这个小组
加入小组2106 浏览 1 评论
1853 浏览 1 评论
3671 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
1786 浏览 6 评论
1536 浏览 1 评论
CY8C4025LQI在程序中调用函数,通过示波器观察SCL引脚波形,无法将pin0.4(SCL)下拉是什么原因导致?
572浏览 2评论
CYUSB3065焊接到USB3.0 TYPE-B口的焊接触点就无法使用是什么原因导致的?
424浏览 2评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
438浏览 2评论
386浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
916浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-25 01:14 , Processed in 1.370911 second(s), Total 112, Slave 96 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号