Cant light LEDs?

Post Reply
riceman0
Posts: 9
Joined: Mon Mar 06, 2017 10:42 pm

Cant light LEDs?

Post by riceman0 » Sat Mar 11, 2017 6:57 am

Hello, I'm using a chipkit uC32 -- I'm using MPLABX and a debugger and just writing C to it. I think I see on the schematic that LEDs 4 and 5 are driven by GPIO outputs RG6 and RF0. So I try this code to light the LEDs,

LATGbits.LATG6 = 1;
LATFbits.LATF0 = 1;

and... nothing. Is there something else I must do in hardware (jumpers or something) to light these LEDs? Or is it more likely I've gotten my code wrong?

Thanks.

lstandage
Posts: 17
Joined: Fri Sep 06, 2013 6:03 pm

Re: Cant light LEDs?

Post by lstandage » Sat Mar 11, 2017 7:05 am

One of the things about Microchip ports is that there are a couple things that have to be done before an LED will turn on.

TRISGbits.TRISG6 = 0;
TRISFbits.TRISF0 = 0;

These statements change the tristate register on the port so that they go from being inputs to being outputs.

riceman0
Posts: 9
Joined: Mon Mar 06, 2017 10:42 pm

Re: Cant light LEDs?

Post by riceman0 » Sat Mar 11, 2017 12:57 pm

[slaps head] Thank you!

Post Reply