- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello everyone !
I’m new with PSoC and I would like to generate a sin wave from the VDAC.
To do so I need a ( high ) number of values for the argument of the sine function.
I tried to create a list like in python : theta = [0:(2*pi//100:2*pi] for example, but every time I try something it is invalid.
I also tried to mane a for loop outside the main function like this :
unsigned int step:
for ( step=0; step<100; step++)
{
}
it didn’t work as well. I had expectation of ‘(‘
Also, let’s imagine I have a set of values for the angle of my sine function, let us call it x.
Can I do sin(x) to have another set of value of the sin of each value for the angle ?
thank you for your help
Solved! Go to Solution.
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Skdk,
You can use a portion of this project, which includes sine wave generator for testing:
DelSig_ADC - Filter - VDAC8 streaming demo using DMA
It uses several custom components which encapsulate tunable clock (DDS32) and RAM-DMA-VDAC transfer (WaveGen). Simple rotary encoder is used for adjusting sine frequency (or amplitude).
/odissey1
- Tags:
- odissey1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Skdk,
You can use a portion of this project, which includes sine wave generator for testing:
DelSig_ADC - Filter - VDAC8 streaming demo using DMA
It uses several custom components which encapsulate tunable clock (DDS32) and RAM-DMA-VDAC transfer (WaveGen). Simple rotary encoder is used for adjusting sine frequency (or amplitude).
/odissey1
- Tags:
- odissey1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for the quick answer Bota,
It really helps me.
Good afternoon,
Steph
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello again.
I was writing a code to do the task I wanted. To do so I need an array to initialize before the main function.
I wrote :
float array[100];
int i =0;
for ( i=0; i < 100; i++)
{
array = i+1;
}
I get "expected identifier or '(' " error next to the for line. I don't know why since the for loop works fine in the main function.
May I have some help ?
Thank you,
Steph
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steph,
This compiles ok. Post your project here if problem persist.
/odissey1
int main(void)
{
CyGlobalIntEnable; /* Enable global interrupts. */
float array[100];
int i =0;
for (i=0; i < 100; i++)
{
array = i+1;
}
for(;;)
{
/* Place your application code here. */
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your answer Bota !
Does it make a difference if I write this code outside the main function ? I wanted my array to be a global variable. Can I define the array outside the main function and the for sequence inside the main function ?
Thank you very much
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steph,
Now it is global
/odissey1
float array[100]; // global aray
int main(void)
{
CyGlobalIntEnable; /* Enable global interrupts. */
int i =0;
for (i=0; i < 100; i++)
{
array = i+1;
}
for(;;)
{
/* Place your application code here. */
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Bota,
Thank you very much for your help