Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Problem with PORTB leds on easypic5 (MCU: PIC16F887)

Status
Not open for further replies.

bobylebob

Newbie level 3
Joined
Nov 22, 2007
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,308
pic16f887

Hello everybody,

I have a trouble with my easypic5.

I try to display a text message "coucou" on the board's leds panel.

To display this message, I did the following code:

Code:
    char car_b [32] = {0,0,0,0,0,0,0,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,0,1,0};
    char car_c [32] = {0,0,0,0,0,0,0,0,1,0,0,0,1,0,1,0,1,0,1,0,1,0,0,0,1,0,1,0,1,0,1,0};
    char car_d [32] = {0,0,0,0,0,0,0,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0};


void main()
{
    int i = 0;

    ADCON0 = 0 ;                        //A/D Convert off 
    ANSEL = 0;                            //A/D Convert off
    ANSELH = 0;                          //A/D Convert off 
    INTCON = 0;                          //interruptions OFF
 
    //PORTB = 0x00;
    PORTC = 0x00;
    PORTD = 0x00;
  
    //TRISB = 0x00;
    TRISC = 0x00;
    TRISD = 0x00;


  while(1)
  {
    for (i=0; i<32; i++)
    {

     //PORTB = ((PORTB | car_b[i]) << 1);      //Here i mask the port, add the new
     PORTC = ((PORTC | car_c[i]) << 1);        //led of the letter, and then shift it 
     PORTD = ((PORTD | car_d[i]) << 1);        //to the left.
     delay_ms(500);
    }
  }
}

As you can see, the code isn't commented (but it's not so hard to understand...).

For the two bottom lines, there's no problem, everything is ok, I can see all the bottom of the letter.

But absolutely nothing on the PORTB. In the code above, I have to disable PORTB, because if I don't do that, even the other two lines don't work. I have only 3 leds which switch on (PORTB 0x02; PORTC 0x02 and PORTD 0x02).
Then, they switch off and that's all...

Someone could help me ?

Thank you
[/code]
 

OK, I found the trouble. I use an Easypic 5 board, and one of de switches which actually drives the leds wasn't properly set.

Noob's mistake, sorry ....
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top