bluerose
Newbie level 3
- Joined
- Feb 26, 2013
- Messages
- 4
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,308
Hi, I'm working on PIC18f4480 to simulate its can communication and i want to display data on a lcd so i can't use the portB for display.
I write this code for LCD but it doesn't work :
///////////config LCD
sbit LCD_D4 at RA0_bit;
sbit LCD_D5 at RA1_bit;
sbit LCD_D6 at RA2_bit;
sbit LCD_D7 at RA3_bit;
sbit LCD_RS at RA5_bit;
sbit LCD_EN at RB1_bit;
////////
sbit LCD_D4_DIRECTION at TRISA0_bit;
sbit LCD_D5_DIRECTION at TRISA1_bit;
sbit LCD_D6_DIRECTION at TRISA2_bit;
sbit LCD_D7_DIRECTION at TRISA3_bit;
sbit LCD_RS_DIRECTION at TRISA5_bit;
sbit LCD_EN_DIRECTION at TRISB1_bit;
////////////////////////////////////////////////
void main ()
{
ADCON1 = 0x0F;
TRISA = 0;
TRISB = 0;
PORTA = 0;
PORTB = 0;
LCD_Init();
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF);
while(1)
{
LCD_out_cp("z");
Delay_ms (100);
}
}
moreover i use the mikroc software and this code is just for testing the LCD of pic18f.
Is there anyone to help me???:-(
thanks
I write this code for LCD but it doesn't work :
///////////config LCD
sbit LCD_D4 at RA0_bit;
sbit LCD_D5 at RA1_bit;
sbit LCD_D6 at RA2_bit;
sbit LCD_D7 at RA3_bit;
sbit LCD_RS at RA5_bit;
sbit LCD_EN at RB1_bit;
////////
sbit LCD_D4_DIRECTION at TRISA0_bit;
sbit LCD_D5_DIRECTION at TRISA1_bit;
sbit LCD_D6_DIRECTION at TRISA2_bit;
sbit LCD_D7_DIRECTION at TRISA3_bit;
sbit LCD_RS_DIRECTION at TRISA5_bit;
sbit LCD_EN_DIRECTION at TRISB1_bit;
////////////////////////////////////////////////
void main ()
{
ADCON1 = 0x0F;
TRISA = 0;
TRISB = 0;
PORTA = 0;
PORTB = 0;
LCD_Init();
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF);
while(1)
{
LCD_out_cp("z");
Delay_ms (100);
}
}
moreover i use the mikroc software and this code is just for testing the LCD of pic18f.
Is there anyone to help me???:-(
thanks