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.

how to invert sine wave after build it half wave?

Status
Not open for further replies.

sme7000

Newbie level 6
Joined
Dec 16, 2009
Messages
12
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
malaysia
Activity points
1,387
i,m using pic16f877 to generate SPWM. sine wave that i build in half wave need to be invert because PIC cannot read in negative value. can anybody help me with this problem..this is what i write in c programming.


#include <stdio.h>
#include<math.h>
#include<float.h>

int main()
{
int Am=10;
float pi=3.1416;
float t=0.0005;
int n;
int Vm;

while(1); //infinite loop

{ for(n=0;n<=20;n++)
{
Vm= Am*sin(100*pi*n*t);

}


for(n=20;n<=0;n--)
{
Vm=Am*sin(100*pi*n*t);
}
}

}
 

you just only need an opamp in inverting mode. Av = -R2/R1... Av = Vo/Vi
 

The question seems almost unclear because the code hasn't anything to do with "read in" a value, neither positive nor negative.
If output inversion would be possibly needed in PWM generation, depends on the intended power stage configuration and PWM
scheme, that hasn't been mentioned.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top