Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

using pwm to generate pure sine wave

Status
Not open for further replies.

kit_714

Member level 4
Joined
Jul 5, 2006
Messages
70
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
2,011
pwm 8051

Hi All,

may i ask can AT89S52 generate 3 PWMs simutaneously? As i need to interface the RGB LED projects and need to use PWM to control the color of LEDs...

Thanks and regards,

Andy
 

8051 pwm

hay andy..
would you please send more information, but any how you may use its internal timer to generate any required PWM signal


Thanks
Ahmed
 

pwm in 8051

Hi All,

The question is....

Can i generate 3 PWM at the same time using internal timer of AT89s52?

Thanks a lot!!

Andy
 

pwm using 8051

Andy, the article "Balancing D/A Conversion on One Pin", Circuit Cellar #140 March 2002, contains code to generate eight PWM outputs using the timer T0 interrupt.
 

8051 pwm code

Hay Andy,
yes you can generate 3 PWM using 8952 internal timer, just send me the PWM details (period,duty) and i can send you sample code......




Thanks
Ahmed
 

pwm with 8051

Also check out the 8051FA - Can do PWM in harware
 

pwm for 8051

HI , I AM GENERATING PWM USING 8051 FOR 230 VOLTS 50HZ SINE WAVE OUTPUT THROUGH PURE SINE WAVE INVERTER. I AM DRIVING MOSFETS THROUGH PWM.I USED 20MS TOTAL TIME PERIOD FOR 50HZ AND SET/CLR PORT PINS
 

generating sinewave using 8051 timer

ok why dont you give your code for others to learn? :D
 

c code to generate a pwm

EIGHT PWM OUTPUTS USING PORT P1 AND TIMER T0
(From Circuit Cellar #140)

Suppose that timer T0 is working in 16-bit mode and requests an interrupt
when it overflows (passes from 0xFFFF to 0x0000). The interrupt service
routine recharges the timer T0 with 0xFE00 so that a new interrupt takes
place after 512 machine cycles. The low part of the TL0 is not recharged
to obtain more precision.

PR_INTE_T0_PWM SEGMENT CODE
DT_PWM SEGMENT DATA
PUBLIC V
PUBLIC COUNTER

RSEG DT_PWM
COUNTER: DS 1 ;unsigned char COUNTER
V: DS 8 ;unsigned char V[8]

CSEG AT 0000BH ;T0 interrupt vector
LJMP INTE_T0

RSEG PR_INTE_T0_PWM

INTE_T0:
PUSH ACC
PUSH PSW
MOV PSW,#08H ;use register bank 1
MOV TH0,#0FEH ;interrupt after 512 cycles
INC COUNTER
MOV R0,#LOW (V) ;R0 point to V[0]
MOV R1,#00H
MOV R2,#08H ;repeat eight times
LABEL_01:
MOV A,@R0 ;ACC = VALUE
CJNE A,COUNTER,LABEL_02 ;CY = 0 if VALUE >= COUNTER
SETB C ;CY = 1 if VALUE = COUNTER
LABEL_02:
CPL C ;CY = 1 while VALUE > COUNTER
MOV A,R1
RRC A ;rotate right through carry bit
MOV R1,A ;move CY to R1.7
INC R0
DJNZ R2,LABEL_01
MOV P1,R1 ;refresh PWM outputs
POP PSW
POP ACC
RETI
 

Re: pwm for 8051

can u please give me the circuit diagram of pure sine inverter and its whole explanation?
 

Re: pwm for 8051

shri can you please share the code here please.
 

whats wrong with this code ..can any one help...



#include <p18cxxx.h>
#include <delays.h>

#pragma config OSC = HS /* Sets the oscillator mode to HS */
#pragma config WDT = OFF /* Turns the watchdog timer off */
#pragma config LVP = OFF /* Turns low voltage programming off */
#pragma config DEBUG = OFF /* Compiles without extra debug code */
//LCD Control pins




const unsigned char sinetable[10] = {0,77,147,202,237,250,237,202,147,77};
int i=0;




void main(void)
{
TRISC=0xFB;
LATC=0;

CCP1CON=0x0C;
PR2=234;
T2CON=0x00;

while(1)
{
i=0;


for(i=0; i < 10; i++)
{
CCPR1L= sinetable;
TMR2=0x0;
PIR1bits.TMR2IF=0;
T2CONbits.TMR2ON=1;
while(PIR1bits.TMR2IF ==0);
}
}
}
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top