Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Tools
Old 2nd July 2009, 06:25 AM   #1
Default Project

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.
khwoo is offline  
Old 2nd July 2009, 09:35 AM   #2
Default

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.
Wp100 is offline  
Old 2nd July 2009, 10:32 AM   #3
Default

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..
khwoo is offline  
Old 2nd July 2009, 04:22 PM   #4
Default

Quote:
Originally Posted by khwoo View Post
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.
Hi khwoo,
If you look at the driver file LCD.c in your

<C:\Program Files\PICC_vxxx\Drivers>

folder you will see:
Quote:
// 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
BeeBop is online now  
Reply

Tags
project

Thread Tools
Display Modes


Similar
Title Starter Forum Replies Latest
electronics project for btech mini project sujith123 Electronic Projects Design/Ideas/Reviews 13 17th July 2009 12:16 PM
project ideas for final year project! AceOfHearts Electronic Projects Design/Ideas/Reviews 10 28th December 2008 12:25 PM
need suggestions on uni project. (mechatronics project) konzen General Electronics Chat 16 13th March 2006 12:56 PM
i need a project idea\concept for a 10 month project..... mackoy General Electronics Chat 3 22nd February 2005 12:27 AM
biomedical project(electronic project) naguru Electronic Projects Design/Ideas/Reviews 1 2nd November 2004 12:08 PM



All times are GMT. The time now is 02:19 AM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker