![]() | ![]() | ![]() |
| |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
![]() |
| | Tools |
| | #1 |
|
Every thing works OK when I'm using Proteus with but in the reality when I make my circuit nothing appears on the LCD I'm using PIC18F4550 und LMB162A LCD my Cristal is 8MHZ I think the problem is by using PortA or PortE when I use PortB or PortD every thing is OK. Thank You all This is my Code: Code: char *text = "Hello World";
void main()
{
CMCON |= 0x07; // turn off comparators
ADCON1 |= 0x0F; // turn off analog inputs
TRISA = 0x00;
TRISE = 0x00; // PORTB is output
TRISB = 0x00;
Lcd_Custom_Config(&PORTA,3,2,1,0,&PORTE,2,1,0); // Initialize LCD on PORTB
Lcd_Custom_Cmd(Lcd_CURSOR_OFF); // Turn off cursor
Lcd_Custom_Cmd(LCD_CLEAR);
Lcd_Custom_Out(1, 1, text);
PORTB.F2 = 1;
while(1)
{
Delay_ms(250); // One second pause
Lcd_Custom_Cmd(LCD_SHIFT_RIGHT);
PORTB.F2 = ~PORTB.F2;
}
}
| |
| |
| | #2 |
|
pull up all data lines d4-d7 with 4.7k resistor to 5v.
| |
| |
| | #3 |
|
change this Code: CMCON |= 0x07; // turn off comparators ADCON1 |= 0x0F; // turn off analog inputs Code: CMCON = 7; // turn off comparators ADCON1 = 0x0F; // turn off analog inputs
__________________ Steve | |
| |
| | #4 |
|
I think this is the problem Thank You very much | |
| |
| | #5 |
|
Thank You very much
| |
| |
| | #6 |
|
I put putt-up res. but I get nothing. So, when do LED test on PortA and PortE (without putt-up res.)I get sometning unblieveable: LEDs RA0 and RA1 blink but RA2 and RA3 light without blinking. On PortE, I get RE0 and RE1 blinked but RE2 does nothing. But the programm works good on Proteus This is the Code: Code: //CPU Clock 48MHZ
//PIC18F4550
void main()
{
CMCON = 0x07; // turn off comparators
ADCON1 = 0xFF; // turn off analog inputs
TRISA = 0x00; // PORTA is output
TRISE = 0x00; // PORTE is output
PORTA = 0xFF;
PORTE = 0xFF;
while(1)
{
Delay_ms(500); /* 0.5 second pause */
PORTA = ~PORTA;
PORTE = ~PORTE;
}
}
| |
| |
| | #7 |
|
Try changing all your port reads to latch reads, so PORTA = ~PORTA; becomes LATA = ~LATA; Mike. | |
| |
| | #8 |
![]() I got it due to Your help: The Problem is that I used PORT instead of LAT So, thanks for your help special Pommie. The New code: Code: char *text = "Hello World";
void main()
{
CMCON = 0x07; // turn off comparators
ADCON1 = 0xFF; // turn off analog inputs
TRISA = 0x00; // PORTA is output
TRISB = 0x00; // PORTB is output
TRISE = 0x00; // PORTE is output
Lcd_Custom_Config(&LATA,3,2,1,0,&LATE,2,1,0); // Initialize LCD on PORTB
Lcd_Custom_Cmd(Lcd_CURSOR_OFF); // Turn off cursor
Lcd_Custom_Cmd(LCD_CLEAR);
Lcd_Custom_Out(1, 16, text);
PORTB.F2 = 1;
while(1)
{
Delay_ms(300); // 0.3 second pause
Lcd_Custom_Cmd(LCD_SHIFT_LEFT);
PORTB.F2 = ~LATB.F2;
}
}
Last edited by Nizar; 8th February 2009 at 04:51 AM. | |
| |
| | #9 |
|
Hi, I just wanted to say thankyou for the LAT/PORT hint. I have been troubleshooting this issue for two long evening/nights now looking for soft and hard errors.... ! thankyou / Ahd71 | |
| |
| | #10 |
|
Thanks it is working.
| |
| |
|
| Tags |
| lcd, mikroc, porta, porte, problem |
| Thread Tools | |
| Display Modes | |
| |
Similar | ||||
| Title | Starter | Forum | Replies | Latest |
| Interrupt on change problem, PORTA | mjdeez | Micro Controllers | 7 | 11th June 2009 01:58 AM |
| MikroC Delay_ms() problem!!! | cGr | Micro Controllers | 2 | 7th November 2008 12:49 PM |
| mikroC problem | colin mac | Micro Controllers | 12 | 22nd July 2008 01:02 PM |
| PORTA output problem | skyrock | Micro Controllers | 2 | 13th May 2008 11:47 AM |
| Problem in PORTE register of PIC | Hesam Kamalan | Micro Controllers | 2 | 11th July 2006 12:51 PM |