nzmxp
May 11, 2021, 8:28am
1
HELLO THERE
I want to control two mcp4725 dac with arduino
I could not find a sample project that works with two addresses and gives analog 0-5 outputs.
Let's try to write an example code with two addresses.
to a rookie like me
Can you help me ????
The the last bit( LSB ' 'L), sent following the address bits, is ignored as it is the read write bit (R/Wn). Therefore the addresses with only A0 available as an address control are:
0x60, 0x61
For each device you can set A0 to one or zero. The rest (A1 and A2) are specified on purchase.
nzmxp
May 11, 2021, 8:32am
2
Pardon
The following articles are excerpts
The the last bit( LSB ' 'L), sent following the address bits, is ignored as it is the read write bit (R/Wn). Therefore the addresses with only A0 available as an address control are:
0x60, 0x61
For each device you can set A0 to one or zero. The rest (A1 and A2) are specified on purchase
Your post was MOVED to a more suitable location.
Could you also review How to get the best out of this forum as it will help you find your way around.
nzmxp
May 11, 2021, 9:54am
4
Share a link
moved address
Excuse me
Site has been renewed
I have no idea what you mean
Do you have a comment or maybe a question ?
Wawa
May 11, 2021, 10:09am
6
Try something like this.
in setup()
dac1.begin(0x60); // add pin grounded
dac2.begin(0x61); // add pin to vcc
Then use dac1 and dac2 throughout your code.
Leo..
nzmxp
May 11, 2021, 10:45am
7
Okay, I got it
I'll write an example, I'll share the code
I will share a sample picture
nzmxp
May 11, 2021, 10:50am
8
I am using normal mcp4725
adafruid
I don't use it, wrong
is an excerpt
We may have a language problem here
@nzmxp what is your native language ?
nzmxp
May 11, 2021, 12:59pm
11
I need to pay attention to the translations
google translation language
OK. I was hoping that there would be a suitable International section of the forum where you could interact more easily, but there isn't
nzmxp
May 11, 2021, 1:10pm
13
thanks for the warning
,,, UKHeliBob ,,,
I sent questions. Does anyone want to answer?
Of course, we have an understandable common language, even if there is no full translation. !!!
Hi,
Welcome to the forum.
Have you programmed an Arduino before?
Are you familiar with C++ language?
What hardware do you have?
We need a answer so we know where to start helping you with your coding.
Thanks.. Tom...
nzmxp
May 12, 2021, 12:12pm
15
hello TomGeorge
I'm new to Arduino, amateur I haven't made software with c ++ in these languages I am someone who deals with electronic pcb repair
you have a very popular title of teacher
There are so many things we need to learn from you, as a newcomer to ardunio.I wanted you to help me. I have a question.
sensorValue = analogRead (rdtt2); // the input has been set for pwm if the value is entered:
rdtt2 = map (sensorValue, 0, 1023, 0, 255); // map out:
I want it to increase with a delay every 8 values by dividing the 8bit voltage that rises up to 0,255 in the sample code.
(0, 1023, 0,8, delay, 16, delay, 32, delay, 64, delay, 128, delay ........... more ........ .... up to ... 255);
My teacher, I tried to make it understandable. If you help me, can you share a code that can do this with the sample code.
thanks
nzmxp
May 12, 2021, 1:00pm
16
#include<Wire.h> //Include kutuphane ı2 data Wire
#define MCP4725 0X60
#define MCP4725 0X61
unsigned long adc; // 12 bıt cevirici :
unsigned long adc1; // 12 bıt cevirici :
unsigned long buffer[3]; // adc buffer tampon :
unsigned int sensorValue = 0; // value map read:
unsigned int termcup1 = A3 ; // input swic ccommp:
unsigned int rdtt2 = A2 ; // input swic cmp:
unsigned int compr1 = A0 ; // input rdt ccommp:
unsigned int compr2 = A1 ; // input rdt cmp:
byte rb=4; // led output:
byte rg=5; // led cıkısı:
byte hr=6; // led cıkış :
byte trp=2; // tr out:
byte trn=3; // tr cıkış :
byte opaa=8; // opa cıkış :
byte set=10; // opa cıkış :
const byte opampPin = 7; // buton opamp 1-0 gırış:
const byte opaPin = 9; // buton opamp 1-0 gırış:
void setup()
{
pinMode(opaPin, INPUT); // buton gırış modlar :
pinMode(opampPin, INPUT); // buton gırış modlar :
pinMode ( set, OUTPUT ); // swiccc :
pinMode ( trp, OUTPUT ); // swiccc :
pinMode ( trn , OUTPUT ); // swicc :
pinMode ( opaa , OUTPUT ); // swicc :
pinMode (rb,OUTPUT); // algılama sensor :
pinMode (rg,OUTPUT); // algılama :
pinMode (hr,OUTPUT); // algılama :
Wire.begin(0x60);
Wire.begin(0x61);
Wire.setClock (400000); // frekansı yuselt:
}
void loop() {
adc = analogRead(A6); // anolog gırısı adc ye cevır :
adc = map(adc,0,1023,4095,0); // voltaj gırışını 4095 böl cıkısa aktar harıtaya gore :
buffer[0] = 0b01000000; //Set bit buffer0 with:
buffer[1] = adc >> 4; //Puts gırış 10 bıt oldu için 4 bıt ekle most :
buffer[2] = adc << 4; //Puts 2 bıt eksılt 12 bıte tamamla Least:
Wire.beginTransmission (0x60); // I2C bus:
Wire.write(buffer[0]); //Sends :
Wire.write(buffer[1]); //Sends MSB to I2C :
Wire.write(buffer[2]); //Sends LSB to I2C:
Wire.endTransmission(); //Ends son verı hattı :
{
adc1 = analogRead(A7); // anolog gırısı adc ye cevır :
adc1 = map(adc1,0,1023,0,4095); // voltaj gırışını 4095 böl cıkısa aktar harıtaya gore :
buffer[0] = 0b01000000; //Set bit buffer0 with:
buffer[1] = adc1 >> 4; //Puts gırış 10 bıt oldu için 4 bıt ekle most :
buffer[2] = adc1 << 4; //Puts 2 bıt eksılt 12 bıte tamamla Least:
Wire.beginTransmission (0x61); // I2C bus:
Wire.write(buffer[0]); //Sends :
Wire.write(buffer[1]); //Sends MSB to I2C :
Wire.write(buffer[2]); //Sends LSB to I2C:
Wire.endTransmission(); //Ends son verı hattı :
if ( adc1<=2070 ){ //pot insan ısı veya normal cısım 12 bit :
digitalWrite(set, HIGH);
} else {
digitalWrite(set, LOW);
delay (5); // gecıkme end:
}
{
sensorValue = analogRead(rdtt2); // gırış pwm için ayalandı gırıse gore value:
rdtt2 = map(sensorValue, 0, 1023, 0, 255); // harıta out:
delay (4) ; // tım :
if ( sensorValue<=10 ){ //pot insan ısı veya normal cısım 50:
digitalWrite(rb, LOW);
} else {
digitalWrite(rb, HIGH);
delay (100) ; // tım :
digitalWrite(rb, LOW);
delay (100) ; // tım :
digitalWrite(rb, HIGH);
delay (100) ; // tım :
digitalWrite(rb, LOW);
{ unsigned int compr1 ,compr2 ; // karsılastrıcı :
compr1 = analogRead ( A0) ;
compr2 = analogRead ( A1) ; // sensor rdt ısı alarmı :
if (compr1 <= compr2 )
digitalWrite (8 ,LOW);
else
digitalWrite (8 ,HIGH);
delay (5) ; // tım :
if (digitalRead (7&&9)==HIGH)
digitalWrite (2&&3,HIGH);
else
if (digitalRead (7&&9)==LOW)
digitalWrite (2&&3,LOW);
delay (5) ; // tım :
}
}
}
}
}
I compiled the code, I compiled it without any problems. Are there any errors?
There are some additions that I would like to add to the code sample
0, 1023, 0, 8, militia ??? militia ... 255); 100 ms delay seems sufficient
I want to increase with delay when rising 0-5v
system
Closed
September 9, 2021, 1:01pm
17
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.