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.

need example for pic16f877

Status
Not open for further replies.

Setsuna13

Junior Member level 1
Junior Member level 1
Joined
Jul 6, 2011
Messages
18
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,416
Could anyone post a link or an example of circuit for pic16f877 interface with a 16x2 lcd with 16pin? please I really need help...

If possible please post a C code for it...

And it will be much better if it is also interfaced with a 4x3 keypad....

I'm sorry... I am a newbie in microcontroller... I just need a running programming/schematic for me to study it for our thesis.
 

Depends on what C you want, the program is little bit different. There are mikroC and HiTech C for you to choose from. :) And there are examples in the installation folder
 

your solution is here

**broken link removed**

---------- Post added at 14:08 ---------- Previous post was at 14:07 ----------

also check these
**broken link removed**
**broken link removed**
 
Could anyone post a link or an example of circuit for pic16f877 interface with a 16x2 lcd with 16pin? please I really need help...

If possible please post a C code for it...

And it will be much better if it is also interfaced with a 4x3 keypad....

I'm sorry... I am a newbie in microcontroller... I just need a running programming/schematic for me to study it for our thesis.

there is an example code here for 16x2 LCD with 4x3 keypad..

**broken link removed**
 
Here's a sample code for mikroC:
Code:
// LCD module connections
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D4 at RB0_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D7 at RB3_bit;

sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
// End LCD module connections

char txt1[] = "mikroElektronika";    
char txt2[] = "EasyPIC6";
char txt3[] = "Lcd4bit";
char txt4[] = "example";

char i;                              // Loop variable

void Move_Delay() {                  // Function used for text moving
  Delay_ms(500);                     // You can change the moving speed here
}

void main(){
  ANSEL  = 0;                        // Configure AN pins as digital I/O
  ANSELH = 0;
  C1ON_bit = 0;                      // Disable comparators
  C2ON_bit = 0;

  Lcd_Init();                        // Initialize LCD

  Lcd_Cmd(_LCD_CLEAR);               // Clear display
  Lcd_Cmd(_LCD_CURSOR_OFF);          // Cursor off
  Lcd_Out(1,6,txt3);                 // Write text in first row

  Lcd_Out(2,6,txt4);                 // Write text in second row
  Delay_ms(2000);
  Lcd_Cmd(_LCD_CLEAR);               // Clear display

  Lcd_Out(1,1,txt1);                 // Write text in first row
  Lcd_Out(2,5,txt2);                 // Write text in second row

  Delay_ms(2000);

  // Moving text
  for(i=0; i<4; i++) {               // Move text to the right 4 times
    Lcd_Cmd(_LCD_SHIFT_RIGHT);
    Move_Delay();
  }

  while(1) {                         // Endless loop
    for(i=0; i<8; i++) {             // Move text to the left 7 times
      Lcd_Cmd(_LCD_SHIFT_LEFT);
      Move_Delay();
    }

    for(i=0; i<8; i++) {             // Move text to the right 7 times
      Lcd_Cmd(_LCD_SHIFT_RIGHT);
      Move_Delay();
    }
  }
}

Connections:

RS at RB4
EN at RB5
D4 at RB0
D5 at RB1
D6 at RB2
D7 at RB3


Hope this helps.
Tahmid.
 

wow thanks for all the help.

I am still having problem in displaying some text on the lcd but I am still trying some those tutorials that was shared in here ^^ thanks... I wish I could make this work... I don't have much time left to finish my thesis... and I am still trying to learn about microcontrollers...

:) please keep on sharing some links.. it will really help me...
 

I am still having problem in displaying some text on the lcd ...

Are you using an Assembler or C Compiler to write your code? If a C Compiler which one?

Most issues concerning LCDs are directly related to the initialization routine, if not initialized properly the LCD will not perform as expected.

What exactly are the problems you are having? Is there anything being displayed on the LCD? Have you connected the contrast control properly? Are you interfacing the LCD in a 4-bit or 8-bit interface.

Please post the code you have up till now.


BigDog
 
your solution is here

**broken link removed**

---------- Post added at 14:08 ---------- Previous post was at 14:07 ----------

also check these
**broken link removed**
**broken link removed**

I have followed the schematic and used the code on the pdf file, but all I got is this



sometimes it displays random letters/characters.... like it will display a continues F that will fill the whole screen...

what could be the problem??

When I used **broken link removed** the one with LCD and keypad, the same thing is displayed and when I pressed the keypad won't display anything...

thanks :D
 
Last edited:

are you connected pins correctly to the LCD .(5volt ,ground etc ) check it
 

I think I have connected it correctly 'coz I already tried redoing the circuit many times.

:( I wish I could make this work.. especially using the keypad...
 

oh it's finally working ^__^ I tried to change the connection from the schematic on the pdf to the sample schematic on the Mikro C lcd library... :D

I am now trying to connect keypad on my circuit... I will ask again later for help if I will be having problems... thanks to all :D
 

Are you implementing this design in real hardware or simulation such as Proteus?

Are you using the following schematic and code example?

**broken link removed**

If not, what example schematic and code are you using? Please post them.

If so, what is the crystal frequency you have used for the design? Have you set the clock frequency correctly in MikroC?

BigDog
 
Displaying and Keypress is now ok :D

^^ Thanks for all the help...

My next problem is how to connect and code a coin slot and gsm module on pic16f877a

Please help me...
 

My next problem is how to connect and code a coin slot and gsm module on pic16f877a

Do you have the datasheet for the coin slot? If so, please post or upload it.

GSM modules typically have either an asynchronous serial port (UART), SPI interface or both. The simplest implementation would be to use the PICs UART to establish a serial connection to the GSM's UART. Most GSM modules use an AT Command Set, similar to traditional POTS line modems, like the old Hayes modem, to setup/configure, dial, etc.

BigDog
 

This is the connection written on the back of our coin slot... It is a single coin validator.... I am planning to buy another coin slot, so I could use 2 kinds of coins... But if our budget can purchase a multicoin slot, I will replace this coin slot...

Gray: Counter +/-
Red: DC +12v
White: Coin Signal
Black: Ground
Gray: Counter -/+



I really don't have idea on how I will connect this to pic16f877a and how will I code this...
 

regarding with coin slots, mw too im having a problem in connecting it to the PIC16F877a for the fact that i bought it cheap.
but upon testing individually. im having a reading of 3.5 v (which is considered logic 1 by the microcontroller ) across the coin signal and the ground. yet when im testing it to a 7 segment display to see the on and off state of the coin slot through the LED's, i cant come up with that output.

---------- Post added at 16:50 ---------- Previous post was at 16:43 ----------

can i connect the coin signal as a direct input at a certain PICf16877a port?does it have a high current that can wreck the PIC?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top