-
Datei
pwm.h
/* pwm.h * Header file for pwm.c * Author: Philipp Burch * Date: 12.09.2010 */ #ifndef PWM_H_INCLUDED #define PWM_H_INCLUDED #include <stdint.h> //Used PWM channels (max. 8), all channels must be located on the same Port! #define PWM_CHANNELS 6 //PWM resolution in Bits #define PWM_BITS 10 #define PWM_MAX_VALUE ((1 << PWM_BITS) - 1) //Output port for PWM signal (DDR has to be set already) #define RPO_PWM PORTD //Masks for faster
in „Soft PWM für LED Controller (RGB mit Multifunktion)“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
PWM.txt
#include <xc164.h> void main(void) { ODP9 = 0x0000; // load open-drain register P9 = 0x0000; // load data register ALTSEL0P9 = 0x0000; // load alternate output function select // register 0 ALTSEL1P9 = 0x0000; // load alternate output function select // register 1 POCON9 = 0x0000; // load output control register DP9 = 0x0000; // load direction register CC2_IOC = 0x0004; // load CAPCOM2 I/O control register CC2_T78CON = 0x0000; // load CAPCOM2 timer 7 and timer 8 control // register CC2_T8 = 0x0000; // load CAPCOM2 timer 8 register CC2_T8REL = 0x0000; // load CAPCOM2 timer 8 reload register CC2_CC16
in „PWM mit Capcom2, Timer8, undefinierter Null-Wert, XC164CS“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
PWM.txt
(GPIO_PORTB_BASE, GPIO_PIN_0, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD); GPIOPinConfigure(GPIO_PB0_PWM2); GPIOPinTypePWM(GPIO_PORTB_BASE, GPIO_PIN_0); PWMGenConfigure(PWM_BASE, PWM_GEN_1, PWM_GEN_MODE_DOWN | PWM_GEN_MODE_NO_SYNC); PWMGenPeriodSet(PWM_BASE, PWM_GEN_1, 2500); //20ms = 50Hz PWMGenIntTrigEnable(PWM_BASE, PWM_GEN_1, PWM_INT_CNT_ZERO); IntEnable(INT_PWM2); PWMIntEnable(PWM_BASE,PWM_INT_GEN_1); PWMOutputState(PWM_BASE, PWM_OUT_2_BIT, true); PWMGenEnable(PWM_BASE, PWM_GEN_1); } void ButtonInterrupt
in „Servozittern bei PWM“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
pwm.asm
;-----bko----------------------------------------------------------------- cnv_PWM2PPM_1: cpi ppm_ms, 6 ; match the appropriate time brne cnv_PWM2PPM cnv_PWM2PPM: ldi temp1, low (-150*16) ;Init PWM1 ldi temp2, high (-150*16) mov loop_l, temp1 mov loop_h, temp2 ldi temp1, 0 mov on1cnt_l
in „Ich bräuchte Assembler hilfe.“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
pwm.c
/* * pwm.c * * Created on: 22.12.2010 * Author: User */ #include "pwm.h" void init_pwm (void) { int count; PCONP |= (1<<5); PINSEL0 |= 0x02; // select PWM1 PWMTCR = 0x02; // reset PWM Timer Counter and Prescale
in „PWM mit LPC21xx“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
PWM.c
/***************************************************** This program was produced by the CodeWizardAVR V2.04.4a Advanced Automatic Program Generator © Copyright 1998-2009 Pavel Haiduc, HP InfoTech s.r.l. http://www.hpinfotech.com Project : Version : Date : 14.07.2010 Author : NeVaDa Company : Comments: Chip type : ATmega32 Program type : Application AVR Core Clock frequency: 16,000000 MHz Memory model : Small External RAM size : 0 Data Stack size : 512 *****************************************************/ #include <mega32.h> #include <delay.h> #include <math.h> #define ADC_VREF_TYPE 0x00 int Delay_zahl
in „Frequenzumrichter für einen 12Volt Asynchronmotor“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
PWM.asm
rjmp loop ; Interrupt Service Routinen timer0_overflow: ; Timer 0 Overflow Handler inc PWMCount ; den PWM Zähler von 0 bis cpi PWMCount, 128 ; 127 zählen lassen brne WorkPWM clr PWMCount WorkPWM: ldi temp, 0b11111110 ; 0 .. Led an, 1 .. Led aus cp PWMCount, on_time ; Ist der Grenzwert für Led 1 erreicht
in „Rampe mit PWM ATMega8“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
PWM.asm
R18 .def RDummy2 = R19 .def RHelligkeit0 = R20 .def RHelligkeit1 = R21 .def RHelligkeit2 = R22 .def fPWM_LED1 = R23 .def fPWM_LED2 = R24 .def fPWM_LED3 = R25 .def RStore = R26 ; Vorgaben für Ausgangshelligkeit .equ Vorgabe_fPWM_LED1 = 0x80 .equ Vorgabe_fPWM_LED2 = 0x80 .equ Vorgabe_fPWM_LED3 = 0x80 ; Vorgaben
in „Port wird nicht angesteuert - in der Simulation schon!“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
pwm.asm
tst YL brne copy dec YH animationLoop: inc YL ; durch die Lookup-Tabelle cyclen (Animation) ; Eine PWM-Phase... ; 256 * 140 - 1 + 2 = 35841 Cycles pwmLoop: ; 4 * (33 + 1) + 1 + 1 + 2 = 140 Cycles updatePort PORTA subi YL, 0x40 updatePort PORTB subi YL, 0x40 updatePort PORTC subi YL, 0x40 updatePort PORTD subi YL, 0x40 inc counter_reg breq no_pwm rjmp pwmLoop no_pwm: rjmp animationLoop .org 0x0100 ; LUT für die Animation f(x) = (128 + 127 * sin(x / 256 * 2 * PI)) ^ 2 (ungefaehr zumindest) sin: .db 0x40, 0x43, 0x46, 0x49, 0x4D, 0x50, 0x53, 0x57
in „Matrix RGB-LED (8x8 / 9x9) über DMX“ · FPGA, VHDL & Co. ·
-
PDF
pwm.pdf
470µ/40VL 2K7S C126 3 1 T100 AGND BC850C 1µ/F63 DVCC 2 3 1 1 2 T104 L100 R105 FQP17P06 140µA/2.5A PWM 2 3 1 T103 2 L101 T101 BC860C 1KS BC850C 3 40µ/2A R132 AGND 47R/1WS D100 C127 C130 C131 C132 C128 C133 STPS340S 1µ/F63 100µ/40VL 100µ/40VL 100µ/40VL 1µ/F63 100µ/40VL AGND AGND AGND AGND AGND AGND AGND
in „Inverter mit Transistor der Quelle nicht belastet?“ · Analoge Elektronik und Schaltungstechnik ·
-
Datei
pwm.bas
Db7 = Portc.5 , E = Portc.1 , Rs = Portc.0 Config Lcd = 16 * 2 Config Rc5 = Pinb.0 Config Timer1 = Pwm , Pwm = 8 , Compare A Pwm = Clear Up , Compare B Pwm = Clear Up , Prescale = 1 Config Timer2 = Pwm , Pwm = On , Compare Pwm = Clear Up , Prescale = 1 Enable Interrupts Dim Address As Byte , Command
in „Algorithmus zum Farbwechsel bei RGB Led“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
PWM.asm
0xFF out PORTB, temp1 ; ldi temp1, 0x00 ; out DDRD, temp1 ; Festlegen des Teilerverhaeltnisses fuer PWM ; Mode | WGM 13 | WGM 12 | WGM 11 | WGM 10 | Description ; 5 | 0 | 1 | 0 | 1 | Fast PWM, 8-bit ldi temp1, 1<<COM1A1 | 0<<WGM11 | 1<<WGM10 out TCCR1A, temp1 ; Prescaler ; CS12 | CS11 | CS10 | Description
in „PWM -- Pulsbreite 0 funktioniert nicht!“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
PWM.txt
out SPL, temp1 ldi temp1, HIGH(RAMEND) out SPH, temp1 ; ; Timer 1 einstellen ; ; Modus 14: ; Fast PWM, Top von ICR1 ; ; WGM13 WGM12 WGM11 WGM10 ; 1 1 1 0 ; ; Timer Vorteiler: 256 ; CS12 CS11 CS10 ; 1 0 0 ; ; Steuerung des Ausgangsport: Set at BOTTOM, Clear at match ; COM1A1 COM1A0 ; 1 0 ; ldi temp1,
in „PWM Pulsweite ändern“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
PWM.asm
8000000 //freq AVR #define fdb 250000 #define bddv (fck/ (16*fdb)) -1 #define DMX_CHANNELS 16 #define PWM_FREQ 255 ;PWM-Freq= 50us = 20kHz ;INTERRUPTROUTINE .org 0x00 rjmp init /* reset vector address */ reti /* External Interrupt0 Vector Address */ reti /* External Interrupt1 Vector Address */ reti /*
in „DMX-Empfang klappt nicht“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
pwm.c
nop() asm volatile("nop") typedef struct { uint16_t brightness; uint16_t clkcnt; uint8_t channel; } pwm_chan; #define CHANNEL_COUNT 3 pwm_chan chans[CHANNEL_COUNT + 1] = {}; uint8_t nextchan = 0; SIGNAL(SIG_OVERFLOW1) { LED_PORT = 0xFF - chans[nextchan].channel; nextchan++; if(nextchan == CHANNEL_COUNT
in „Timingprobleme PWM“ · Mikrocontroller und Digitale Elektronik ·
-
PDF
-
Datei
pwm.c
include <stdio.h> #include <stdlib.h> #ifndef abs #define abs(x) ((x) < 0 ? -(x) : (x)) #endif int pwm(int value) { FILE* f = fopen("/dev/pwm", "wb"); fputc(value & 0xff, f); fputc((value >> 8) & 0xff, f); fclose(f); } int main() { int value = 0; int b; while(1) { b = abs(63 - 2*value); pwm(b * b); value
in „GNUBLIN www.gnublin.org“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
PWM.c
Zeitschleife für high Signal { delay_us(10); //Schrittweite=Pulsveränderung } } } //###################--PWM UP END--####################################### //###################--PWM DOWN--######################################### for(high_time=120;high_time>=100;high_time--) //Zählt in 10us Einheiten { for
in „PIC12F675 brauche Hilfe“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
PWM.c
Zeitschleife für high Signal { delay_us(10); //Schrittweite=Pulsveränderung } } } //###################--PWM UP END--####################################### //###################--PWM DOWN--######################################### for(high_time=120;high_time>=100;high_time--) //Zählt in 10us Einheiten { for
in „PIC12F675 brauche Hilfe“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
PWM.c
<stdlib.h> #include <string.h> #include <stdio.h> #include <inttypes.h> //globale Variable für die PWM uint16_t pwmTable_8[] = {0, 4, 8, 16, 32, 64, 128, 255}; #define ARRAY_SIZE(x) (sizeof(x)/sizeof(*x)) //----------------- long delays void my_delay(uint16_t milliseconds) { for(; milliseconds > 0; milliseconds
in „Probleme mit der Verbindung PWM + ADC“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
PWM.c
Set timer to 0; ICR1 = 19999; //Puls wird alle 20ms gesendet; TCCR1A = (1<<WGM11); //WGM 111 == FAST PWM; TCCR1B = (1 << WGM13) | (1<<WGM12) | (1 << CS11); //Prescaler = 8; DDRB |= _BV(5) | _BV(6); //port 5 und 6 als Output; // TCCR1A |= 2 << 6; TCCR1A |= 2 << 4; // OCR1A = ICR1 * 2 /20; OCR1B = ICR1 *
in „Fast PWM Funktioniert nicht wirklich“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
pwm.c
#include "pwm.h" #include "io.h" void InitPWM() { // alle LEDs auf null setzten uint8_t i; for(i=0; i<32; i++) { SetLED(i, 0); } // Timmer0: 200 Hz initalisieren // => Reset TLC5940 TCCR0A = 0x00; TCCR0B =(1<<CS02
in „Atmega48 - UART als Interrupt“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
pwm.h
#ifndef _PWM_H #define _PWM_H #include <avr/io.h> #include <avr/interrupt.h> #include <util/delay.h> #include <avr/pgmspace.h> // PORT 1 #define PORT1_GREEN2 30 #define PORT1_RED2 29 #define PORT1_BLUE2 28 #define
in „Atmega48 - UART als Interrupt“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
pwm.c
int main(void) { ... ... TCCR1A = (1<<WGM11)|(1<<WGM10)|(1<<COM1A1)|(1<<COM1A0); //10bit Timer invertiert,TOP bei 1024 TCCR1B=(1<<CS11); //Vorteiler auf 8 setzen ... ... while(1){ ... servo_ansteuern(messwert_vorne,messwert_links); } return(0); } void servo_ansteuern(double messwert_vor,double messwert_links){ if((messwert_vor>128)&&(messwert_links<128)){ OCR1A=1015; //Servo 1 //Code für Servo 2 } else{ OCR1A=953; //Servo 1 //Code für Servo 2 } }
-
Datei
PWM.c
include <stdint.h> #define F_CPU 3686411 int main (void) { TCCR2= (1<<WGM20)|(1<<COM21)|(1<<CS20); //pwm anschalten und einstellen ob beim hochzaehlen an und beim runterzaehlen aus gemacht wird oder andersrum OCR2 = 0x7F; TIMSK= (1<<OCIE2); DDRB|=(1<<3); DDRC&=~((1<<0) | (1<<5)); PORTC|=(1<<0) | (1<<5)
in „PWM mit ATMEGA8“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
pwm.c
/**************************************************************************** * $Id:: pwm.c 5748 2010-11-30 23:48:37Z usb00423 $ * Project: NXP LPC17xx PWM example * * Description: * This file contains PWM code example which include PWM initialization, * PWM interrupt handler, and APIs for
in „LPC1769 PWM Probleme bei Dutycycle“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
pwm.h
/**************************************************************************** * $Id:: pwm.h 5759 2010-12-01 18:30:38Z usb00423 $ * Project: NXP LPC17xx PWM example * * Description: * This file contains PWM code header definition. * ********************************************************
in „LPC1769 PWM Probleme bei Dutycycle“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
pwm.c
/**************************************************************************** * $Id:: pwm.c 5748 2010-11-30 23:48:37Z usb00423 $ * Project: NXP LPC17xx PWM example * * Description: * This file contains PWM code example which include PWM initialization, * PWM interrupt handler, and APIs for
in „LPC1769 PWM Probleme bei Dutycycle“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
pwm.h
/**************************************************************************** * $Id:: pwm.h 5759 2010-12-01 18:30:38Z usb00423 $ * Project: NXP LPC17xx PWM example * * Description: * This file contains PWM code header definition. * ********************************************************
in „LPC1769 PWM Probleme bei Dutycycle“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
pwm.txt
#include "pwm.h" #include <avr/io.h> void pwm(uint16_t top, uint16_t wert, uint16_t zeit) { // OC1A auf Ausgang DDRB = (1 << PB1 ); //ATMega8 () // Timer 1 einstellen // // Modus 5 Atmega8 Datasheet: // Fast PWM,
in „AVR Atmega8, PWM per Taster an“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
PWM.c
#include <avr/io.h> #define PI 3,41 #include <stdint.h> #include<avr/interrupt.h> //#define TIMER0_OVF_vect void timer_init(void) { sei(); SREG |= 0b10000000; TCCR0A |= ((1<<COM0A1) | (1<<COM0A0) | (1<<COM0B1) | (1<<COM0B0) | (1<<WGM01) | (1<<WGM00)); //COM0A1 COM0A0 COM0B1 COM0B0 WGM01 WGM00 TCCR0B |= ((0<<WGM02) | (1<<CS02) | (1<<CS01) | (1<<CS00)); //FOC0A FOC0B WGM02 CS02 CS01 CS00 letzten drei Bits für den Teiler TIFR0 |= ((1<<OCF0B) | (1<<OCF0A) | (1<<TOV0)); TIMSK0 |= ((1<<OCIE0B) | (1<<OCIE0A) | (1<<TOIE0)); } void timer_interrupt(void) { } int main(void) { DDRD = 0xFF;//DDRD&0xC; //OC0A
in „PWMs mit AT90PWM316“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
PWM.c
include <stdint.h> #include<avr/interrupt.h> //#define TIMER0_OVF_vect void timer_init(void) { /*Fast PWM mit Timer0*/ TCCR0A |= ((1<<COM0A1) | (1<<COM0A0) | (1<<COM0B1) | (1<<COM0B0)); //Setzen bei übereinstimmung und löschen bei Top (Aus Tabelle 14-3 & 14-6) TCCR0A |= ((1<<WGM01) | (1<<WGM00)); //Mode 3 (Fast PWM) (Aus TAbelle 14-8) TCCR0B |= ((0<<CS02) | (0<<CS01) | (1<<CS00)); //Kein Teiler (Aus Tabelle 14-9) } int main(void) { DDRD = 0xFF;//DDRD&0xC; //OC0A & OC1A // DDRA = 0x00; // DDRB = 0xFF; DDRC = DDRC
in „PWMs mit AT90PWM316“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
PWMs.txt
interrupt.h> //#define TIMER0_OVF_vect //Globale Variable long duty, w1, w2, w3; //Duty Cycle der PWMs void rechtskom (){ // Für die High-Mosfets wird das Dutycycle auf duty für high und auf 0 für Low eingestellt (PWM nur für High MosFets) if ( PINB & (1<<PINB0) ) { if ( !(PINB & (1<<PINB1))) { w1=duty
in „zwei if-Anweisungeg funktionieren nicht zusammen“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
pwm.c
_t)(adc - 25) / (uint8_t)(255 - 25); } static void ioconf(void) { OCR0A = TMR_TOP; /* mode 7: fast PWM, TOP = OCR0A, prescaler 64 */ TCCR0A = _BV(WGM00) | _BV(WGM01) | _BV(COM0B1) /* | !_BV(COM0B0) */; TCCR0B = _BV(WGM02) /* | !_BV(CS02) */ | _BV(CS01) | _BV(CS00); DDRB = _BV(PB1); /* OC0B as output
in „0-5V => 100Hz PWM 0-100% @10V“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
pwm.c
& (1<<2)) { pwm_in[2]=pwm_in_temp[2]; pwm_in_temp[2]=0; } if(pwm_in_flanke & (1<<3)) { pwm_in[3]=pwm_in_temp[3]; pwm_in_temp[3]=0; } if(pwm_in_flanke & (1<<4)) { pwm_in[4]=pwm_in_temp[4]; pwm_in_temp[4]=0; } if(pwm_in_flanke
in „PWM auswerten und erzeugen (RC-Fernbedinug)“ · Projekte & Code ·
-
Datei
pwm.h
ergebnis wird alle 20ms aktualisirt */ //////////////////////////////////////////////////// #define PWM_OUT PORTC /* Port für output wählen */ #define PWM_IN PIND /* Port für input wählen */ uint8_t pwm_out[4]; /* 4 kanäle ausgang */ uint8_t pwm_in[6]; /* 6 eingangs kanäle */ void pwm_start(void); /* PWM STARTEN */
in „PWM auswerten und erzeugen (RC-Fernbedinug)“ · Projekte & Code ·
-
Datei
PWM.txt
Ausgang P1SEL = BIT1|BIT6; // Setzt P1.6 als Digitalen Output //Konfiguriere TimerA CCR0 = 1023; // PWM Periode, im CCR0 Register CCTL1 = OUTMOD_7; // Rreset/Set Modus auswählen CCR1 = 500; // PWM duty cycle im CCR1 Register, wird nur bis zum ersten Durchlauf verwendet TACTL = TASSEL_2 + MC_1; // SubMasterClock
in „MSP430G2231 PWM mit Duty Cycle 0 und 1“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
PWM.c
// 8-Bit PWM // PWM invertiert // Vorteiler = 1 TCCR1A = (1<<COM1A1) |(1<<COM1A0)| (1<<WGM10); TCCR1B = (1<<CS10); // den Endwert (TOP) für den Zähler setzen // der Zähler zählt bis zu diesem Wert // Hier: 256 ICR1
in „PWM und Led Dimmen“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
pwm.txt
Overflow-Interrupt (TOIE0), Output Compare Interrupt (OCIE1A) TIMSK |= (1<<TOIE0) | (1<<OCIE1A); // PWM konfiguerieren (Timer1) // TCCR1A = COM1A1 | COM1A0 | COM1B1 | COM1B0 | FOC1A | FOC1B | PWM1A | PWM1B // OC1A(PB1) cleared at compare match (COM1A1), PWM mode (PWM1A) TCCR1A |= (1<<COM1A1) | (1<<PWM1A
in „ATtiny26 PWM mit veränderbarer Frequenz“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
PWM.asm
************************************************************************************** ;* Programm PWM.ASM ;* ;* Für ATtiny13 im Auslieferungszustand ( High = $FF ; Low = $6A ) ;* ;* ;* Der PWM-Pinn 5 ( OC0A ) soll die höchstmögliche Rechteckfrequenz liefern die der ;* ATtiny13 im Auslieferungszustand erzeugen kann ( Ca. 600kHz ) ;* Dazu wird der Fast PWM-Mode ( 7 ) benutzt. ;* ;* ;* Als Programmlaufanzeige dient eine LED die an Pinn 7 angeschlossen ist und mit ;* ca. 1 Hz blinkt. ;* ;* PWM-Signal an PB0 => Pinn 5 ;* ;* Programmlaufanzeige LED an PB2
in „ATtiny13 im Fast PWM-Mode 7 als Rechteckgenerator“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
PWM.c
/* * ESC_IC_Adrian.c * * Created: 24.07.2013 18:52:06 * Author: Adrian CPU-Frequency: 8000000Hz */ #include <avr/io.h> #include <avr/interrupt.h> //Globale Variablen uint16_t comp=20000; int main(void) { TCCR1B |= (1<<ICNC1) | (1<<ICES1); TIMSK |= (1<<TICIE1); DDRC |= (1<<DDRC0); sei(); while(1) { } } ISR(TIMER1_CAPT_vect) { PORTC |= (1<<PORTC0); TCCR1B |= (1<<CS10); OCR1A = comp; TIMSK |= (1<<OCIE1A); TCNT1 = 0; TIFR = (1<<ICF1); } ISR(TIMER1_COMPA_vect) { PORTC &= ~(1<<PORTC0); TIMSK &= ~(1<<OCIE1A); }
in „ATmega8 PWM mit Input Capture generieren“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
pwm.c
#include <avr/io.h> #define F_CPU 8000000UL // 8 MHz #include <util/delay.h> int main (void) { DDRB |= _BV(PB2); TCCR0A = (1<<WGM11) | (1<<WGM10) | (1<<COM1A1); TCCR0B = (1<<CS10); int a=255; while (1) { while (a<255) { OCR0A = a; _delay_ms(15); a++;a++; if (a == 255) { _delay_ms(250); } } while (a>0) { OCR0A = a; _delay_ms(15); a--;a--;a--;a--;a--; if (a == 0) { _delay_ms(250); } } } return 0; }
in „PWM an mehreren Led´s welcher Transistor“ · Analoge Elektronik und Schaltungstechnik ·
-
Datei
PWM.c
ISRflag == 1) { IOCLR1 = LED3BITY; // disable LED3 ISRflag = 0; } // restoreIRQ(cpsr); } void init_PWM (void) { VICIntSelect = 0x00000000; VICIntEnable = 0x00000100; /* Enable the interrupt */ VICVectCntl8 = 0x00000028; /* Set channel */ VICVectAddr8 = (unsigned)PWM0_isr; /* Set the PWM ISR vector address */ PINSEL0 |= 0x00020000; // Change GPIO P0.8 to PWM4 PWMPR = 0x00000000; // Set Pre Scale to 0 PWMPCR = 0x00001000; // Enable PWM4 Output (bit12) PWMMR0 = 0x00000300; // Max Value of Pulse Width PWMMR4 = 0x00000020; // PWM4 Match Value PWMMCR = 0x00000003
in „PWM Timer Interrupt firing only once“ · µC & Digital Electronics ·
-
Datei
PWM.txt
#include <avr/io.h> #include <avr/interrupt.h> volatile int16_t steigend=0; volatile int16_t fallend=0; volatile int16_t aktuell=0; int main(void) { DDRE=0b000; //Port E als Eingang gesetzt! ICP=PE0, Evtl Pull-UP??? TCCR1B=(1<<ICES1); //ICES1=1 => Reaktion auf steigende Flanke! TCCR1B=(1<<CS10); //Takt auf CPU-Takt gesetzt TIMSK=(1<<TICIE1); //Input Capture Interrupt Enable sei(); //Interrupt enable global DDRB=0b11111111; //Port B als Ausgang definieren PORTB=0b11111111; //Alle Pins auf high! while(1) { if(aktuell<5529) { PORTB=0b11111111; } else { PORTB=0b00000000; } } } ISR(TIMER1_CAPT_vect) {
in „alternative Pin-Funktionen“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
PWM.vhd
instantiating -- any Xilinx primitives in this code. -- library UNISIM; -- use UNISIM.VComponents.all; entity PWM is Port ( clock : in STD_LOGIC; up : in STD_LOGIC; down : in STD_LOGIC; pwm_out : out STD_LOGIC; dutycycle_out : out STD_LOGIC_VECTOR (6 downto 0); dir : out STD_LOGIC); end PWM; architecture Behavioral
in „Signal duty cannot be synthesized, bad synchronous description.“ · FPGA, VHDL & Co. ·
-
Datei
pwm.c
/* * main.c * * Created: 11.03.2013 10:28:50 * Author: */ #include <avr/io.h> #include <util/delay.h> #include <avr/interrupt.h> #include <stdio.h> #include <stdlib.h> #include "UART.h" #include "1wire.h" #include "measure.h" #include "hardware.h" volatile int e; volatile int x; volatile int esum=0; volatile unsigned int y; volatile int w=30; volatile int zwischen; volatile float Kp=6; //volatile float Ki=0.0079; volatile float Ki=0.1; volatile float Ta=1.421; /*Variablen fuer TIMER 2*/ volatile unsigned int timer_count=0; volatile long int status=0; volatile int k=0, j=10; int main(void) { init
in „PWM Störung durch 1-Wire“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
PWM.c
#include <avr/io.h> int main () { //PWM im 10-Bit Modus TCCR1A |= _BV (WGM11); TCCR1A |= _BV (WGM10); //nicht invertierender PWM TCCR1A |= _BV (COM1A1); TCCR1A &= ~_BV (COM1A0); //Frequenz des PWM einstellen TCCR1B |= _BV (CS10); TCCR1B &= ~_BV (CS11); TCCR1B &= ~_BV (CS12); //Pulsbreite des PWM einstellen (0...2^10Bit) OCR1A=500; return 0; }
in „PWM funktioniert nicht!!!“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
PWM.c
#include <stdio.h> #include <avr/wdt.h> #include <avr/io.h> main () { DDRB = 0xFF; //PWM im 10-Bit Modus TCCR1A |= (1 << WGM11) | (1 << WGM10); //nicht invertierender PWM TCCR1A |= (1 << COM1A1); //Frequenz des PWM einstellen TCCR1B = (1<<CS12) | (1<<CS10); //Pulsbreite des PWM einstellen
in „atmega8, PWM erzeugen“ · Mikrocontroller und Digitale Elektronik ·
-
PDF
pwm.pdf
D C BB A I \ P P G X B X N Q W W N 1 3 a 1 1 0 M M D . u o t l m N 1 S T 1 c h l a G c i U t t T a r 5 1 R 4 R 1 R l e k 4 7 3 k 2 2 e n 1 R B k V h P k 1 M n l S e w p L 1 C s e , L 0 0 e \ E F r u R W d T M P S W U o M T l z , Ba0, o e V s 1 2 C1 h h @ p 9 0 2 Q n n 0 F 2 \ h 4 u V h n V n B u m 8 i n m = t 2 C e e 8 0 2 , r S D4 3 F N n C LED2mA gn T e H LED1 w r E 1 1 1 R i C D5 k 4 R 1 d H LED2mA ge m T LED2 t , R 1 C R D6 k 5 0 7 A 3 i LED2mA rt F 5 + 0 C3 g C 5 µ g 1 R LED3 r F t k 6 f g + 3 g 5 1 1 1 1 1 1 1 1 2 0 C 3 r 5 5 2 3 4 7 8 9 0 n 5 t A U F i V C A A A A A A A A 1 8 C y C C 7
in „PWM-Regler 50VDC 80Ampere“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
pwm.vhd
; pwm5 : out std_logic; pwm6 : out std_logic; pwm7 : out std_logic; pwm8 : out std_logic); end pwm; architecture Behavioral of pwm is ------------------------------- -- Define Internal Signal ------------