• 0
Sign in to follow this  
wowden

Configuring digital pins causes DACs to stop updating

Question

Hi,

When I configure certain digital pins to be inputs, I can not longer update the DACs. Rather strangely, I can configure pin 8, 9, 10, and 12 as inputs without problem, but setting pins 11 and 13 to be inputs stops communication with the DACS. There is no issue if they are configured as outputs. For example, the following works as expected with DAC1 ramping

#include <analogShield.h>   //Include to use analog shield.
#include <SPI.h>	//required for ChipKIT but does not affect Arduino

void setup()
{
   pinMode(12, INPUT);
}

unsigned int ramp = 2000;
void loop() {
  // put your main code here, to run repeatedly: 
  analog.write(1, ramp);
  ramp++;
}

 

If pinMode(12, INPUT) is changed to either pinMode(11, INPUT) or pinMode(13, INPUT), DAC1 does not ramp. The same behaviour is seen on all DACS. Any ideas why? Thanks in advance. 

I am using this library: https://github.com/wespo/analogShield

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Hello @wowden,

What you are running into is that the DACs on the AnalogShield use the SPI communication protocol, which uses pins 10, 11, 12, and 13 on microcontroller boards. Pins 11 and 13 are both outputs for the SPI protocol (specifically, the master-out-slave-in data line and the clock line), so if you switched them to inputs the two DAC chips would no longer receive any information from the host board.

Let me know if you have any more questions.

Thanks,
JColvin

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