element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Embedded and Microcontrollers
  • Technologies
  • More
Embedded and Microcontrollers
Embedded Forum reproducing sine wave accurately
  • Blog
  • Forum
  • Documents
  • Quiz
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Embedded and Microcontrollers to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Suggested Answer
  • Replies 6 replies
  • Answers 4 answers
  • Subscribers 469 subscribers
  • Views 985 views
  • Users 0 members are here
  • cortex-m0 mcu
Related

reproducing sine wave accurately

gnsh
gnsh over 6 years ago

I am using a cortex M0 microcontroller. i am giving a  sine wave input of 1 Hz. this input signal is given to a 12 bit adc and this converted data is given to uart This uart data Im plotting through a serial plotter. image

 

 

how to get a smooth sine wave? from the uart data.

Attachments:
SINEWAVE.c.zip
  • Sign in to reply
  • Cancel

Top Replies

  • michaelkellett
    michaelkellett over 6 years ago +4 suggested
    So many things could be wrong that it's hard to know where to start suggesting. What does you code do, and where did it come from. How fast are you sampling, how is the data being presented to the UART…
  • Jan Cumps
    Jan Cumps over 5 years ago in reply to michaelkellett +3 suggested
    I found this function in the attachment: int32_t adc_sine(void) { int32_t u32Result; unsigned char buffer[20]; ADC_Open(ADC, ADC_INPUT_MODE_SINGLE_END, ADC_OPERATION_MODE_CONTINUOUS, ADC_CH_1_MASK);…
  • shabaz
    shabaz over 5 years ago in reply to Jan Cumps +3
    He's using sprintf with %d, so not sending the number, but an ASCII representation. I don't know what his serial plotter is doing, but maybe it is mashing up the characters into nonsense words or long…
Parents
  • Jan Cumps
    0 Jan Cumps over 5 years ago

    gnsh , to see if the samples make sense, can you test the program with a DC input of 0 V, 1 V, 2 V and 3 V?

    That should give stable lines, whatever the speed of your program would be.

    We can then see (if line 1 is 0, if line 3 = 2 x line 2 level and line 4 = 3 x line 2 level) that the samples are correctly sent to the plotter.

    Then, if that's the case, we can work on speeding it up.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
Reply
  • Jan Cumps
    0 Jan Cumps over 5 years ago

    gnsh , to see if the samples make sense, can you test the program with a DC input of 0 V, 1 V, 2 V and 3 V?

    That should give stable lines, whatever the speed of your program would be.

    We can then see (if line 1 is 0, if line 3 = 2 x line 2 level and line 4 = 3 x line 2 level) that the samples are correctly sent to the plotter.

    Then, if that's the case, we can work on speeding it up.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube