MSP430 Debounce software
- or -
Post a project like this4975
$$
- Posted:
- Proposals: 1
- Remote
- #34692
- Completed
Description
Experience Level: Intermediate
We monitor Utility meters & also things like Heat meters etc.
We have a number of inputs on a variety of target hardware.
They all use the MSP430, are usually battery powered.
There can be up to 16 inputs on ports1 & 2.
Take a look at the attached files.
We need the attached (or new) code tested & debugged.
The code has NOT been tested & probably won\'t work.
But I think the principle is OK.
The first part selects the inputs that will be debounced & is called from the rest of the system, so don\'t worry about this.
This function is used on a variety of target hardware with varying numbers of inputs that require debouncing. However they are always on Port 1 or Port 2.
This part of the function is probably OK but can be changed if required.
The second part is called at a few millisecond intervals (~ 2mS).
This timer only runs after an interrupt has been received from one of the inputs, it having changed state. (high or low).
Having sampled all the inputs it puts the status into an array.
Then checks to see if the same bits in the array are all high or all low, vertically if you see what i mean.
This is basically a shift register with each new sample being shifted in & the oldest drops out. So if the shift register is all 1\'s or all 0\'s we know the input is stable.
The last two functions are the interrupt handlers for Ports 1 & 2.
They start (or continue) the main debounce timer.
We need to catch both active high and low switches.
If we are monitoring an electricity meter we can see pulses up to 25Hz.
So I think 40mS is the longest switch bounce we could accomodate. My feeling is 30mS would be best ??
On the other had we have water & gas meters that are very slow.
We have a number of inputs on a variety of target hardware.
They all use the MSP430, are usually battery powered.
There can be up to 16 inputs on ports1 & 2.
Take a look at the attached files.
We need the attached (or new) code tested & debugged.
The code has NOT been tested & probably won\'t work.
But I think the principle is OK.
The first part selects the inputs that will be debounced & is called from the rest of the system, so don\'t worry about this.
This function is used on a variety of target hardware with varying numbers of inputs that require debouncing. However they are always on Port 1 or Port 2.
This part of the function is probably OK but can be changed if required.
The second part is called at a few millisecond intervals (~ 2mS).
This timer only runs after an interrupt has been received from one of the inputs, it having changed state. (high or low).
Having sampled all the inputs it puts the status into an array.
Then checks to see if the same bits in the array are all high or all low, vertically if you see what i mean.
This is basically a shift register with each new sample being shifted in & the oldest drops out. So if the shift register is all 1\'s or all 0\'s we know the input is stable.
The last two functions are the interrupt handlers for Ports 1 & 2.
They start (or continue) the main debounce timer.
We need to catch both active high and low switches.
If we are monitoring an electricity meter we can see pulses up to 25Hz.
So I think 40mS is the longest switch bounce we could accomodate. My feeling is 30mS would be best ??
On the other had we have water & gas meters that are very slow.
Simon C.
99% (32)Projects Completed
33
Freelancers worked with
33
Projects awarded
39%
Last project
13 Feb 2017
United Kingdom
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
There are no clarification messages.
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies