Announcement

Collapse
No announcement yet.

Generating a clock

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Generating a clock

    Hey guys,

    I'm needing to generate an adjustable clock signal (preferably a sine wave). I don't have a function generator so I need another alternative.

    I'm wondering if there is any way I can output a clock from my pc's serial or parallel port. If so I need to be able to adjust the frequency live by pressing the arrow keys or something.

    Does anyone know how to do this?

    I also have a raspberry pi if that could be useful for anything.
    canadaboy25

    -Sometimes the light at the end of a tunnel is an on-coming train

    #2
    Re: Generating a clock

    use the soundcard - maybe.
    you didnt say the frequency range you need.
    Last edited by stj; 03-18-2015, 09:55 PM.

    Comment


      #3
      Re: Generating a clock

      Well as high as I can get basically. I really don't know the exact frequency, thats why it needs to be adjustable.

      How would I be able to use my soundcard?
      canadaboy25

      -Sometimes the light at the end of a tunnel is an on-coming train

      Comment


        #4
        Re: Generating a clock

        use the headphone/speaker socket to get the signal,
        there are softwarez for generating waves - you can get atleast 40khz from most cards.

        if you use Linux or the Pi there is a soft called spiralsynth

        a quick 1 second play with a search engine gives you:
        https://duckduckgo.com/?q=soundcard+...t-wt&kv=1&kh=1

        Comment


          #5
          Re: Generating a clock

          Well I'll have a look but my sound card is really, really old.

          The on-board audio on my mobo is fried so I have an old Sound Blaster sb0060 card
          canadaboy25

          -Sometimes the light at the end of a tunnel is an on-coming train

          Comment


            #6
            Re: Generating a clock

            those are probably better.

            Comment


              #7
              Re: Generating a clock

              http://www.radio.imradioha.org/pc_based_test_gear.htm
              Never stop learning
              Basic LCD TV and Monitor troubleshooting guides.
              http://www.badcaps.net/forum/showthr...956#post305956

              Voltage Regulator (LDO) testing:
              http://www.badcaps.net/forum/showthr...999#post300999

              Inverter testing using old CFL:
              http://www.badcaps.net/forum/showthr...er+testing+cfl

              Tear down pictures : Hit the ">" Show Albums and stories" on the left side
              http://s807.photobucket.com/user/budm/library/

              TV Factory reset codes listing:
              http://www.badcaps.net/forum/showthread.php?t=24809

              Comment


                #8
                Re: Generating a clock

                The max frequency that any software will let me output is 22 KHz.

                Is there any way to write a python program to output higher?
                canadaboy25

                -Sometimes the light at the end of a tunnel is an on-coming train

                Comment


                  #9
                  Re: Generating a clock

                  Usually the highest bandwidth is dependent on your soundcard, as most sound cards are 44.1KHz sample rate the best frequency output is half that, 22.05KHz. This will be a nasty looking triangle wave if it's not filtered properly so you'll have harmonics.

                  There are some higher end sound cards that can go to 96KHz or possibly higher but likely you'll not see that many as that's way past hearing range and nobody would overdesign.

                  Another possibility is to get your pc speaker output and program the 8254 timer to get a higher frequency. I'm not sure how high this will go but it should also get into several KHz, but it will definitely max out well before 1MHz).

                  Again, what kind of frequencies will you need? Likely there are no PC solutions without additional hardware that will get you something past probably 1MHz or so, and that likely is kind of tough as it is.

                  Likely you won't get any other stable clock source from the PC, if you just want random pulses you could just keep on writing 0x55 0xAA to the parallel or serial port but who knows what that "clock" will look like -- tons of jitter.
                  Last edited by eccerr0r; 03-19-2015, 07:12 PM.

                  Comment


                    #10
                    Re: Generating a clock

                    Even 44 khz would be fine. I'm just having trouble finding free software that will do that.
                    canadaboy25

                    -Sometimes the light at the end of a tunnel is an on-coming train

                    Comment


                      #11
                      Re: Generating a clock

                      As stated, chances are you won't get 44KHz with a rudimentary sound card, so you'll not find software to do that. You'll need a "high end" card to get 44KHz - the limit for most common sound systems is 24KHz.

                      The PC speaker output you probably can get ~ 60KHz or so, maybe more, if you can find a pc speaker driver program that will set the beep frequency that high. The hardware should be able to do it... plus this should be a good squarewave.

                      Comment


                        #12
                        Re: Generating a clock

                        that is a high end soundcard with a dsp on it - the problem may be drivers.
                        from what i see in the linux driver, they sold about 8 identical cards at different prices, the only difference was the pci id in the eeprom.
                        the official driver enabled various options based on the i.d.

                        Comment


                          #13
                          Re: Generating a clock

                          I just reread the first post, you want a sine wave. How good of a sinewave do you want? You're not getting even a good sine wave with a 44.1KHz/48KHz sound card, at nyquist frequency you're getting a 22.05KHz/24KHz "sine wave" which will most likely will look more like a triangle wave (unless you have a "good" sound card which has a good low pass filter).
                          You'll probably get a better result if you reduced the frequency more, to say 11KHz/12KHz, then at least you'll have 4 samples of a sine wave per cycle.... sounds like this pretty much sucks right? Indeed it does.

                          Scratch what I said about the pc speaker (square) and forget about parallel/serial ports (also digital). Unfortunately you will have to get an external DDS with a faster DAC or just get signal generator. I ended up doing that, but may end up getting or building a DDS for the heck of it. There are many several MHz DDS chips out there, or you can do it in software, but you'll quickly find out software DDS runs out of steam pretty quickly... and you still need a good DAC.

                          I've been thinking about building this DDS at some point

                          http://www.myplace.nu/avr/minidds/index.htm

                          I'm sure there are other designs out there.

                          Comment


                            #14
                            Re: Generating a clock

                            There are premade sinewave generator on ebay starting around $10.00 http://www.ebay.com/bhp/sine-wave-generator
                            or build one using a 555 timer ic and clean up the output to get a sine wave.
                            or this one for $22.00
                            Attached Files

                            Comment

                            Working...