Jump to content
  • 0

Configuring digital pins causes DACs to stop updating


wowden

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

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

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

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...