Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Duty cycle calculation from simulated square wave in simulink.

Status
Not open for further replies.

chandresha1

Member level 2
Joined
Dec 4, 2010
Messages
43
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,288
Location
Bremen, Germany
Activity points
1,673
I want to generate 250Khz analog signals through microcontroller. I am going to use 2Mhz square wave with different duty cycles followed by low-pass filter. I have simulated all these things in simulink and getting square wave with variable frequency according to my requirement.

The problem is i want to know the exact timing when square wave changes its state in order to program my microcontroller. I don't want time-amplitude information at regular interval. I want specifically the time information when square wave changes its state from 1 to 0 and vice versa. square.png
 

chandresha1

Member level 2
Joined
Dec 4, 2010
Messages
43
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,288
Location
Bremen, Germany
Activity points
1,673
I want to generate 250Khz hanning wave signals through microcontroller. As microcontroller can generate only digital signals, i am using butterworth filter for digital to analog conversion. Therefore i have simulated in simulink required square wave signals in order to generate required hanning wave signal and i got square wave signals with different duty cycles(image attached).

Now if i want to generate different duty cycles from microcontroller than i have to load different numbers in timer every time. Here i am stuck. Because i have simulated square wave signals but i don't have information about time width of each square wave. So i want information from my simulation which could explain me that at what time square wave becomes one and at what time it becomes zero. In short i want time information when my square wave changes its state.
 

FvM

Super Moderator
Staff member
Joined
Jan 22, 2008
Messages
48,209
Helped
14,207
Reputation
28,673
Reaction score
12,901
Trophy points
1,393
Location
Bochum, Germany
Activity points
279,272
You don't tell in which form you want to the "timing information". But it shouldn't be difficult to generate an array with time of all square wave edges.
 

chandresha1

Member level 2
Joined
Dec 4, 2010
Messages
43
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,288
Location
Bremen, Germany
Activity points
1,673
Yes, exactly i want an array of time(at edges of square wave) and amplitude in excel or any other document. Could you guide me how can i achieve this?
 

FvM

Super Moderator
Staff member
Joined
Jan 22, 2008
Messages
48,209
Helped
14,207
Reputation
28,673
Reaction score
12,901
Trophy points
1,393
Location
Bochum, Germany
Activity points
279,272
Why don't you post the signal generation code you have so far?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top