Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® Software > Triangular wave Generator without DMA and LUT

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



Triangular wave Generator without DMA and LUT
Moderator:
JFMD

Post Reply
Follow this topic



Triangular wave Generator without DMA and LUT

gogul posted on 14 Apr 2011 12:22 AM PST
Member
9 Forum Posts

Hi

I am very new to this PSoc Platform. My doubt "is it possible to design a Triangular waveform generator using VDAC without LUT and DMA? If it so how? And how it is possible to generate a negative voltage using VDAC? If anyone know, please tell me that will help me out to finish my project. Thanks in advance.
 




Re: Triangular wave Generator without DMA and LUT

Robert-CY posted on 18 Apr 2011 08:41 AM PST
Cypress Employee
129 Forum Posts

Hi,

My doubt "is it possible to design a Triangular waveform generator using VDAC without LUT and DMA? If it so how? And how it is possible to generate a negative voltage using VDAC? If anyone know, please tell me that will help me out to finish my project.

Why would you not want to use DMA and LUT? That is a perfect example for using it. You can also create a table of values in the regular code memory and transfer the data by C-instructions to the VDAC and not use the help of the DMA. It would be subject to jitter and use up some CPU power.

Regarding negative voltage, that is not possible without external components. Please check this contribution in the Design challenge forum  http://www.cypress.com/?app=forum&id=2232&rID=48899

Hope this helps you to finish your project.

Robert



Re: Triangular wave Generator without DMA and LUT

bjbu posted on 18 Apr 2011 06:48 PM PST
Cypress Employee
17 Forum Posts

 It is possible to implement a waveform using just hardware (VDAC and programmable logic).  The VDAC has the option to use the DAC bus.  This is an 8-bit bus that provides the value for the DAC instead of having the value come from the CPU.  What values it is given is dependent on the hardware that you develop for the programmable logic.  As Robert described, the DMA and LUT approach is likely easier, but this hardware method can be done.  The simpliest approach would be a Verilog implementation of an up / down counter with the state machine logic to control it.  If you aren't comfortable with developing Verilog hardware, then you could implement using a hardware LUT and gates on a schematic.

Brad



Re: Triangular wave Generator without DMA and LUT

gogul posted on 06 May 2011 06:49 AM PST
Member
9 Forum Posts

Thanks Robert and bjbu, your valuable suggestion will surely help me. but even i tried with timer and VDAC . I want to know whether this will work out or not? Initially i started to generate wave from 0 to 1.024V and vice versa for the next half. Actually i need to Scan my waveform with respect to time, (for eg)  need to increment 0.4 volts every 10 micro secs and vice versa for next half.

 

#include <device.h>

void main()

{
  
   uint8 i ;
   Timer_1_Start ();
   VDAC8_1_Start();

    VDAC8_1_SetRange(VDAC8_1_RANGE_1V);

for(i=0;i<255;i++)

{

VDAC8_1_SetValue(i);  // increment the value by 0.4 volt on strobe signal 

}

if (i==255)

{

for(i=255;i>=0;i--)

{

VDAC8_1_SetValue(i);   // decrement the value by 0.4 volt on strobe signal 
}

}

 



Re: Triangular wave Generator without DMA and LUT

gogul posted on 06 May 2011 06:49 AM PST
Member
9 Forum Posts

Thanks Robert and bjbu, your valuable suggestion will surely help me. but even i tried with timer and VDAC . I want to know whether this will work out or not? Initially i started to generate wave from 0 to 1.024V and vice versa for the next half. Actually i need to Scan my waveform with respect to time, (for eg)  need to increment 0.4 volts every 10 micro secs and vice versa for next half.

 

#include <device.h>

void main()

{
  
   uint8 i ;
   Timer_1_Start ();
   VDAC8_1_Start();

    VDAC8_1_SetRange(VDAC8_1_RANGE_1V);

for(i=0;i<255;i++)

{

VDAC8_1_SetValue(i);  // increment the value by 0.4 volt on strobe signal 

}

if (i==255)

{

for(i=255;i>=0;i--)

{

VDAC8_1_SetValue(i);   // decrement the value by 0.4 volt on strobe signal 
}

}

 



Re: Triangular wave Generator without DMA and LUT

elcorcel69 posted on 22 May 2011 04:16 PM PST

1 Forum Post

????

how?



Re: Triangular wave Generator without DMA and LUT

Gautam Das posted on 22 May 2011 09:39 PM PST
Cypress Employee
742 Forum Posts

Hi Gogul,

 

From the above code, since you are incrementing the value of VDAC in steps of 1 count, the VDAC output is incremented in steps of 4mV and not 400mV (0.4V) as you expected (from your previous comment).

 

Since you want the increment to happen on every 10 micro second, you need to insert a delay of 10 microsecond inside the 'for' loops using CyDelayUs(uint16 microseconds).

Some extra time will be taken up as the execution of statements also takes up few clock cycles.

 

If you don't consider using DMA, then you can use LUT which is very easy to configure. And using a timer to generate a clock of period 10 micro second will generate an accurate frequency triangular wave.

 

Creating a Custom Component using Verilog will be a very easy procedure to obtain the triangular waveform.






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Spec No: None; Sunset Owner: KXP; Secondary Owner: VWA; Sunset Date: 01/01/20