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.

why PIC18F2XK20 in not working on the real hardware?

Status
Not open for further replies.

lindodv

Junior Member level 1
Junior Member level 1
Joined
Jul 4, 2014
Messages
16
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
121
Hi, I wanted to write "Hello" on the LCD, so I used PIC18Fxx8 (like pic18f248) and this code:
(5V regulated supply for PIC and LCD on the hardware)

Code:
sbit LCD_RS at LATB2_bit;
sbit LCD_EN at LATB3_bit;
sbit LCD_D4 at LATB4_bit;
sbit LCD_D5 at LATB5_bit;
sbit LCD_D6 at LATB6_bit;
sbit LCD_D7 at LATB7_bit;
sbit LCD_RS_Direction at TRISB2_bit;
sbit LCD_EN_Direction at TRISB3_bit;
sbit LCD_D4_Direction at TRISB4_bit;
sbit LCD_D5_Direction at TRISB5_bit;
sbit LCD_D6_Direction at TRISB6_bit;
sbit LCD_D7_Direction at TRISB7_bit;
// End LCD module connections

char i;

void main() {


    TRISB = 0;
    ADCON1 = 0x07;

    Lcd_Init();                      // LCD display initialization
    Lcd_Cmd(_LCD_CURSOR_OFF);        // LCD command (cursor off)
    Lcd_Cmd(_LCD_CLEAR);             // LCD command (clear LCD)

    LCD_OUT(1 ,1 ,"HELLO");

}

it also worked on the real hardware, but I wanted to change PIC with PIC18F26K20, I used 3.3 for programming and I used 5V supply for LCD and 3V for PIC with command ground(I also used this voltage for PIC18Fxx8 and it worked), and I used PICkit2, and I just change(ADCON1 with ANSEL,H, in the code). but on the real hardware, LCD is Blank and Nothing was shown(only black squares in the first row). It is possible to program 18FxxKxx with PICkit2, isn't it? I don't know what to do for solving this issue. I also replaced the PIC with a newer one,but The problem is not resolved.
 

With above information is not possible determine if the problem concerns to the hardware or firmware scope. It is also necessary you post the schematic here.
 

As above mentioned,I cannot judge which cause the problem,hardware connecting or error code ?
First be sure your connecting wire is connect,then check your LCD timing compare with LCD datasheet from its supply. Check the driver timing with a scope to see if it right or not.
 

thanks guys, I'm sure wire connections are correct. I changed the code with this one:
Code:
void main() {
    TRISC = 0;
    ANSEL = 0;
    ANSELH = 0;
 while(1) {
    LATC.B3 = 1;
    Delay_ms(3000);
    LATC.B3 = 0;
    Delay_ms(3000);
    
     }
}

but it's not working either, how can I understand if my programmer hardware in not working correctly?(I did not got any error during the programing)
the compiler is correct, and connections are correct, What else can I check?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top