FMUSER Wirless Transmit Video And Audio More Easier !

[email protected] WhatsApp +8618078869184
Language

    DIY simple square wave generator, up to 1MHz

     

    This is a simple square wave generator, mainly using the Timerone library, allowing you to generate a PWM signal at pin 9. Hardware components: Arduino nano r3 × 1 Adafruit Standard LCD-16x2 Blue White × 1 Press button switch, instant × 3 Single Circle Potentiometer -10K ohm × 1 Software applications and online services: Arduino IDE This is a simple square wave generator, mainly using the Timerone library, allowing you to generate a PWM signal at pin 9, with a range of about 5Hz to 1 MHz, and can adjust the duty cycle from 0 to 100%. Be Schematic: The equipment is very easy to build, including only a few components: Arduino nano microcontroller LCD Monitor Three pull-up resistors Three buttons The pulse generator can adjust the pulse repetition cycle using a button connected to the Arduino number inputs 6 and 7. 13 input pins allow you to adjust duty cycle. The duration and duty cycle reading are displayed in the first row of the LCD 16 × 2 indicator, and the frequency readings are displayed in the second line. The minimum step for adjusting the pulse repetition cycle is 1 μs, so the frequency changes discrete, for example 1 μs, 500 kHz, 3 μs is 333.333 Hz, according to such push, and with the frequency reduction, its adjustment of smoothness increases . This is unrealistic on a higher frequency, but this is the simplified price. In order to visualize the output signal, I use a small single channel oscilloscope. Finally, install the device in a suitable box, which is another useful tool in the electronic laboratory. Source code: #include #include Liquidcrystal LCD (12, 11, 5, 4, 3, 2); // RS, E, D4, D5, D6, D7 Unsigned long t = 1000, f, k = 512; // default 1000 μs (1000 Hz), Meander, Pulse Duration Is Equal to Duty Cycle K = 512 (50%) BYTE K1, KN, KN1, KN2; INT Drive, Drive0; Void setup () { LCD.BEGIN (16, 2); // LCD 16x2 PinMode (10, Output); PinMode (6, Input); // Button At Input 6 PinMode (7, Input); // Button At Input 7 PinMode (13, INPUT); // Button At INPUT 13 } void loop () { Timer1.initialize (T); // period Timer1.pwm (9, k); // K - Fill Factor 0-1023. We Remove The Signal from The Output 9 KN = DIGITALREAD (6); // Button Input 6 (- Pulse Period) KN1 = DIGITALREAD (7); // Button Input 7 (+ Pulse Period) KN2 = DIGITALREAD (13); // Button Input 13 (+ Circle Fill Factor) IF (kn == high) {// decreasing the period DRIVE ++; IF (drive<30) { T = T-1; } // if the button is help for a long time, the correction of the pulse period x10 x100 x1000 is accelerated Else IF (drive>30 && drive<60) { T = T-10; } Else IF (drive> = 60 && drive<100) { T = T-100; } Else IF (drive> = 100) { T = T-1000; } } Else { DRIVE = 0; } IF (kn1 == high) {// adding a period DRIVE0 ++; IF (drive0<30) { T = T + 1; // if the button is held for a long time, The correction of the period x10 x100 x1000 is accelerated } Else IF (drive0>30 && drive0<60) { T = T + 10; } Else IF (drive0> = 60 && drive0<100) { T = T + 100; } Else IF (drive0> = 100) { T = T + 1000; } } Else { DRIVE0 = 0; } IF (t == 0 || T>300000) {// limited the pulse duration to the minimum, IF 0 μs or more Than 300 ms (3.33 hz), THE PERIOD IS 1 μs T = 1; } IF (T>200000 && T<300000) {// limited The Pulse Duration To The maximum, IF More Than 200 MS, But Less Than 300 MS (3.33 Hz), THE PERIOD IS 200 MS (5 Hz) T = 200000; } F = 1000000 / t; // Calculate the Frequency K1 = K * 100/1024; // Calculate% Fill Factor IF (kn2 == high) {// Button for Adjusting The Fill Factor (in a circle from 50 to 100%, Then from 0 to 100%) K = K + 16; // Step 16 out of 1024 (you can do 8 for smoother adjustment) } IF (k == 1024) { K = 0; } // Displaying information on the indeicator LCD.SetCursor (0, 0); LCD.Print ("t ="); LCD.Print (T); LCD.Print ("US"); LCD.SETCURSOR (12,0); LCD.Print (k1); LCD.Print ("%"); LCD.SetCursor (0, 1); LCD.Print ("f ="); LCD.Print (f); LCD.Print ("HZ"); DELAY (300); LCD.SetCursor (0, 0); LCD.Print (""); LCD.SetCursor (0, 1); LCD.Print (""); }

     

     

     

     

    List all Question

    Nickname

    Email

    Questions

    Our other product:

    Professional FM Radio Station Equipment Package

     



     

    Hotel IPTV Solution

     


      Enter email  to get a surprise

      fmuser.org

      es.fmuser.org
      it.fmuser.org
      fr.fmuser.org
      de.fmuser.org
      af.fmuser.org ->Afrikaans
      sq.fmuser.org ->Albanian
      ar.fmuser.org ->Arabic
      hy.fmuser.org ->Armenian
      az.fmuser.org ->Azerbaijani
      eu.fmuser.org ->Basque
      be.fmuser.org ->Belarusian
      bg.fmuser.org ->Bulgarian
      ca.fmuser.org ->Catalan
      zh-CN.fmuser.org ->Chinese (Simplified)
      zh-TW.fmuser.org ->Chinese (Traditional)
      hr.fmuser.org ->Croatian
      cs.fmuser.org ->Czech
      da.fmuser.org ->Danish
      nl.fmuser.org ->Dutch
      et.fmuser.org ->Estonian
      tl.fmuser.org ->Filipino
      fi.fmuser.org ->Finnish
      fr.fmuser.org ->French
      gl.fmuser.org ->Galician
      ka.fmuser.org ->Georgian
      de.fmuser.org ->German
      el.fmuser.org ->Greek
      ht.fmuser.org ->Haitian Creole
      iw.fmuser.org ->Hebrew
      hi.fmuser.org ->Hindi
      hu.fmuser.org ->Hungarian
      is.fmuser.org ->Icelandic
      id.fmuser.org ->Indonesian
      ga.fmuser.org ->Irish
      it.fmuser.org ->Italian
      ja.fmuser.org ->Japanese
      ko.fmuser.org ->Korean
      lv.fmuser.org ->Latvian
      lt.fmuser.org ->Lithuanian
      mk.fmuser.org ->Macedonian
      ms.fmuser.org ->Malay
      mt.fmuser.org ->Maltese
      no.fmuser.org ->Norwegian
      fa.fmuser.org ->Persian
      pl.fmuser.org ->Polish
      pt.fmuser.org ->Portuguese
      ro.fmuser.org ->Romanian
      ru.fmuser.org ->Russian
      sr.fmuser.org ->Serbian
      sk.fmuser.org ->Slovak
      sl.fmuser.org ->Slovenian
      es.fmuser.org ->Spanish
      sw.fmuser.org ->Swahili
      sv.fmuser.org ->Swedish
      th.fmuser.org ->Thai
      tr.fmuser.org ->Turkish
      uk.fmuser.org ->Ukrainian
      ur.fmuser.org ->Urdu
      vi.fmuser.org ->Vietnamese
      cy.fmuser.org ->Welsh
      yi.fmuser.org ->Yiddish

       
  •  

    FMUSER Wirless Transmit Video And Audio More Easier !

  • Contact

    Address:
    No.305 Room HuiLan Building No.273 Huanpu Road Guangzhou China 510620

    E-mail:
    [email protected]

    Tel / WhatApps:
    +8618078869184

  • Categories

  • Newsletter

    FIRST OR FULL NAME

    E-mail

  • paypal solution  Western UnionBank OF China
    E-mail:[email protected]   WhatsApp:+8618078869184   Skype:sky198710021 Chat with me
    Copyright 2006-2020 Powered By www.fmuser.org

    Contact Us