Jump to content
Sign in to follow this  
Nikromante

How to make enable adc 12bits and not default adc (MSP430) ?

Recommended Posts

Hello everyone, I have a problem with Energia and my MSP430F5529, this micro is enable to use 12bits ADC, but I can't find the way to make it enable that configuration because Energia runs my code in default 10bits ADC, some one can tell me how can I configure the ADC to use 12 bits resolution??, this is my code:
 

#include <Servo.h> 
 
Servo servo;   
 
int potpin = 23;  
int volt, i;        
 
void setup() 
  servo.attach(19);        
 
void loop() 
  volt=analogRead(potpin);
  i=volt/6;                                       //I'ms using 6, because 1023/6 = aprox ? 180 steps that I need. I want to use 4095/23  ? 180 steps
  servo.write(i);
  delay(100);

My code is working, but is working with 10bits resolution, and I need 12bits.Thanks for attention to my post ^^

Share this post


Link to post
Share on other sites

Hello @@Nikromante,

 

Energia uses 12 bits with the MSP430F5529.  Try this sketch and use the serial monitor to see the values change as you turn the potentiometer.

int potpin = 23;  
  
void setup() 
{ 
    Serial.begin(9600);
} 
 
void loop() 
{ 
    Serial.println(analogRead(potpin));
    delay(100);
} 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×