Serial.println("Hello") does not work in comb. with TIMSK2 setting


dear all,

i have following *.ino file running on uno rev. 3, see attachment. generates pulses @ 80khz , duty can adjusted via input a0.

why command "serial.println("hello")" not work in file?
when remove line; "timsk2 |= b00000010;     // set bits" serial.println() command working? however, interrupt not working.

what happens here?

kind regards,
rtrab


hello rtrab

code: [select]
isr(timer2_compa_vect) {  // isr @ ocr2a value
  int val = analogread(a0); // 10 bits = 1024
  val = val/4;
  ocr2b = constrain(val,5,190); // adjust duty between 5...190
} // end isr


that feels lot of code (i.e. lot of execution time) have in isr when, guess, serial port won't serviced.

just testing, reduce isr this, example, , see if serial works.

code: [select]
isr(timer2_compa_vect) {  // isr @ ocr2a value
  ocr2b = 100; // fixed value, testing
} // end isr


if help, try changing loop() uses "blink without delay" approach , move analogread(), division 4 , constrain loop().  isr read latest value via variable.

regards

ray


Arduino Forum > Using Arduino > Interfacing w/ Software on the Computer > Serial.println("Hello") does not work in comb. with TIMSK2 setting


arduino

Comments

Popular posts from this blog

opencv3, tbb and rasp pi 2 - Raspberry Pi Forums

small ethernet problem - Raspberry Pi Forums

Multithumb configuration params not working? - Joomla! Forum - community, help and support