i am a 20 year old student and this is one of my first posts, so forgive me if i ask some stupid questions.
i am trying to code the dac MCP 4822 but i dont want to use complicated code like:
byte lowByte = val & 0xff; byte highByte = ((val >> 8) & 0xff) | channel << 7 | gain << 5 | shutdown << 4; digitalWrite(latchPin, 1); digitalWrite(csPin, 0); SPI.transfer(highByte); SPI.transfer(lowByte); digitalWrite(csPin, 1); digitalWrite(latchPin, 0);
basically i dont want to control the CS pin manually or use bit wise operators.
i figured out that one way of doing so will be to use the MCP 4822 header file available in the arduino library.
unfortunately i dont have the code that uses this header file. so if any one can help me with the code to op 0v and 5v from the DAC using this header file i would be very pleased.
thanks in advance,