buffer/sustain input

Status
Not open for further replies.

yohanevindra

New Member
i need to do a project which consists of inputs and outputs..the inputs are coming from other devices, of which I am not sure how long the the duration of the input signals will be.

is there a way that I can "buffer" or sustain the input signals until they're read by the microcontroller? (i'm using an arduino mega 2560 board)

I was thinking of using a D Latch, with the interrupt routine setting the memory and then clearing the latch once the inputs are read.

or is there a better/easier way?
 
Without knowing the duration or at least the range of the input signal duration there is no way to answer your question.
 
Last edited:
range? well the input signal will be between 0-5V.

cant I setup an interrupt to store the state when one pin goes high?

just tell me what options are there for me?depending if the duration is in the order of miliseconds, 100s of miliseconds or more than a second.
 
Duration == time
micro if not nano seconds is possible with modern micro controllers.
 
Last edited:
the datasheets/manuals that I have for the devices dont specify the duration. so if we assume the duration can be between 0-10ms,10ms-100ms,100ms-500ms,500ms-1s,1s-2s,2s+ what are my options?

can i use a d latch?or what else?
 
0ms? No not possible, the lower time limit has to be above the micro controllers timer modules resolution. A few micro seconds is practical. There is no reason to delay anything. the micro controller should easily be able to detect these signals with no other circuitry.
 
What happens if the microcontroller is in another function and during that period a set of inputs change (to 10011) and then reset to 00000. When the microcontroller reads the inputs will it be 00000 or 10011?

That is my problem.

If you know of some digital signal buffer/storage method can you please tell me? Can I use a D latch?
 
Certainly a D latch will hold a digital signal value if you have a clock to control the latch and grab the signal at the proper time.
 
If you know of some digital signal buffer/storage method can you please tell me? Can I use a D latch? Certainly a D latch will hold a digital signal value if you have a clock to control the latch and grab the signal at the proper time.

Yes but you will still have the same problem if the input changes more often than you read the D latch. That is why you need to KNOW the duration.
 
I'm now thinking whether to have another PIC capture the inputs and feed it to the arduino.

My plan was for the microcontroller to enable input and when the latch reads disable and store in memory
 
My crystal ball sees some confusion here. We have no idea what your trying to do.

Take this example. Someone pushed a button vs. Someone pushed a button when I was busy. When was the button pushed? vs. When did the peak of an analog signal occur? or just where was the 100 ns glitch?

These are very different kinds of problems.

Let's take the someone pushed a button when I was busy since I'm guessing this might be the type of signal we are talking about.
Pushing buttons has some debouncing stuff to deal with, so lets just assume, for now, that hardware gives us a nice clean 10 mS pulse and it's not the real world.

The button would be set up to generate an interrupt. An ISR (Interrupt service routine) suspends what the process was doing, sets the act that a button pushed occurred and restores the state of the processor.

Now, when the processor is finished with what it was doing, it checks to see if a button was pressed. It then deals wit that issue.
 
Pardon me if I'm missing something obvious here, but doesn't the Arduino have an interrupt pin? Shouldn't you be using that to capture your input? Your interrupt service routine can read the input and store it directly in memory.
 
Hi.sorry for the confusion.yes my worry is about the "I got an input signal while I was busy"

I know the arduino has interrupts. My worry is that when the arduino is within one ISR what happens if I get another input signal?

I'm interfacing an arduino to three other devices and I'll set it such that the three interrupt pins are for each device and will detect a change. But what happens if the device is servicing one ISR when another interrupt occurs?
 
Instead of controlling the D latch through a clock, can't I control it through a microcontroller?
The clock is just a digital latch signal. You can obtain it from any source that can generate the digital latch signal at the proper time (assuming you can determine what the proper time is).
 
An ISR by definition, doesn't do much. It's usually disable interrupts. Do something very short. Enable interrupts.

You can generally think of the processor latching the input until it's read. Hence it's not missed.

Interrupt Latency is used to describe the time it takes to respond to an interrupt. The processor has to save the state of the machine. In one simple architecture only the stack pointer and program counter are saved automatically. You need to save everything else. Interrupts may have priorities associated with the inputs as well.

In a RTOS or Real Time Operating System, the scheduler determines what happens next.
 
My plan is to have interrupts to detect the change in inputs and then the ISR will be to transmit the data to the PC via serial. Is that ISR too long?

And does the microcontroller "latch" the input on any pin?or just the interrupt enabled pins? So no buffer is needed?
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…