Hi I'm trying to get my mini2440 board to produce 4 pwm signals. I've seen codes that open /dev/pwm and write to it. but how can I make 4 and how can I set which pin to use? I couldn't find any documentation on that does anyone have any? Thank you
How to create PWM on mini2440
I want to run a DC motor using a PWM signal generated by mini2440.Can anyone suggest me how to do that?
hello there, i want to control the pwm using the gui programme... i also want to start and stop and max and min. the freq. od pwm using this gui. i made it but pwm freq does not change please tell me ... why?? ************************************************************************** #include "hello.h" #include <qlabel.h> #include <qpushbutton.h> #include <qtimer.h> #include <stdlib.h> #include <sys/ioctl.h> #include <fcntl.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <linux/fs.h> #include <errno.h> #include <string.h> #include <qobject.h> #include <fstream> #include <linux/i2c-dev.h> #include <string.h> #include <stdio.h> #include <linux/fs.h> #include <termios.h> #include <stdint.h> #include <getopt.h> #include <linux/types.h> #include <linux/spi/spidev.h> # include <time.h> # include <string.h> # include <sys/time.h> #define PWM_IOCTL_SET_FREQ 1 #define PWM_IOCTL_STOP 0 int freq=1000; int fd; HelloForm::HelloForm( QWidget* parent, const char* name, WFlags fl) :HelloBaseForm(parent, name, fl) { connect(PushButton33,SIGNAL(clicked()),this,SLOT(start())); connect(PushButton30,SIGNAL(clicked()),this,SLOT(stop())); connect(PushButton31,SIGNAL(clicked()),this,SLOT(plus())); connect(PushButton32,SIGNAL(clicked()),this,SLOT(minus())); } HelloForm::~HelloForm() { } void HelloForm::start() { int fd = open("/dev/pwm", 0); if (fd < 0) { status->setText("open pwm_buzzer device"); } else{ status->setText("start"); } ioctl(fd, PWM_IOCTL_SET_FREQ, freq); pwm->setText(QString::number(freq)); //close(fd); } void HelloForm::stop() { close(fd); int fd=open("/dev/pwm",0); ioctl(fd, PWM_IOCTL_STOP); close(fd); } void HelloForm::plus() { if(freq<20000) { freq+=10; ioctl(fd,PWM_IOCTL_SET_FREQ,freq); pwm->setText(QString::number(freq)); } } void HelloForm::minus() { if(freq>11) { freq-=10; ioctl(fd,PWM_IOCTL_SET_FREQ,freq); pwm->setText(QString::number(freq)); } }