Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ Programming
➜ General
➜ read() in interrupt?
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Jens
(2 posts) Bio
|
| Date
| Thu 04 Dec 2014 08:58 AM (UTC) |
| Message
| Hi
I've read on one of your other threads http://www.gammon.com.au/forum/?id=11488, that I shouldn't "try to do serial reading." in an ISR. I wanted to read some sensor values in a timer interrupt on an Arduino Mega2560, but encountered some serious issues doing so. The code/Arduino simply stops. I've now tried to do a workaround using some flags for the ISR and then implemented my main() as a state machine, but I would really like to know why I can't read in the ISR. I looked into the HardwareSerial class, and to me it looks like the read() function is only returning the data that is already in the rx buffer - I don't see it using any interrupts?
I hope someone can clarify why I can't get this to work the way I want it to :)
Best regards
Jens | | Top |
|
| Posted by
| Fiendish
USA (2,558 posts) Bio
Global Moderator |
| Date
| Reply #1 on Thu 04 Dec 2014 04:11 PM (UTC) |
| Message
| Nick is probably going to ask you to post in the arduino forums. :)
|
https://github.com/fiendish/aardwolfclientpackage | | Top |
|
| Posted by
| Jens
(2 posts) Bio
|
| Date
| Reply #2 on Thu 04 Dec 2014 05:15 PM (UTC) |
| Message
| | The thread I linked is from this forum and it describes interrupts on Arduino, so I hope you/he can/will help me :) | | Top |
|
| Posted by
| Fiendish
USA (2,558 posts) Bio
Global Moderator |
| Date
| Reply #3 on Thu 04 Dec 2014 05:46 PM (UTC) Amended on Thu 04 Dec 2014 05:52 PM (UTC) by Fiendish
|
| Message
| I understand, and yet...
The Microprocessors section of the forum is just a place where Nick can post interesting writeups about projects he's working on. It's set to Administrator posting only to try and prevent people from asking questions here instead of the arduino.cc forum.
The top of the page at http://www.gammon.com.au/forum/bbshowpost.php?bbtopic_id=123 says "Please post questions about electronics on the The Arduino Forum"
And if you search the forum for "Please post Arduino-related questions to the Arduino Forum" you'll find that all Arduino questions get the same instruction. ( https://www.google.com/search?q=%22Please+post+Arduino-related+questions+to+the+Arduino+Forum%22&btnG=Google+Search&domains=www.gammon.com.au&sitesearch=www.gammon.com.au&gws_rd=ssl ) |
https://github.com/fiendish/aardwolfclientpackage | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #4 on Thu 04 Dec 2014 08:21 PM (UTC) |
| Message
|
Jens said:
The thread I linked is from this forum and it describes interrupts on Arduino, so I hope you/he can/will help me :)
And I'm hoping you will post your question on the Arduino forum. I do not want to start a competing Arduino-related forum here (especially as the current one is a bit flaky, and I bet this would get quite a bit of traffic).
Please post your question on the Arduino forum in the Programming Questions section, and to save me asking you there to do it, post the code in question, inside code tags. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
21,374 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top