Unable to find a problem in my program?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hello Everyone,

   

I tried to generate a sine wave using counter and DAC. But I am not getting the output. Can you please have a look on my program and help me out about the problem (s) in it?

   

Looking forward to your reply.

   

 

   

Best Regards

   

Awais

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Input clock is set to 200 Hz synced to BusClk. Period is set to 65535.

   

65535 / 200 / 60 =  5,4611666666666666666666666666667 and that's about 5 minutes.

   

You can have a few 1000 interrupts per second, not more, so use a clock of 24MHz and a period of 24000 (23999) to get a 1000 interrupts per second.

   

 

   

Bob

View solution in original post

0 Likes
6 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Your counter will take ~5 minutes to increment. This is probably not what you want.

   

Clearing the interrupt with TC_CC_ISR_ClearPending() is not needed, but you need to clear the counter's interrupt using Counter_ReadStatusRegister()

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Thank you Bob for your reply.

   

5 minutes 😮 ?

   

I don't want this. How you find it that it's taking 5 minutes and how I can overcome this?

0 Likes
lock attach
Attachments are accessible only for community members.
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Input clock is set to 200 Hz synced to BusClk. Period is set to 65535.

   

65535 / 200 / 60 =  5,4611666666666666666666666666667 and that's about 5 minutes.

   

You can have a few 1000 interrupts per second, not more, so use a clock of 24MHz and a period of 24000 (23999) to get a 1000 interrupts per second.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Problem Solved!

   

Thank you Bob 🙂

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

You are always welcome, even when 5 minutes late 😉

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Lol.... 🙂

   

Schönes Wochenende

   

Awais

0 Likes