Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

generating a 1mhz clock signal from computer?

Status
Not open for further replies.

david90

Advanced Member level 1
Joined
May 5, 2004
Messages
423
Helped
9
Reputation
18
Reaction score
4
Trophy points
1,298
Activity points
3,611
gegerating clock with parallel port

Is it possible to write a program that would generate a clock signal to the serial port so I could use it to run a MCU?
 

Yes,some controller like the MSP430 have clock outpin that can be source the internal FLL or Clock oscilator you can use this output as a signal clock.

Otherwaise it is not good idea to generate clock signal using software rotuine because the clock signal genereted can be inerrupted form inside the processor

best


Bobi
 

not what I meant.

I want the computer to generate the clock signal so I can input it into an AVR not the other way around :)
 

David.. David ... are you kidding us !

Is like you want to use the power of a runing engine to start the same engine !
 

Anyway, the simple answer is no, because a) the RS232 drivers won't switch that fast (115kbaud equivalent to 57.5khz is pushing it) and b) they couldn't be continually toggled that fast from a PC, unless it was doing nothing else; if it was doing nothing else, it would probably be cheaper to put a crystal on the AVR!

It might be posible to get 1MHz from the parallel port (at least the drivers might switch faste enough), but the PC couldn't do anything else while it was doing this.

Why do you want to generate the clock signal from your PC?
 

ok so a 6mhz clock won't work. How would I make a 1khz clock from serial port?
 

As far as RS 232 as asynch protocol and works with start and stop bit s plus there is no garranty that PC will provide contiguous data flow on COM port there is possibility that this wont work reliably .
Well if you still willing to use the data port , write a program sending continous flow of bytes to R232 port as the data value should allow to separate the Start bit . Thus will allow you to easy filter start bit
out and use as input to schimtt trigger before sending to AVR osc input . When you will define 9600
kbod rate , output must be something 1 KHz . But pay attention to pulse form requirement - yiou may need to divide it but before using as osc source if mcu osc requires square pulse .
You can try to manipulate value of data to send - let say include code with 1010101 sequence so you can change the output freq up to some extent via sent data manipulating (not using port speed settings )

In addition you can use RS 232 hardware handshake signals .
 

If you transmit 0xf0 continuoulsy at 9600 baud, in 8-bit, no parity, 1 stop (i.e. a total of 10 bit times per transmitted character), this will give you a square wave at a frequency of 960Hz.

Simplest way to do this is to use Visual Basic and a serial port control; you should be able to get fairly reliable data transmission, or at least if you send (say) 100 characters at a time, those one hundred will come out pretty well together, and you should be able to get (in the best case) no gaps at all.

HTH
Barny
 

Hi,

try using the parallel port for frequency generation, much more controllable, can obtain few hundred KHz, using the API functions QueryPerformanceFrequency and QueryPerformanceCounter to calculate the timings necessary for a certain output frequency, on a certain CPU. It will generate pretty accurate frequency, independent of the CPU frequency if correctly implemented. Many nice examples can be found on the net.

Regards
 

david90 said:
I want the computer to generate the clock signal so I can input it into an AVR not the other way around :)

no problem, use pci bus :D
 

If you want a reasonably stable clock, the PC's standard software-controlled ports will give you grief. How about buying a counter-timer board and plugging it into your computer? For example:
**broken link removed**
 

You can try coding in pure DOS-mode assembly, using the motherboard's onboard timer.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top