Jump to content
  • 0

Manually Set Pins on Wifire Rev4


StirFried

Question

Hi,

I'm trying to manually set the RC1 and RC2 pins on port C but I'm only able to do so with PinMode(). I'm able to manually set any of the other pins on port C but I'm not sure why I can't for RC1/2.

Any advice on how to enable these pins to be set manually would be greatly appreciated :)

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

Hi @StirFried,

You should be able to directly manipulate them. I set up pin 35 (RC1) on the WiFIRE Rev D as an input and pin A2 (RC2) as an output and successfully got an output signal on A2 when pin 35 was high in the Arduino IDE with this code:

void setup()
{
  TRISC = TRISC & 0xFFFB; //setting outputs 0b1111 1111 1111 1011 RC2, AN2 output
  TRISC = TRISC | 0x0002; //setting inputs 0b0000 0000 0000 0010 RC1, pin 35 input
}

void loop()
{
  LATC = PORTC << 1;         
}

Let me know if you have any questions.

Thanks,
JColvin

Link to comment
Share on other sites

16 hours ago, JColvin said:

Hi @StirFried,

You should be able to directly manipulate them. I set up pin 35 (RC1) on the WiFIRE Rev D as an input and pin A2 (RC2) as an output and successfully got an output signal on A2 when pin 35 was high in the Arduino IDE with this code:


void setup()
{
  TRISC = TRISC & 0xFFFB; //setting outputs 0b1111 1111 1111 1011 RC2, AN2 output
  TRISC = TRISC | 0x0002; //setting inputs 0b0000 0000 0000 0010 RC1, pin 35 input
}

void loop()
{
  LATC = PORTC << 1;         
}

Let me know if you have any questions.

Thanks,
JColvin

JColvin, 

 

I am also facing this issue and appreciate the response because it does work.

I am only slightly frustrated though since the schematic for the ChipKit WiFire REV D and the reference manual for REV D are very misleading when it comes to port bit counts and which bit they start with. For example PORTC has 16 bits ( I know this now thanks to your post ), but In both the schematic and reference manual PORTC is represented as starting at RC01 rather than RC00. Actually RC00 or all the other 7 bits of PORTC along with other bits on other ports are not mentioned in any documentation. Maybe it is located in the microcontrollers datasheet rather than the dev kits. 

Is it possible to recommend Diligent to update these issues and represent all bits on every port in the schematic at the very least? I know it would greatly help people doing direct manipulation of ports. 

Link to comment
Share on other sites

Hi @Choi,

The reason there is no RC0 on the schematic is because Microchip did not break out/route out it and other pins on the PIC32MZ2048EFG100. You can see what pins are externally available in Table 3 of it's datasheet available for download on Microchip's product page for it here: https://www.microchip.com/wwwproducts/en/PIC32MZ2048EFG100. As far as I can tell on Table 12-6, the other pins on PORTC besides RC1-RC4 and RC12-RC15, are unimplemented on the IC.

Let me know if you have any questions about this.

Thank you,
JColvin

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...