Analogue read 4Mhz, and Write Out

Hello Guys,
is it possible to perform this act with my arduino Uno?,
read 4Mhz count with one pin, and Write it on the other pin

ulobab:
is it possible to perform this act with my arduino Uno?,
read 4Mhz count with one pin, and Write it on the other pin

If you read the Atmega 328 data sheet you will see that the ADC can operate at 15ksps at full resolution and 76.9ksps at low resolution. Neither is anywhere close to 4000ksps.

Even reading a digital I/O pin at 4MHz on a 16MHz microcontroller would be a challenge.

...R

Timer/Counter 1 can be clocked by an external signal and can certainly count at 4 MHz, but at that rate it will overflow about 60 times/second. This is useful for measuring the frequency of an external signal. See the ATmega328 data sheet, Timer/Counter 1 section for details.

For sampling an analog signal at 4 MHz, you will need a specialized external ADC and a much faster computer to control the module.

Yes, as said you can count.

Im not sure what your intentions are, perhaps you could describe your app in a bit more detail?

You could set a timer to output a 4MHz signal, with zero CPU interaction. I have done this up to 8MHz.
Does this analog signal needs to be analog or can it be converted and received as a digital signal? I mean whats the purpose of the analog data in, digital out? and why so many samples?

O yes even digital read inn one pin , digital Write out other pin, will do
because I am going to generate the 4Mhz externally and injected into the
processor to be distributed to some pin for special purpose

Whats the purpose of the "digitalwrite" out? I assume we are discussing about PWM.

But as mentioned earlier we need a description to know what your black box will do and advise the best options.

Is all about, Uno to distribute my generated frequency of 4Mhz periodically on two pins

ulobab:
Is all about, Uno to distribute my generated frequency of 4Mhz periodically on two pins

Then you do not need a micro controller at all. A simple buffer will do.

ulobab:
Is all about, Uno to distribute my generated frequency of 4Mhz periodically on two pins

4MHz in, 4MHz out?

If your arduino is your clock source I would advise you to set a timer to get a single 4MHz output. No software overload there, the timer can take care of that on its own. You can then use a buffer on the output if the current is not large enough. You DON'T need an input signal.

For two pins, you have to toggle them on an interrupt. You can set an input capture with the digital filter on timer one (which divides by four) and toggle two pins, or you can set timer 1 or 2 to count to 4 and generate an interrupt. Within the ISR again you toggle two pins.

Simple enough

In fact that 4Mhz frequency is modulated, is having intelligent signal
please be more detailed with the technics to help me

ulobab:
In fact that 4Mhz frequency is modulated, is having intelligent signal
please be more detailed with the technics to help me

Well please be more detailed with your question.

What sort of modulation?
Amplitude?
Frequency?
Pulse width?
Pulse position?

If you do not want the Arduino to do anything with this modulation between input and output then there is no need to use an Arduino. If you do want to do something between input and output the a Uno is not fast enough.

ulobab:
In fact that 4Mhz frequency is modulated, is having intelligent signal
please be more detailed with the technics to help me

Yes you really need to be more descriptive with what you need.

Have a think about what you want to do and provide all the parameters as Grumpy_Mike asked. First step to program is actually to know what you want the machine to do and so far you seem either very unsure or some bit is missing. So far i think we are all asking ourselves what is that you actually need/want to achieve.

With the information provided, sadly, we cant be more detailed than this

Ok at 1st period, this modulated 4Mhz would be needed at pin 1 to locate decoder 1. at 2nd period,
this modulated 4Mhz would be needed at pin 2 to locate decoder 2, on and on with erratic timed by
the Uno , I hope this imaginary picture would help a lot. Thanks

ulobab:
Ok at 1st period, this modulated 4Mhz would be needed at pin 1 to locate decoder 1. at 2nd period,
this modulated 4Mhz would be needed at pin 2 to locate decoder 2, on and on with erratic timed by
the Uno , I hope this imaginary picture would help a lot. Thanks

Sorry no those words convey no meaning at all.

ulobab:
Ok at 1st period, this modulated 4Mhz would be needed at pin 1 to locate decoder 1. at 2nd period,
this modulated 4Mhz would be needed at pin 2 to locate decoder 2, on and on with erratic timed by
the Uno , I hope this imaginary picture would help a lot. Thanks

It doesn't. I still don't understand what this modulated 4MHz signal is. Post an oscilloscope waveform attached as a image file.
And also what is the period? 1ms? 1 hour? Perhaps encoded on the signal?

Im sure if you pretend to achieve something with the arduino you know what your signal looks like and what the "slave" device expects.

O ok it is amplitude mod

It is Amplitude modulation, and instructed erratic timing 4milli second to 65 milli second

ulobab:
It is Amplitude modulation, and instructed erratic timing 4milli second to 65 milli second

Ok. You cant decode AM on the fly with an arduino, therefore I assume you have an ASK or an OOK signal already processed with suitable logic levels. I believe you will need find a sync pattern in order to do anything useful with it, specially at that frequency, for example count to a given number during a given time period, or a sync signal from your receiver itself to signal the start of a communication. That way the timer value could be used to decode that signal and switch the corresponding digital output, but even so I think you should have some logic gate (and gate) acting like a buffer enable, so instead of outputing the signal from the arduino, you would wire the input with all the receivers and the arduino would put a pin high or low to select one of them and let the signal pass trough (1x1=1, anything else, zero)

I am simply afraid thats a project that requires some time and a lot more information about this signals that you have provided so far, so not sure about the feasibility. Of course even the above is just my idea of achievement, depending what you already have for your input the required logic may need to be a lot different.

I read early part of your reply, and am saying the arduino serving as erratic timing distrubuter not as decoder,
the decoder of that modulator already there, but should work under the giving period of the arduino processor

ulobab:
I read early part of your reply, and am saying the arduino serving as erratic timing distrubuter not as decoder,
the decoder of that modulator already there, but should work under the giving period of the arduino processor

Yes, thats why I mentioned:

therefore I assume you have an ASK or an OOK signal already processed with suitable logic levels.

Still not clear about that bit tough:

ulobab:
and am saying the arduino serving as erratic timing distrubuter