Hi
Im doing a proyect using three digtal potenciometers x9c503.
Im using the librery. With one potenciometer all right but i dont know how programing for three potenciometers.
Any idea?
Regards
Hi
Im doing a proyect using three digtal potenciometers x9c503.
Im using the librery. With one potenciometer all right but i dont know how programing for three potenciometers.
Any idea?
Regards
Any idea?
Tell us which library, post your code.
... And when you post your code:
To post code and/or error messages:
Before posting again, you should read the three locked topics at the top of the Programming Questions forum, and any links to which these posts point.
If your project involves wiring, please provide a schematic and/or a wiring diagram and/or a clear photograph of the wiring.
Good Luck!
Each pot needs its own CS signal (output pin). Enable a pot by driving its CS low, then drive the U/D and INC pins as for a single pot.
DrDiettrich:
Each pot needs its own CS signal (output pin). Enable a pot by driving its CS low, then drive the U/D and INC pins as for a single pot.
Why not have the U/D pins tied together and have separate CS control lines? With CSh, U/D commands are ignored. It might save a lot of pins and code by only having to select one of three CS lines and use the same U/D for all.
tinman13kup:
Why not have the U/D pins tied together and have separate CS control lines?
Right, the other lines are all connected in parallel, only CS must be separated.
Thanks for the reminder, this part got lost while editing my preceding reply.
#include "IRLremote.h"
#include <DigiPotX9Cxxx.h>
DigiPot pot(3, 4, 5);
const int interruptIR = 0;
uint8_t IRProtocol = 0; // Variables para recibir los datos
uint16_t IRAddress = 0;
uint32_t IRCommand = 0;
int Ledrojo = 11;
int Ledamarillo = 10;
void setup() {
Serial.begin(115200);
IRLbegin<IR_ALL>(interruptIR);
pinMode(Ledrojo, OUTPUT);
pinMode(Ledamarillo, OUTPUT);
}
void loop() {
//uint8_t oldSREG = SREG;
//cli();
if (IRProtocol)
{
if (IRCommand == 0xA857) // Aqui tenemos la clausula switch con sus case:
{ pot.increase(5);
digitalWrite(11, HIGH);
Serial.println("+");
delay(100);
digitalWrite(11, LOW);
}
if (IRCommand == 0xE01F)
{ pot.decrease(5);
Serial.println("-");
digitalWrite(10, HIGH);
delay (100);
digitalWrite(10, LOW);
}
}
IRProtocol = 0;
}
void IREvent(uint8_t protocol, uint16_t address, uint32_t command)
{
IRProtocol = protocol; // Recogemos los valores
IRAddress = address;
IRCommand = command;
}
dseage:
#include "IRLremote.h"
#include <DigiPotX9Cxxx.h>
DigiPot pot(3, 4, 5);const int interruptIR = 0;
uint8_t IRProtocol = 0; // Variables para recibir los datos
uint16_t IRAddress = 0;
uint32_t IRCommand = 0;int Ledrojo = 11;
int Ledamarillo = 10;void setup() {
Serial.begin(115200);
IRLbegin<IR_ALL>(interruptIR);
pinMode(Ledrojo, OUTPUT);
pinMode(Ledamarillo, OUTPUT);
}void loop() {
//uint8_t oldSREG = SREG;
//cli();
if (IRProtocol)
{if (IRCommand == 0xA857) // Aqui tenemos la clausula switch con sus case:
{ pot.increase(5);
digitalWrite(11, HIGH);
Serial.println("+");
delay(100);
digitalWrite(11, LOW);
}if (IRCommand == 0xE01F)
{ pot.decrease(5);
Serial.println("-");
digitalWrite(10, HIGH);
delay (100);
digitalWrite(10, LOW);
}}
IRProtocol = 0;
}void IREvent(uint8_t protocol, uint16_t address, uint32_t command)
{
IRProtocol = protocol; // Recogemos los valores
IRAddress = address;
IRCommand = command;
}
this is the code for one potenciometer
DrDiettrich:
Right, the other lines are all connected in parallel, only CS must be separated.Thanks for the reminder, this part got lost while editing my preceding reply.
Then I use the library and all the CS are enabled independently, when you want to modify a potentiometer disables the CS of it and the value changes according to the library (with the U / D and INC in parallel with the pins defined in the library)
Hi,
Welcome to the forum.
Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.
Have got JUST code that tries to control the digital pots, that is with no IR in the code?
Start there then add the IR.
Tom....
Sorry. Im new in this foro....
I saw the project in http://panamahitek.com/potenciometro-digital-el-circuito-integrado-x9c103p/
In this web you can see the librery.
This is the first code: up in "1" and down in other number.
#include <DigiPotX9Cxxx.h>
DigiPot pot(3,4,5);
int input;
void setup() {
Serial.begin(115200);
}
void loop() {
if (Serial.available()>0){
inpue=Serial.read();
if (input=='1'){
pot.increase(1);
}
else
{
pot.decrease(1);
}
}
}
Hi,
Here is the data for your IC
https://www.intersil.com/content/dam/Intersil/documents/x9c1/x9c102-103-104-503.pdf
Looking at the way it works, the suggestions from post #3 and #4 are probably the easiest.
Just make a function to do job of the library you have, but with chip select added.
Tom..
The simplest solution, provided that the library disables a pot after changes:
DigiPot pot1(3,4,5);
DigiPot pot2(3,4,5);
DigiPot pot3(3,4,5);
Then change the CS pin in above constructors for each pot, to reflect just the CS pin you connect to the pots. Now you can use in code pot1, pot2 and pot3. You also can give the pot objects more meaningful names, of course.