ADMUX/ADCSRA not declared in this scope

Status
Not open for further replies.

Zaite12

Member
Hi Folks,

I'm new to Teensy, I just bought one (3.1). I've been using Arduino up to now. I have Arduino 1.6.3 with Teensyduino installed. I'm just porting over a sketch and I'm encountering compile errors:

error: 'ADMUX' was not declared in this scope
error: 'ADCSRA' was not declared in this scope
error: 'ADCSRB' was not declared in this scope

Do you know what I need to include to reference these registers?

Thanks very much
 
Hi Folks,

I'm new to Teensy, I just bought one (3.1). I've been using Arduino up to now. I have Arduino 1.6.3 with Teensyduino installed. I'm just porting over a sketch and I'm encountering compile errors:

error: 'ADMUX' was not declared in this scope
error: 'ADCSRA' was not declared in this scope
error: 'ADCSRB' was not declared in this scope

Do you know what I need to include to reference these registers?

Thanks very much

There are no such registers, it's a completly different mcu. And it's ARM, not AVR.
Maybe it's better to describe what are you trying to do, then it's easier for us to help.
Or, post your sketch ?
 
There are no such registers, it's a completly different mcu. And it's ARM, not AVR.
Maybe it's better to describe what are you trying to do, then it's easier for us to help.
Or, post your sketch ?

Hi

I had a look at the sample ADC code on the website which was referring to these registers but I've just realised it's for Teensy 2.0. I'm hoping to set up the ADC in free running mode and record the voltage on an interrupt.

I'm also hoping to be able to set up interrupts for pin changes on the digital pins. Any guidance would be much appreciated.

Thanks very much
 
This is the example for AnalogInput :
Code:
/* Analog Input Example, Teensyduino Tutorial #4
   http://www.pjrc.com/teensy/tutorial4.html

   After uploading this to your board, use Serial Monitor
   to view the message.  When Serial is selected from the
   Tools > USB Type menu, the correct serial port must be
   selected from the Tools > Serial Port AFTER Teensy is
   running this code.  Teensy only becomes a serial device
   while this code is running!  For non-Serial types,
   the Serial port is emulated, so no port needs to be
   selected.

   This example code is in the public domain.
*/

void setup()
{                
  Serial.begin(38400);
}

int val;

void loop()                     
{
  val = analogRead(0);
  Serial.print("analog 0 is: ");
  Serial.println(val);
  delay(250);
}

I can't find an easy example for Pinchange at the moment, maybe the others can help....
 
Thanks. The digital side looks good as all pins have interrupt capability. On the analog I found (on the mega328) the analogRead() took a little while and caused other parts of the code which timed PWM pulses to jitter, so I switched to free running mode with interrupts. Should I do the same with the Teensy3.1 or does the analogRead() work in a different way? Perhaps it's a lot faster
 
Unless you are generating PWM in software I see no reason for jitter.
Can you tell more ?

I have been using the Arduino Servo library writeMicroseconds() function to control the servos. I'm guessing there is a way to do this on the Teensy3.1? (sorry for such newbie questions, it's just seems hard for a beginner to find info)
 
Status
Not open for further replies.
Back
Top