完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,所有的,我试图控制方向的马达向前或BouWald,我发出信号,通过使用DACOF电位器。我正在研究CY8CY4C6464-24SXI。
如果有人能帮助我找出如何控制这将是伟大的。 谢谢 以上来自于百度翻译 以下为原文 HI all, i am trying to control the direction of the motor forward or bacward, i am giving out signal, by using DAC from Potentiometer. i am working on KIT number CY8C29466-24 SXI. If anyone can help me to figure out how to control that would be great. Thanks |
|
相关推荐
50个回答
|
|
正如鲍伯提到的。最好有一个合适的调试工具来进行开发。
如果那不是假的。你可以做的事情是使用UTART和232接口,使用PrIFTF类型的消息到PC。 在程序中插入PuxStudio或PutChar,这样你就可以从PC超级终端看到它。 我也建议你一步一小步。 1。确保你能以固定的速度控制马达的速度。 2。做一个简单的循环,慢慢地增加或降低速度。 三。做一个可以改变方向和改变速度的循环。 4。生成PSEDIO序列,即达到1秒至1/2的速度。2秒逆转全速… 5。编写代码正确读取按钮与DeBung。 6。把它们结合起来。 一步一小步做会节省你的时间。 以上来自于百度翻译 以下为原文 As Bob mentioned. it would be much better to have a proper debugging tools for development. If that is not possilbe. One thing you can do is condigurate a UART and with a 232 interface, use priftf type message to a PC. insert putstring or putchar in your program so you can see it from the PC hyperterminal. I would also suggest you to do one little step a time 1. make sure you can control the speed of the motor with a fixed speed. 2. make a simple loop that increase or decrease the speed SLOWLY. 3. Make a loop that can change direction and change speed. 4. Generate pseduo sequence, ie make 1 sec up to 1/2 speed. 2 sec to reverse full speed... 5. Write code to read button correctly with debounce. 6. Combine that together. Doing it one small step a time would save you time in the end.. |
|
|
|
正如我刚才问的,你能给我们提供一个示意图(Drawinng,图片)你的外部连接到马达(或者你仿效马达)。我想可能有些误会。
有了您提供的代码,抱歉,但这个论坛软件有时根本无法正确地处理代码,似乎有很多是无序的,所以我不会评论它。 鲍勃 以上来自于百度翻译 以下为原文 As I asked a while ago, can you please supply us with a schematic (Drawinng, picture) of your external connections to the motor (or however you emulate the motor). I think there may be some misunderstanding. With your supplied code , sorry but this forum-software sometimes is not able at all to handle code correctly there seems a lot to be out of order so I will not comment it. Bob |
|
|
|
好的,我附上了我的图表。基本上我有两个数字输入,一个用于电源,另一个用于方向。输出将用于使电机运行,方向,速度,并监测回计时器输入捕获,并采取它,并比较它的频率与输出的RPM频率。我用电位器控制速度。
以上来自于百度翻译 以下为原文 ok, i attached my diagram. basically i have two digital inputs, one for power and other for direction. and the output will be for enable to let motor run, direction, speed, and monitor back the timer input capture which take it and compare the frequency of it to the output RPM frequency. i control the speed by Potentiometer. |
|
|
|
我的代码中唯一的问题是,一旦我把开关从CW切换到CWW,它立刻转向(它应该等到速度减慢到零,然后转向,然后再加速)。
我有CY32 15-DK和I调试代码,但我只问如何使位不改变,等到速度变为零。 无论如何谢谢你的帮助 车轮快速固定装置 486.7 K 以上来自于百度翻译 以下为原文 my only problem in my code is, once i change the switch from CW to CCW, it turns direction right away ( it should wait till the speed slow down to zero then turn direction then speed back up again).. i have CY3215- DK and i debugged code, but i only asked for how to make the bit dont change and wait till speed goes to zero. Thanks anyway for help
|
|
|
|
看看这个,在页面底部引用。
HTTP://E.WiKiTo.Org/Wik/HyBigByt 有许多制造H桥的制造商, 包括过热和过电压,过电流保护,并包括 偏置泵使TTL兼容。 问候,Dana。 以上来自于百度翻译 以下为原文 Take a look at this, and references at bottom of page. http://en.wikipedia.org/wiki/H_bridge There are a number of manufacturers that makes H Bridges, which include thermal and overvoltage, over current protection, and include the bias pumps to make them TTL compatible. Regards, Dana. |
|
|
|
好的,我想我理解了。明天回来(这里是23点00分)
鲍勃 以上来自于百度翻译 以下为原文 OK, I think I understood. Will be back tomorrow (it's here 23:00h) Bob |
|
|
|
我附上的项目和应该如何,基本上,我通过一个工具包控制电机。我有2个开关,一个用于运行或停止连接到P01的电机,另一个用于CW或CWW,以控制连接到P00的电机的方向。我已经连接到端口0到7,输出到PORT-5。
我想测量电机的频率,并将输出频率与PRM输出进行比较。因此,当开关运行时,它从零开始逐渐增加直到锅的值,并且当我切换CW到CW时,电机的速度应该减小到零,然后切换方向,然后从零开始增加到PoalValk,而电机运行或停止时,我可以。改变锅的价值。当我切换到停止时,应该将速度降低到零。 如果你看一下我所附的代码,你会发现我想通过增加速度或减慢速度来控制速度,也可以切换,并且能够在运行时改变它的值,这可能就是为什么我一直在使用我的代码,因为我几乎在那里。小虫子。 请看附件。 谢谢 音调轮组件 51.5 K 以上来自于百度翻译 以下为原文 i attached the project and how should look like, basically i am controlling a motor through the KIT. i have 2 switches, one is for RUN or STOP the motor which is connected to P01, and other is for CW or CWW to control the direction of the motor connected to P00. i have POT connected to PORT 0-7 and the output to PORT 0-5. i want to measure the frequency of the speed of the motor and compare the output frequency to the PRM out. so when the switch on RUN, it starts from zero slidly increase until value of POT, and when i switch CW to CCW, the motor's speed should decrease till it gets to zero then switch the direction and then from Zero it starts increase till the POT value,, while the motor is running or stop i can be able to change the value of the POT. and when i switch to STOP, it should decrease the speed to Zero. if you look at the code that i had and attached, you will see that i want to get control of the speed by incrementing the speed or decrement the speed and also switches and be able to change the value of the POT while its running, may be that why i was keep using my code because i am almost there just little bugs. please look at the attachments. Thanks
|
|
|
|
1、不要使用CW并直接从端口运行,如果这些是键开关,则应该去抖动。
2。主变量中的静态变量是没有用的。 三。每个循环只需要读取一次锅值。 4。在启动程序之前,你有什么样的流程图或状态图吗?程序和你的设计一样吗? 从表面上看,这似乎是一个学生项目。 要求人们提出建议是可以的。 我知道有些老师会去检查学生是否让别人完成作业。我在其他论坛上看到了这一点。 以上来自于百度翻译 以下为原文 1. Do not to use the CW and RUN direcly from the port, If those are key switches, it should be debounce. 2. A static variable in main is no use. 3. you should only need to read the pot value once per loop. 4. Do you have some kind of flow chart or state diagram before you start the program, is the program same as your desing? By the look of it, it seems to be a student project. It is OK to ask people to have suggestions. I know some teachers would go around to check if students are getting others to finish their homework. I saw that happended in other forums. |
|
|
|
这个方向是一个数字信号,你可以通过写入相应的端口位来控制。注意阅读修改写问题,最好使用影子寄存器。请看这里的HTTP://www. CyPress。ID=4和;RID=25251,这里是HTTP://www. CyPur.com/?RID=39497
当你有一个工具包时,通常会有一些LED。您可以使用LED组件来切换端口位并指示它。你甚至可以使用这个结构来切换马达方向。 鲍勃 以上来自于百度翻译 以下为原文 The direction is a digital signal which you can control by writing to the corresponding port-bit. Take care of the read-modify-write problem, best use a shadow-register. Look here http://www.cypress.com/?id=4&rID=28251 and here http://www.cypress.com/?rID=39497 When you've got a kit there are usually some LEDs on it. You may use the LED-component to switch a port-bit and have it indicated. You even may use this construct to switch the motor-direction. Bob |
|
|
|
现在用DIARGAM对我来说更清楚了!稍后我会再来一些信息。
博伊布 以上来自于百度翻译 以下为原文 Now with the diargam there is a lot more clear to me! I'll come back with some more info later. Boib |
|
|
|
由于您使用的是PSoC1,而您没有告诉我们有一个ICE(电路模拟器),您将不得不建立一个最小的人机通信,以获得一点点的洞察力正在发生在您的芯片。最小的是一对LED,你可以打开或关闭,如果你的工具包有一个液晶模块,你可以使用它。
最好是在小步骤中工作,实现一个接一个的块,测试它并集成它。有时,更容易单独构建项目的一部分,使其得到测试,然后将其集成到项目中(并再次测试)。 因为你还要学习一些编程技巧,最好是frequentlyupload您的项目在这里,所以我们可以看看,有一个坚硬的东西上diskuss。 所以首先我建议您设置您的测试环境(LED / LCD)。 然后将你的输入信号和核实每一个让你看 连接你的输出信号和看到,你可以设置他们progammatically。 文件连接!!!! 既然我们要读你的程序,试图使它看起来容易,使用的姓名,说自己(Idata并不好,使用adc_value)清晰压痕和注释来解释你在做什么。使用函数调用,使得整个项目更容易被忽视,甚至可以节省宝贵的内存:使用函数“void initializehardware(void)”,称这main()将显示在所有相关的东西去了main()的非常重要的部分。 快乐编码 鲍勃 以上来自于百度翻译 以下为原文 Since you are using a PSoC1 and you did not tell us about having got an ICE (In-Circuit-Emulator) you will have to set up a minimum man-machine-communication to get a little bit of insight what is going on within your chip. The minimum is a couple of LEDs you may turn on or off, if your kit has got an LCD-module, you can use that. Best will be to work in little steps, realizing one block after the other, testing it and integrating it. Sometimes it will be easier to build a part of the project separately, get it tested and then integrate it into the project (and test it again). Since you still have to learn some programming skills, best is to frequently upload your project here, so that we can have a look at and having something solid to diskuss on. So at first i suggest you to set up your test-environment (LEDs/LCD). then Connect your input-signals and verify each of them getting seen in your program Connect your output-signals and see that you can set them progammatically. DOCUMENT ALL CONNECTIONS !!! Since we have to read your program, try to make it look easy, use names that speak for themselfs (iData is not as good as ADC_Value), use clear indentation and comments to explain what you're doing. Using function calls makes the whole project easier to overlook and even may save precious RAM: using a function as "void InitializeHardware(void)" and calling this from main() will show where all related stuff has to go to and shortens main() to the very essential part. Happy coding Bob |
|
|
|
李梁
一个静态VAR在()中有很深的意义! 函数(和主体())中的任何变量都将被分配到堆栈上,从而永久地减少它,因为主体()从不结束。另一种方法是在全球范围内定义这些VAR,但是它们可以从任何功能访问,甚至是偶然的。在主()中需要的循环VARS不应该是全局的,想象在两个不同的函数中使用循环变量时发现错误的努力! 在函数中声明avavebe作为静态将VAR的范围减少到这个函数,但不会在堆栈上分配它! 鲍勃 以上来自于百度翻译 以下为原文 @lleung A static var in main() has a deep sense! Any variable in a function (and main() IS a function) would be allocated on the stack, thus reducing it permanently because main() never ends. An alternative would be to define those vars globally, but then they would be accessable from any function, even by accident. Loop-vars needed in main() should NEVER be global, imagine the effort to find the error when a loop-variable is used in two different functions! Declaring a variable within a function as static reduces the scope of the var to this function, but does not allocate it on the stack ! Bob |
|
|
|
我试图做到这一点,但我失败了,如果有人可以看看它,让我知道我做错了什么,
谢谢 拉链 298.3 K 以上来自于百度翻译 以下为原文 i tried to do it but i failed, if anyone can take a look at it and let me know what i am doing wrong, Thanks
|
|
|
|
太好了,这是我的最新代码。
谢谢鲍伯 车轮快速固定装置 481.2 K 以上来自于百度翻译 以下为原文 Great, and here is my lastest code i have. Thanks Bob
|
|
|
|
嗨,鲍伯,我附上了文件。
我用LED测试开关,它们的功能是正确的,但是当我把代码放在我的项目中时,它并没有正确地运行。我想因为我总是从ADC获得数据。你能看一下吗?现在问题是,当我切换到停止,它不会降低速度,直到零,因为它应该做的。它只是停止马达。当我切换到运行模式时,它开始作为IDATA值。不加速从零到价值,因为它应该做的。 你能给我建议吗? 谢谢 车轮快速固定装置 481.3 K 以上来自于百度翻译 以下为原文 Hi Bob, i attached the file. i tested the switches seprate with LEDs and they were function right, but when i put the code in my project, it is not function all correctly. i think because i always getting data from ADC. can you take a look at it. now the problem are when i switch to Stop, it doesnt decrease the speed till Zero as it should do. it just stop the motor. and when i switch to Run mode, it starts as iData value is. not speeding up from zero up to the value as it should be doing. can you advice me in that ? Thanks
|
|
|
|
好点鲍伯。
它有助于8051和M8C,它有一个小的堆栈。 欢呼: 以上来自于百度翻译 以下为原文 Good point Bob. It does help for 8051 and M8C which has a small stack. Cheer: |
|
|
|
发布您的接口的示意图,并连接到PSoC。
问候,Dana。 以上来自于百度翻译 以下为原文 Post a schematic of your interface, and wiring to PSOC. Regards, Dana. |
|
|
|
看一看,也许你可以从那个开始…
鲍勃 车轮快速固定装置 179.7 K 以上来自于百度翻译 以下为原文 Have a look at that, maybe you can start from that... Bob
|
|
|
|
所以,再来一次。所使用的软件设计的缺点是,在电机减速或加速期间,开关和POIT不被读取。原则上,当设计运行时,您应该独立地在中断例程中更新DAC。由于您的示意图显示了一个TACH输入,我想您将实现一个闭环来控制电机速度。
什么是使电机速度下降的原因?这不是通过接口完成的吗?你会使用中断输入吗? 鲍勃 车轮快速固定装置71.ZIP 477.9 K 以上来自于百度翻译 以下为原文 So, back again. The drawback of the software design used is that during the slow-down or accelerate of the motor the switches and poit are not read. When principially the design runs, you should update the DAC in an interrupt-routine independently. Since your schematic shows a tach-input I suppose you'll implement a closed-loop to control the motor-speed. What is the reason to slope the motor-speed? Is that not done by the interface? Are you going to use the break-input? Bob
|
|
|
|
只有小组成员才能发言,加入小组>>
716个成员聚集在这个小组
加入小组1901 浏览 1 评论
1653 浏览 1 评论
3406 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
1568 浏览 6 评论
1380 浏览 1 评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
188浏览 2评论
184浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
324浏览 2评论
352浏览 1评论
63浏览 1评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-4-25 06:45 , Processed in 0.605747 second(s), Total 96, Slave 79 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号