Jump to content
  • 0

analogShield defeats digitalWrite(pin,state) function


roger

Question

7 answers to this question

Recommended Posts

Hi @roger,

Looking at the schematics I do not see anything that would stop the use of these pins from working. I have attached pictures of my setup as well as my logic analyzer using an Analog Discovery 2 with waveforms software showing the digital write works for pin 8. i also verified 9-13 as well. I am using the arduino IDE version 1.8.1 with the digilent core version 1.0.2.  Please attach a picture of your setup as well as your code with what IDE and versions.

cheers,

Jon

uC32_digital_write_analog_shield.txt

Analogshield_digital_write.jpg

analog_shield.zip

Link to comment
Share on other sites

It is super weird for sure.  I will post my files - but - I did find a workaround.  It turns out that I can use pins 0-10, but, 11, 12, 1nd 13 are not operative.  Arduino IDE 1.6.13, uC32 with analogShield.  When I comment out the analogShiled include line, it works, when this line is there, then pins 11, 12, 13 don't toggle.  Thanks so much!

I'll paste the super bare-bones code below:

#include <Messenger.h>
#include <analogShield.h>   //Include to use analog shield.
#include <SPI.h>  //required for ChipKIT but does not affect Arduino
Messenger message = Messenger(); 
int myPIN = 3;

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin PIN as an output.
  pinMode(myPIN, OUTPUT);
  Serial.begin(115200);
}

// the loop function runs over and over again forever
void loop() {
  pinMode(myPIN, OUTPUT);
  digitalWrite(myPIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(250);                       // wait for a second
  digitalWrite(myPIN, LOW);    // turn the LED off by making the voltage LOW
  delay(250);                       // wait for a second
}

Link to comment
Share on other sites

Hi @roger,

Glad you were able to use other digital pins. I did more research and my pin 11-13 was not toggling the same as pins 8-10. I looked into the analog shield library and it uses the spi.h library. The SPI.h library uses SPI2. SPI2 on the uC32 is 11(SDO2), 12(SDI2) and 13(SCK2) as shown on the reference manual here. Unfortunately, you would not be able to use pin 11-13. If you would have needed those specific pins you would need to alter the analog shield library to use the DSPI.h library( info here) where you can choose which pins you will use.

cheers,

Jon

Link to comment
Share on other sites

Hi @jpeyron - is there any chance that one could get Eagle or other CAD files on the Analogshield?  I'm a chemistry professor and it would be super nice to have a robust anlaog IO option for uC32 / Uno etc.

Let me know!

Thanks so much for your help -

Roger

 

Link to comment
Share on other sites

Hi @roger,

What sort of CAD files were you wanting for the Analog Shield; I presume a mechanical 3D CAD model? Currently we do not have any Eagle files or CAD models available for the Analog Shield, but I can ask and see if a 3D CAD model could made if you would like.

Thanks,
JColvin

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...