Loading...
  Show Posts
Pages: [1]
1  Products / Arduino Due / Re: Problems reading an analog input and output with 12 bits resolution on: March 04, 2013, 09:52:13 pm
In fact I made a mistake when I wrote, the output of the DAC will be among 0.55V and 2.75V.
2  Products / Arduino Due / Re: Problems reading an analog input and output with 12 bits resolution on: March 01, 2013, 08:01:17 pm
       I wanted to know exactly the relation among the ADC (input) and the output (DAC) so I modify the sketch and multiply by 1.000.   This way with 0V at the input, it outputs to 0.55V (1/6) of 3.3V; 3.3V in the input, it outputs with 2.75V (5/6) of 3.3V.    So if the input is among 0 to 3.3V the output is among 0 to 2.75V linearly.   I think if someone wants a relation 1 to 1, between the input and the output, he needs to use operational amplifiers.  It follows my sketch.

Code:
/*
Read the value of the potentiometer (1.000V) at A0 and multiply
for 1.652 and output it at DAC1 both with 12 bits resolution
*/
float val = 0; // variable to store the value coming from A0
float val2 = 0;
int analogInPin = 0; // Analog input pin connected to the variable resistor
void setup()
{
analogReadResolution(12);
analogWriteResolution(12);
}
void loop() {
 
 val = analogRead(analogInPin); // read the voltage on the pot
val2=val*1.000;
analogWrite(DAC0,val2);
delay(5);
}
3  Products / Arduino Due / Re: Problems reading an analog input and output with 12 bits resolution on: February 24, 2013, 05:27:04 pm
    The problem is: I have is to emulate an analogical function control with amplifications, derivators, integrators, etc  So I need to perform mathemathicals operations, that is why I use float in my sketch.   I do believe that the DACs are linear between 0 to 3.3VDC i.e. the first grade 0 the next 0.00081VDC and so on.  That´s why I'm using the Due. I think my multimeter is not exact enough to mesure that.   Could someone elucidate that? 
4  Products / Arduino Due / Re: Problems reading an analog input and output with 12 bits resolution on: February 22, 2013, 09:19:38 pm
You don1t have to use map.   As you can see in the code.   Thank´s.
5  Products / Arduino Due / Re: Problems reading an analog input and output with 12 bits resolution on: February 19, 2013, 08:38:14 pm
I'll write again the code. It's just necessary to write this


Quote
/*
Read the value of the potentiometer (1.000V) at A0 and multiply
for 1.652 and output it at DAC1 both with 12 bits resolution
*/
float val = 0; // variable to store the value coming from A0
float val2 = 0;
int analogInPin = 0; // Analog input pin connected to the variable resistor
void setup()
{
analogReadResolution(12);
analogWriteResolution(12);
}
void loop() {
 
 val = analogRead(analogInPin); // read the voltage on the pot
val2=val*1.625;
analogWrite(DAC0,val2);
delay(5);
}
6  Products / Arduino Due / Re: Problems reading an analog input and output with 12 bits resolution on: February 19, 2013, 08:33:14 pm
It´s just necessary to write the followig code
[quote/*
Read the value of the potentiometer (1.000V) at A0 and multiply
for 1.652 and output it at DAC1 both with 12 bits resolution
*/
float val = 0; // variable to store the value coming from A0
float val2 = 0;
int analogInPin = 0; // Analog input pin connected to the variable resistor
void setup()
{
analogReadResolution(12);
analogWriteResolution(12);
}
void loop() {
 
 val = analogRead(analogInPin); // read the voltage on the pot
val2=val*1.625;
analogWrite(DAC0,val2);
delay(5);
}][/quote]
7  Products / Arduino Due / Problems reading an analog input and output with 12 bits resolution on: February 16, 2013, 06:01:51 pm
      I´m trying to read 1.000 V at A0 (analog input) wjth 12 bits resolution, multiply by a factor of 1.625 and output it at DAC1 but it doesn't work. The sketch follows, please help me. Thanks a lot.
Code:
/*
Read the value of the potentiometer (1.000V) at A0 and multiply
for 1.625 and output it at DAC1 both with 12 bits resolution
*/
float val = 0; // variable to store the value coming from A0
float val2 = 0;
float outputValue =0;
int ananalogInPin = 0; // Analog input pin connected to the variable resistor
void setup()
{
// nothing in setup
}
void loop() {
 
 val = analogRead(analogInPin); // read the voltage on the pot
analogReadResolution(12);
val2=val*1.625;
analogWriteResolution(12);
outputValue = map(val2,0,1023,0,4095);
  analogWrite(1,outputValue); //write at DAC1
}
8  Using Arduino / Programming Questions / Read an analog input multiply for 1.625 and output in the DAC1 with the Due on: February 14, 2013, 07:31:02 pm
     Excuse-me it is the first time I post in the Forum. I'm using the Arduino Due and trying to read 1.000 VCC in the analog input (A0) with resolution of 12 bits and multiply with the factor 1.652 and output it in the DAC1 with 12 bits. The sketch follows but I tried many times and haven't achieved to write here in the standart form.   

Code:
[//Read the value of a potentiometer and multiply for 1.625
// and output it in the DAC1

float val = 0; // variable to store the value coming from the sensor
float val2 = 0;
float outputValue =0;
const int analogInPin = 0; // Analog input pin connected to the variable resistor
void setup()
{
// nothing in setup
}
void loop() {
 
 val = analogRead(analogInPin); // read the voltage on the pot at A0
analogReadResolution(12);
val2=val*1.625;
analogWriteResolution(12);
outputValue = map(val2,0,1023,0,4095);
  analogWrite(1,outputValue);// write the analog output ADC1
}code]
Pages: [1]