How can i set an interrupt to read a value then set an output pin low immediately.
I have relay which is switched on at a button push and must be switched off as soon as a load cell matches a value. It is also writing to the lcd at the same time.
What I get is a delay from when the load cell reaches its desired weight to when the relay is switched off.
can I use an internal interrupt to read the load cell and interrupt the lcd write and switch the relay off.
Circuit? Code? Where is the "load cell value" coming from?
Questions questions question...
they sound like straight up homework questions
thailoz:
How can i set an interrupt to read a value then set an output pin low immediately.
I have relay which is switched on at a button push and must be switched off as soon as a load cell matches a value. It is also writing to the lcd at the same time.
What I get is a delay from when the load cell reaches its desired weight to when the relay is switched off.
can I use an internal interrupt to read the load cell and interrupt the lcd write and switch the relay off.
I suspect there is no need for an interrupt if the code is written properly.
But as you did not post your program is it a bit difficult to help.
...R
thailoz:
How can i set an interrupt to read a value then set an output pin low immediately.
I have relay which is switched on at a button push and must be switched off as soon as a load cell matches a value. It is also writing to the lcd at the same time.
What I get is a delay from when the load cell reaches its desired weight to when the relay is switched off.
can I use an internal interrupt to read the load cell and interrupt the lcd write and switch the relay off.
Is an interrupt needed? Sometimes polling can be faster than interrupting, depending on the nature of the input, and what else your device needs to do. Specifically, how much time can elapse between reaching the load cell threshold and switching the output? And is this the only thing this device does:
read load -> display load -> switch output off if load is greater than threshold -> repeat
If so, then just check the input every time through loop (aka polling) and display it. Then do an 'if (load > threshold)' test, and turn the output off if it's true.
If you have a lot of other stuff to do, or the arrival of true states is fast and erratic, then you might need a hardware interrupt. But usually, it's not needed.
arduino_new:
they sound like straight up homework questions
I assumed it was for a 200 mile an hour, rolling steel mill. The load cell is measuring lateral forces on the rollers. The switched output goes to a programmable logic device that regulates the speed of the mill.
Or it could be a homework problem, but it would make a great homework problem.
Thailoz: Are you a student? (btw, 'yes' is not a disqualifier.)