• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Project

Status
Not open for further replies.

khwoo

New Member
:confused:1. Use PIC16f877A annd 16x2 LCD
LCD pin4 (RS) and 6(E) connected to PIC pin A4 and A5.
LCD pin11 to 14 connected to PIC pin A0 to A3.

Can I know should I initialise the port 1st before LCD display or before the code below?

Code:
void main ( void ) 
{ 
    lcd_init(); 
    while(1) {
        lcd_gotoxy (1,1); 
        lcd_putc ("test" ); 
    } // end while
}
Need guidance... Thanks alot. :confused:
 

Wp100

Well-Known Member
Hi,

If your program code does not make use of the lcd R/W signal, then lcd Pin 5 R/W should be tied to 0v.
 

khwoo

New Member
Code:
#include <16f877a.h>
#use delay (clock = 20000000)
#fuses NOWDT,NOPUT,HS,NOPROTECT
#include <LCD.C>
#define INTS_PER_10SECOND 153     // (4000000/(4*256*256*0.1))

BYTE ten_seconds;      // A running seconds counter
BYTE int_count;    // Number of interrupts left before ten second has elapsed

#int_rtcc                          // This function is called every time
void clock_isr() {                 // the RTCC (timer0) overflows (255->0).
                                   // For this program this is apx 76 times
    if(--int_count==0) {           // per second.
      ++ten_seconds;
      int_count=INTS_PER_10SECOND;
    }
}
Can anyone check the problem for the above code? I m using 4Mhz crystal oscillator, and i would like to count for every 10 seconds... I had refered to the examples in ccs..

The code below is about interrupt and lcd display:
Code:
void main() {

   BYTE start;

   int_count=INTS_PER_10SECOND;
   
   set_timer0(0);
   setup_counters( RTCC_INTERNAL, RTCC_DIV_256 | RTCC_8_BIT);
   enable_interrupts(INT_RB);
  // enable_interrupts(GLOBAL);

   while (TRUE)
   {
   set_tris_a(1);
   lcd_init();
   lcd_putc("\RPM:\n");
   lcd_putc("++ten_seconds");
   }   
}
My interrupt pin is RB0 (INT) and RA0 to RA3 are my output pins connected to LCD pin 11 to 14.
Anything wrong in the code above kindly correct me.
Because its cannot display anything..

Thanks..
 

BeeBop

Active Member
:confused:1. Use PIC16f877A annd 16x2 LCD
LCD pin4 (RS) and 6(E) connected to PIC pin A4 and A5.
LCD pin11 to 14 connected to PIC pin A0 to A3.

Can I know should I initialise the port 1st before LCD display or before the code below?

Code:
void main ( void ) 
{ 
    lcd_init(); 
    while(1) {
        lcd_gotoxy (1,1); 
        lcd_putc ("test" ); 
    } // end while
}
Need guidance... Thanks alot. :confused:
Hi khwoo,
If you look at the driver file LCD.c in your

<C:\Program Files\PICC_vxxx\Drivers>

folder you will see:
// As defined in the following structure the pin connection is as follows:
// D0 enable
// D1 rs
// D2 rw
// D4 D4
// D5 D5
// D6 D6
// D7 D7
//
// LCD pins D0-D3 are not used and PIC D3 is not used.

// Un-comment the following define to use port B
// #define use_portb_lcd TRUE
What this means is that the CCS LCD driver will only work on Port D or Port B the way it is.

Is it possible to switch your LCD to Port D? This would be the easiest fix. I know that someone on the CCS forums has a driver for other ports, but that may be more difficult to understand, and I think you just need to get up and running at this point.

regards
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top