bobylebob
Newbie level 3
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:
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]
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]