Jump to content
  • 0

PIC32 Max32 and chipKIT Network Shield Code helping.


arslanweb

Question

Hi,

I have write simple UDP server code to use your "DNETcK" library. I have two problems. 

First:

I can not get the MAC address. the "DNETcK::getMyMac(&myMAC)" function do not work.

 

Second:

I will use some port input and some port output. 


#define PIN_LED_1 29
#define PIN_LED_2 43
#define PIN_LED_3 26

#define PIN_LED_BLINK 27


#define PIN_OUT1  25
#define PIN_OUT2  14
#define PIN_OUT3  13
#define PIN_OUT4  12
#define PIN_OUT5  11
#define PIN_OUT6  10
#define PIN_OUT7  9
#define PIN_OUT8  0

#define PIN_IN1  2
#define PIN_IN2  3
#define PIN_IN3  4
#define PIN_IN4  5
#define PIN_IN5  6
#define PIN_IN6  7
#define PIN_IN7  8
#define PIN_IN8  1

And set it with

 
  pinMode(PIN_LED_BLINK, OUTPUT);      // 
  pinMode(PIN_LED_1, OUTPUT);      // 
  pinMode(PIN_LED_2, OUTPUT);      // 
  pinMode(PIN_LED_3, OUTPUT);      // 

  pinMode(PIN_OUT1, OUTPUT);      // 
  pinMode(PIN_OUT2, OUTPUT);      // 
  pinMode(PIN_OUT3, OUTPUT);      // 
  pinMode(PIN_OUT4, OUTPUT);      //   
  pinMode(PIN_OUT5, OUTPUT);      // 
  pinMode(PIN_OUT6, OUTPUT);      // 
  pinMode(PIN_OUT7, OUTPUT);      // 
  pinMode(PIN_OUT8, OUTPUT);      // 

  pinMode(PIN_IN1, INPUT);      // 
  pinMode(PIN_IN2, INPUT);      // 
  pinMode(PIN_IN3, INPUT);      // 
  pinMode(PIN_IN4, INPUT);      //   
  pinMode(PIN_IN5, INPUT);      // 
  pinMode(PIN_IN6, INPUT);      // 
  pinMode(PIN_IN7, INPUT);      // 
  pinMode(PIN_IN8, INPUT);      // 

but this function are not working fine. I will use the analog pins as digital IO pins. How can set it to digital IO pins? I ahve attachment the sample code need help!

 

 

UDPEchoServer_relay_1_cpp.zip

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

Hi arslanweb,

I looked into the DNETcK library (most recent version available at the chipKIT Network Shield Resource Center) and I do not see the getMyMac function that uses uses an address-of operator to find the MAC address, just one that uses a dereference operator, so I'm not sure what library version you are using, but I would recommend using that most recent library.

As for the second portion, a number of the pins you intend to use conflict with pins that are dedicated specific parts on the Network Shield (a list of these pins is available here under the chipKIT pin column). Of those not listed in the column, the pin assignments that jump out at me are the pin 0 and pin 1 assignments which will directly conflict with the UART/USB interface between the Max32 and your computer, so your program will have difficulty uploading to the board (at least in my experience).

As for using the analog pins as digital pins, you should just be able to directly use them as such with the digitalWrite function.

Let me know if you have any more questions.

Thanks,
JColvin

Link to comment
Share on other sites

Hi,

1)Thanks for your answere. I have use the newest libraryof ethernet. İs not a version problem.

2) The port is in the board as Analog port define.  I will convert the analog port to the digital output port. How can it.

 

Link to comment
Share on other sites

Hi arslanweb,

I compiled your code that you provided (after making sure that all of the .pde files appeared in the same MPIDE window) and received no complaints from MPIDE (version 20130715) while using the new Network Shield library that I linked to before, so I'm not sure where you are encountering your error. Could you post the full error?

Yes, that port in the board is defined as an Analog port. However, you are still able to use them as a digital pin with the digitalWrite function. For example, you could have pin A2 flash an LED three times with the following code:

void setup(){
  pinMode(A2, OUTPUT);
  digitalWrite(A2, HIGH);
  delay(500);
  digitalWrite(A2, LOW);
  delay(500);
  digitalWrite(A2, HIGH);
  delay(500);
  digitalWrite(A2, LOW);
  delay(500);
  digitalWrite(A2, HIGH);
  delay(500);
  digitalWrite(A2, LOW);
  delay(500);
}
void loop(){
  
}

 

Thanks,
JColvin

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...