Serial read in an ISR


is possible use serial.available() or serial.read() inside isr?

i have isr running timer interrupt. when condition met, want program halt until key pressed.

i can halt program while(digital.read()==0) loop using hardware button, want wait serial input (a key pressed on keyboard).

my attempt while(serial.available()==0) doesn't work inside isr; however, works fine in loop() or setup(). why?

my initial guess interrupt priority serial functions low not sure. can tell me is?

how can this?

thanks

you don't ever want freeze code in interrupt.  that's going bad idea.  interrupts should short, sweet, , fast fast fast.  in, quick, , out.  should never ever involve waiting around anything. 

as why doesn't work, serial data relies on interrupts work.  interrupts not running while interrupt being serviced.  serial stuff can't happen there. 

if can describe better you're trying accomplish , share code you're using, can give idea work.


Arduino Forum > Using Arduino > Project Guidance > Serial read in an ISR


arduino

Comments

Popular posts from this blog

Valutazione Template - Joomla! Forum - community, help and support

SD Datastring Convention

First use of Arduino Uno : avrdude error on Blink uploading