pwm

performing infinite loop while awaiting input

给你一囗甜甜゛ 提交于 2019-12-25 02:53:23
问题 I have a little project I'm working on, it's fairly simple so I'm hoping someone can help me. I'm using a raspberry pi to dim a single LED with some very crude PWM. my PWM code looks like this: import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) GPIO.setup(7, GPIO.OUT) frequency = 0.005 dwell = 0.0001 while True: time.sleep(frequency) GPIO.output(7, 1) time.sleep(dwell) GPIO.output(7, 0) Basically, in order for the LED to remain lit at the brightness determined by "dwell" I need that

pwm generation using fpga

孤人 提交于 2019-12-25 01:39:35
问题 How to generate a PWM signal using an FPGA? Which is best method to generate a variable duty cycle? I tried to solve this problem by using the following code but two or three errors occurred. This is my code: library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; use ieee.numeric_std.all; --use ieee.float_pkg.all; ---- Uncomment the following library declaration if instantiating ---- any Xilinx primitives in this code. --library UNISIM; --use

Raspberry pi servo doesn't stop

北战南征 提交于 2019-12-24 07:28:30
问题 So I'm trying to use a servo (Doman s0306d) with the pi camera, tried running this script I found to test the motor, it starts running but doesn't stop unless I manually unplug it from the breadboard. import RPi.GPIO as IO # calling for header file for GPIO’s of PI import time # calling for time to provide delays in program IO.setwarnings(False) # do not show any warnings IO.setmode (IO.BCM) # programming the GPIO by BCM pin numbers. (like PIN29 as‘GPIO5’) IO.setup(19,IO.OUT) # initialize

Initiate PWM on a Raspberry Pi runs in a SEHException

人走茶凉 提交于 2019-12-23 02:09:46
问题 I am currently realizing a project in C # on a Raspberry Pi 3. On the Pi, Windows runs IoT Core in the latest stable release release (v.10.0.16299.309). When I initiate the PWM pins, the method runs in an exception (System.Runtime.InteropServices.SEHException: 'External component raised an exception.'). All rights are set and all releases are set on the Windows Fall Creators Update. Can someone be with me. Thank you. here the Code: private async void StartPWM() { GpioController gpioController

PWM是如何调节直流电机转速的?电机正反转的原理又是怎样的?

让人想犯罪 __ 提交于 2019-12-18 04:03:13
电机是重要的执行机构,可以将电转转化为机械能,从而驱动北控设备的转动或者移动,在我们的生活中应用非常广泛。例如,应用在电动工具、电动平衡车、电动园林工具、儿童玩具中。直流电机的实物图如下图所示。 1-直流电机实物图 对于普通的直流电机,在其两个电极上接上合适的直流电源后,电机就可以满速转动,电源反接后,电机就反向转动。但是在实际应用中,我们需要电机工作在不同的转速下,该如何操作呢? 1 直流电机的调速原理 我们可以做这样的实验,以24V直流电机为例,在电机两端接上24V的直流电源,电机会以满速转动,如果将24V电压降至2/3即16V,那么电机就会以满速的2/3转速运转。由此可知,想要调节电机的转速,只需要控制电机两端的电压即可。 以三极管作为驱动器件驱动小功率的电机,其电路原理图如下图所示。电机作为负载接在三极管的集电极上,基极由单片机控制。 2-直流电机调速原理图 当单片机输出高电平时,三极管导通,使得电机得电,从而满速运行;当单片机输出低电平时,三极管截止,电机两端没有电压,电机停止转动。那如何使电机两端的电压发生变化,进而控制电机的转速呢? 只要单片机输出占空比可调的方波,即PWM信号即可控制电机两端的电压发生变化,从而实现电机转速的控制。 2 PWM信号调速的原理 所谓PWM,就是脉冲宽度调制技术,其具有两个很重要的参数:频率和占空比。频率,就是周期的倒数;占空比

学习单片机必须要学的八大知识点,你知道吗?

一个人想着一个人 提交于 2019-12-17 14:49:23
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 学习使用单片机就是理解单片机硬件结构,以及内部资源的应用,在汇编或C语言中学会各种功能的初始化设置,以及实现各种功能的程序编制。 第一、数字I/O的使用 使用按钮输入信号,发光二极管显示输出电平,就可以学习引脚的数字I/O功能,在按下某个按钮后,某发光二极管发亮,这就是数字电路中组合逻辑的功能,虽然很简单,但是可以学习一般的单片机编程思想,例如,必须设置很多寄存器对引脚进行初始化处理,才能使引脚具备有数字输入和输出输出功能。每使用单片机的一个功能,就要对控制该功能的寄存器进行设置,这就是单片机编程的特点,千万不要怕麻烦,所有的单片机都是这样。 第二、定时器的使用 学会定时器的使用,就可以用单片机实现时序电路,时序电路的功能是强大的,在工业、家用电气设备的控制中有很多应用,例如,可以用单片机实现一个具有一个按钮的楼道灯开关,该开关在按钮按下一次后,灯亮3分钟后自动灭,当按钮连续按下两次后,灯常亮不灭,当按钮按下时间超过2s,则灯灭。数字集成电路可以实现时序电路,可编程逻辑器件(PLD)可以实现时序电路,可编程控制器(PLC)也可以实现时序电路,但是只有单片机实现起来最简单,成本最低。 定时器的使用是非常重要的,逻辑加时间控制是单片机使用的基础。 第三、中断 单片机的特点是一段程序反复执行

Linux PWM framework(一)-简介

大憨熊 提交于 2019-12-13 20:27:52
了解PWM基础知识。 1.Introduction   Pulse Wide Modulation (PWM) operates like a switch that constantly cycles on and off. It is a hardware feature used to control servomotors, for voltage regulation, and so on. The most wellknown applications of PWM are: Motor speed control Light dimming Voltage regulation Now, let us introduce PWM with a simple following figure:   The preceding figure describes a complete PWM cycle, introducing some terms we need to clarify prior to getting deeper into the kernel PWM framework: Ton: This is the duration during which the signal is high. Toff: This is the duration

PWM chip to pin mapping on BeagleBone Black (v4.14)

北城余情 提交于 2019-12-13 16:15:23
问题 There is very little information how to configure the Beaglebone for PWM on newer versions of the kernel. I followed the instructions from PWM on BeagleBone Black (v4.14) to interface with the PWM chips, but now I need to figure out the pin that each chip is connected to. Based on the Cape Expansion Headers image in the BeagleBone Black documentation, I know: EHRPWM0A = P9_22 EHRPWM0B = P9_21 EHRPWM1A = P9_14 EHRPWM1B = P9_16 EHRPWM2A = P8_19 EHRPWM2B = P8_13 ECAP0 = P9_42 When I run ls -lh

PWM on BeagleBone Black (v4.14)

半城伤御伤魂 提交于 2019-12-13 02:44:37
问题 There is very little information how to configure the Beaglebone for PWM on newer versions of the kernel. Past instructions for interfacing with PWM through the slots file are obsolete, as the slots file and bone_capemgr are disabled in v4.14 of the kernel. How do I configure PWM for BeagleBone Black with the new kernel? I am using a TI AM335x BeagleBone Black Wireless running kernel version 4.14.37-ti-r46. 回答1: As mentioned in the question, the slots file and bone_capemgr are disabled in v4

Example of use pwm_get() in linux kernel

不想你离开。 提交于 2019-12-12 04:37:08
问题 I want to try to use PWM in linux kernel module for my Rasperry Pi. I've successfully enabled PWM via SYSFS interface. For usage of pwm in kernel modules documentation states: New users should use the pwm_get() function and pass to it the consumer device or a consumer name. pwm_put() is used to free the PWM device. Managed variants of these functions, devm_pwm_get() and devm_pwm_put(), also exist. pwm_get function looks like this: /** * pwm_get() - look up and request a PWM device * @dev: