To draw a signal before signal generation: is there a way?

If you are using wxDev-C++ for your wxWidgets design, please ask your questions here instead of in IDE Related.
Post Reply
kmagtibay
In need of some credit
In need of some credit
Posts: 2
Joined: Fri Jun 24, 2011 7:22 pm

To draw a signal before signal generation: is there a way?

Post by kmagtibay »

Hello,

I have completed an application in wxWidgets that generates an analog signal (Fig. 1). I have already seen the signal generated on an oscilloscope and the program runs smoothly. Now my reason for posting is I want to ask if there's a way to see the signal I want to generate before invoking my function for the generation of my digital signal which later is converted by my NIDAQ card as an analog signal.

I am forming my digital signal through formation of an array through a series of for-loops. My overall array length is 7000 cells and my pulse parameters (i.e. pulse height, pulse width, pulse delay, etc.) are defined by the user and the values the users can enter are limited by fool-proof codes i.e. to prevent overflow, improper signal generation, etc.

I was thinking of having a button that will generate a separate window where the formed digital signal can be displayed. Also, I was thinking of drawing a dot that will represent each cell of my formed array and the locations of the dot on the window will correspond to the entered values of the user i.e. Pulse Intensity will correspond to the height therefore the location of the dot on the generated window. The meat of the program can be seen below, (TR, PL, PI and TD variables are user defined), which forms the signal seen on Fig. 1.

// Create pulses here
// Trigger Pulse
for (i = 0; i < TR; i++)
{
pdBuffer1 = 0;
}

for (i = TR; i <= 7000; i++)
{
pdBuffer1 = 5;
}

// Start Current Cycle
for (i = 0; i < TR; i++)
{
pdBuffer2 = 0;
}

for (i = TR; i < (PL+TR); i++)
{
pdBuffer2 = polarity*PI; // First Pulse
}

for (i = (PL+TR); i < (PL+TR+TD); i++)
{
pdBuffer2 = 0; // Time Delay
}

for (i = (PL+TR+TD); i < ((2*PL)+TR+TD); i++)
{
pdBuffer2 = -polarity*PI; // Second Pulse
}

for (i = ((2*PL)+TR+TD); i < 7000; i++)
{
pdBuffer2 = 0;
}

Any sort of tips, hints will be greatly appreciated, I just need to know where to start and maybe after that (hopefully) everything will be smooth sailing.

Thanks again wxWidgets community.
Attachments
This is Fig. 1
This is Fig. 1
CPC1.png (3.99 KiB) Viewed 1964 times
Post Reply