i am sorry if i am asking a silly question but i am new to arduino..I am using arduino due board and when i am using cli and sei functions to clear and set interrupt flags, after i verify the code it is showing that cli and sei functions are not declared in the scope..can anyone please tell me how to solve this??
Post your code (using the "#" CODE TAGS toolbutton.
If you know how to post your compiler verbose output attach that as well.
void setup(){
Serial.begin(115200);
cli();
TCCR1A=0;
TCCR1B=0;
TCNT=0;
OCR1A=60;
TCCR1B|=(1<<WGM12);
TCCR1B|=(1<<CS12)|(1<<CS0);
TIMSK1|=(1<<OCIEA);
sei();
}
ISR(TIMER1_COMPA_vect)
{
intval=0;
Serial.write("A");
val=map(analogRead(A0),0,1024,0,255);Serial.write(val);
val=map(analogRead(A1),0,1024,0,255);Serial.write(val);
val=map(analogRead(A2),0,1024,0,255);Serial.write(val);
val=map(analogRead(A3),0,1024,0,255);Serial.write(val);
Serial.write("z");
}
void loop()
{
// put your main code here, to run repeatedly:
}
this is the compiler error message
sketch_may05a.ino: In function 'void setup()':
sketch_may05a:3: error: 'cli' was not declared in this scope
sketch_may05a:4: error: 'TCCR1A' was not declared in this scope
sketch_may05a:5: error: 'TCCR1B' was not declared in this scope
sketch_may05a:6: error: 'TCNT' was not declared in this scope
sketch_may05a:7: error: 'OCR1A' was not declared in this scope
sketch_may05a:8: error: 'WGM12' was not declared in this scope
sketch_may05a:9: error: 'CS12' was not declared in this scope
sketch_may05a:9: error: 'CS0' was not declared in this scope
sketch_may05a:10: error: 'TIMSK1' was not declared in this scope
sketch_may05a:10: error: 'OCIEA' was not declared in this scope
sketch_may05a:11: error: 'sei' was not declared in this scope
Include relvant header file. and also you not specified 'cli () function going to do
thank you..wil search for the header file..but the code works fine for arduino uno board without errors(we didint add any header file)..
but our professor insists we work on arduino due..can u please tel me why the code works for arduino uno bur not for arduino due
I have no idea why it works on one and not the other. Both of them should have, at the top
#include <Arduino.h>
but the code is giving the same error even after adding the header file..is there any other header file to be added??