Neetee 0 Posted February 27, 2017 Share Posted February 27, 2017 Hello all I read all the posts on this forum as said in suggestions So with this i came across an idea. Can some one tell that if i make my data aquisition system interrupt enabled This means taking value from adc will be normal calculation for flowrate will be also normal But when ever i need to show totaliser count that will be interrupt enabled can some one help. Really need help . Quote Link to post Share on other sites
energia 484 Posted February 27, 2017 Share Posted February 27, 2017 I am not quite sure what you are asking. Can you explain what you want interrupt enabled and what should happen in the interrupt service routine? Quote Link to post Share on other sites
Neetee 0 Posted February 28, 2017 Author Share Posted February 28, 2017 Ok let me tell you I am trying to design a menu system which is user interface for my device I have already designed it But the data aquisition should be independent of any key press Thus either i need to make my keys interrupt enabled or adc but as i read yesterday i cannot make adc interrupt enabled as it I also tried to make keys interrupt enabled and it worked yesterday partially Now i will try to make it work full and will post the results Quote Link to post Share on other sites
Neetee 0 Posted February 28, 2017 Author Share Posted February 28, 2017 If i press key it should directly switch to menu option it is working but partially working Quote Link to post Share on other sites
chicken 630 Posted February 28, 2017 Share Posted February 28, 2017 Is there a specific event when you must read the ADC? If not, just make one main loop that reads keys and ADC. Reading the ADC should only take a fraction of a second. Quote Link to post Share on other sites
Neetee 0 Posted February 28, 2017 Author Share Posted February 28, 2017 I will post my code It is bit messy But check it Quote Link to post Share on other sites
dubnet 238 Posted February 28, 2017 Share Posted February 28, 2017 @@Neetee Some suggestions for you so that you can better be helped by the users on the forum: Provide the Launchpad you are using, as well as any Boosterpacks. Provide your code - it is difficult to understand what is happening without this. Explain what is working and what isn't working. And if something isn't working, what exactly is happening and what you have already tried in an attempt to get it working. If you are using any of your own circuits besides the basic Launchpad, please detail that with a schematic. If possible provide a photo of your setup. Sometimes issues have been spotted with this additional information. The upside for you is that you will get more useful information in a shorter time frame. EDIT: Apparently @@chicken posted while I was composing this post. Quote Link to post Share on other sites
Neetee 0 Posted February 28, 2017 Author Share Posted February 28, 2017 Ok Launch pad i am using is msp430f5529 I am designing menu system menu system is working perfectly fine without interrupt I am operating this with mobile thats why cannot post my code right now but will surely do it in next few hrs I am trying to design a flow integartor totaliser Adc value should be detected irrespective of any key press There are 3 for loops in side my data processing routine they are affecting key detection out side data processing routine So i am trying to desing intrupt based key detection So that key will be detected with interupt My key is attached to P2_0 As this is the key which allows me to enter my programming menu to set some parameters Quote Link to post Share on other sites
Neetee 0 Posted February 28, 2017 Author Share Posted February 28, 2017 I am trying to execute interrupt with key press so what should it do Should i check the keypress inside Quote Link to post Share on other sites
energia 484 Posted March 1, 2017 Share Posted March 1, 2017 Did you already try using attachInterrupt() http://energia.nu/AttachInterrupt.html. volatile int state = HIGH; volatile int flag = HIGH; int count = 0; void setup() { Serial.begin(9600); pinMode(GREEN_LED, OUTPUT); digitalWrite(GREEN_LED, state); /* Enable internal pullup. * Without the pin will float and the example will not work */ pinMode(PUSH2, INPUT_PULLUP); attachInterrupt(PUSH2, blink, FALLING); // Interrupt is fired whenever button is pressed } void loop() { digitalWrite(GREEN_LED, state); //LED starts ON if(flag) { count++; Serial.println(count); flag = LOW; } } void blink() { state = !state; flag = HIGH; } Quote Link to post Share on other sites
Neetee 0 Posted March 2, 2017 Author Share Posted March 2, 2017 I tired this sir but it is not working Quote Link to post Share on other sites
Neetee 0 Posted March 2, 2017 Author Share Posted March 2, 2017 I am using msp430f5529 launch pad every one suggested me this example Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.