+ Post New Thread
Results 1 to 3 of 3
  1. #1
    Member level 3
    Points: 3,133, Level: 13

    Join Date
    Jun 2002
    Posts
    56
    Helped
    0 / 0
    Points
    3,133
    Level
    13

    LCD working on proteus, but not on hardware, using 16f1507

    hello all,


    i am using this code for testing LCD, but its only working on proteus, but not on hardware.
    i have connected a LED to check whether IC is working or not- IC is working fine.

    cannot find out the problem,pls help me.



    Code:
    // PIC16F1507 Configuration Bit Settings
    
    // 'C' source line config statements
    
    #define _XTAL_FREQ 16000000UL
    #include 
    #include 
    #include 
    #include 
    //#include 
    //#include 
    
    
    
    
    // CONFIG1
    
    #pragma config FOSC = INTOSC    // Oscillator Selection bits (Internal Oscillator, I/O Function on OSC1)
    #pragma config WDTE = OFF       // Watchdog Timer Enable (WDT disabled)
    #pragma config PWRTE = OFF      // Power-up Timer Enable (PWRT disabled)
    #pragma config MCLRE = OFF      // MCLR Pin Function Select (MCLR/VPP pin function is digital input)
    #pragma config CP = ON          // Flash Program Memory Code Protection (Program memory code protection is enabled)
    #pragma config BOREN = OFF      // Brown-out Reset Enable (Brown-out Reset disabled)
    #pragma config CLKOUTEN = OFF   // Clock Out Enable (CLKOUT function is disabled. I/O or oscillator function on the CLKOUT pin)
    
    // CONFIG2
    
    #pragma config WRT = OFF        // Flash Memory Self-Write Protection (Write protection off)
    #pragma config STVREN = OFF      // Stack Overflow/Underflow Reset Enable (Stack Overflow or Underflow will cause a Reset)
    #pragma config BORV = LO        // Brown-out Reset Voltage Selection (Brown-out Reset Voltage (Vbor), low trip point selected.)
    #pragma config LPBOR = OFF      // Low-Power Brown Out Reset (Low-Power BOR is disabled)
    #pragma config LVP = OFF        // Low-Voltage Programming Enable (High-voltage on MCLR/VPP must be used for programming)
    
    //LCD Pins
    #define RS 	    0
    #define RW 		2
    #define EN		1
    
    #define LCD	PORTC
    
    
    void LCD_NUM(int a);
    void LCD_INIT(void);
    void LCD_DATA(unsigned char);
    void LCD_CMD(char a);
    
    
    void main()
    {
        IRCF0 = 1;
        IRCF1 = 1;
        IRCF2 = 1;
        IRCF3 = 1;
       
        
        TRISB=0x00;
        TRISC=0x00;
        
        LCD_INIT();
       
        int i=0;
        while(1)
        {   
            LCD_NUM(i);
            PORTB=0xff;
            __delay_ms(1000);
            PORTB=0;
            __delay_ms(200);
            if(i==4)
            {
                i=0;
                LCD_CMD(0X01);
            }
            i++;
        }
       
           
         
        
        
    }
    
    void LCD_NUM(int a)
     {if(a==0)
       LCD_DATA('0');
    
      LCD_DATA(0x04);
       int t;
       while(a!=0)
         {
    	   t=a%10;
    	   a=a/10;
    	   LCD_DATA(t+48);
         }
    }
    
    void LCD_CMD(char a)
     {
       LCD=a&0b11110000;
       LCD&=~(1<
    
    Click image for larger version. 

Name:	U ntitled.jpg 
Views:	8 
Size:	108.6 KB 
ID:	131067

    •   AltAdvertisment

        
       

  2. #2
    Member level 2
    Points: 1,026, Level: 7
    DNA Robotics's Avatar
    Join Date
    Jun 2014
    Posts
    51
    Helped
    6 / 6
    Points
    1,026
    Level
    7

    Re: LCD working on proteus, but not on hardware, using 16f1507

    A 5k potentiometer from +5v to gnd, output to VEE, is for adjusting the contrast of the display, and if incorrectly adjusted can cause the display to be invisible.



    •   AltAdvertisment

        
       

  3. #3
    Member level 3
    Points: 3,133, Level: 13

    Join Date
    Jun 2002
    Posts
    56
    Helped
    0 / 0
    Points
    3,133
    Level
    13

    Re: LCD working on proteus, but not on hardware, using 16f1507

    Thanks for response, but this was not the issue.

    Have solved the problem.
    need to set ANSELx register.... :)



--[[ ]]--