Issues with Common Anode RGB-LED Project

Thread Starter

pleditor

Joined Feb 19, 2013
4
I am completely new to Microcontrollers and Electronics, however a made some progress and just got stuck at the point where i want to turn on all LED's Red color with the "PORTX.FX" command (led 1,3,5,7 stays black). If i try to turn on all Red LED's separately it will work with no problems. Here's the Code:

Rich (BB code):
void main()
{

     TRISA = 0b000000;
     TRISB = 0b000000;
     TRISC = 0b000000;
     TRISD = 0b000000;

     PORTA = 0b111111;
     PORTB = 0b111111;
     PORTC = 0b111111;
     PORTD = 0b111111;

     ANSEL = 0b000000;
     ANSELH = 0;


  PORTA.F2 = 0;
  PORTA.F5 = 0;
  PORTB.F2 = 0;
  PORTB.F5 = 0;
  PORTC.F2 = 0;
  PORTC.F5 = 0;
  PORTD.F2 = 0;
  PORTD.F5 = 0;

}
I am using MikroC compiler, with a PICkit 2. I appreciate every help here ;-).
 

Attachments

rstevenson

Joined Apr 5, 2011
20
I havent looked at the code, but you need current limiting resistors in series with your Leds. Also, Im curious as to why you are using Vpp to power the leds?
 

Thread Starter

pleditor

Joined Feb 19, 2013
4
The schematics is wrong the cathode of the LED's should be on VSS. However after replacing the wrong resistors with the right ones everything works as wanted :)

problem solved, thanks ;-)
 
Top