Disable all interrupts, with delay() and Serial.print - question


hi all.

this question learning only. it's observation, , trying understand what's happening in wings.

i have short arduino program. and, in setup area, disable interrupts cli();

i set delay of 30 seconds .... delay(30000);

next, have serial.print line meant print 'ready' on serial monitor screen.


when load code arduino uno, characters 're' show in serial monitor, first 2 characters of 'ready'. characters 're' appear pretty after firing serial monitor, there's no long 30 second delay or anything.

i have read disabling interrupts affect timer0 , serial activity (that requires interrupts). , delay function gets affected well.

does know causes 're' show on serial monitor (and no delay noticed)? because disabled features shouldn't disabled if want use delay() etc? , why 're' gets through..... instead of 'r' or 'rea' etc?

here's short code uno running on serial monitor @ 115200 bit per second :

code: [select]

#include <avr/io.h>
#include <stdint.h>            // has added use uint8_t

#include <avr/interrupt.h>    // needed use interrupts    

void setup()
{    
    cli();  //disable interrupts
    delay(30000);  //30 second delay
    serial.begin(115200);
    serial.println("ready");
}


void loop()
{


}




thanks all.







with no interrupts, serial() function/class whatever has no way know when byte has been transferred out.
delay() not work 4us time interrupt makes basis of delaymicroseconds() , delay() turned off.

there's no reason turn off interrupts unless have needs run fast, blasting out string of bytes on spi need synced start pulse , interrupt tick upsetting smoothness of blast of bytes.  and need protocol analyzer or oscilloscope able determine that.


Arduino Forum > Using Arduino > Programming Questions > Disable all interrupts, with delay() and Serial.print - question


arduino

Comments

Popular posts from this blog

Flip address is out of range arduino uno r3

Arduino Uno not uploading

Indesign and MathType fonts