+ Post New Thread
Results 1 to 19 of 19
  1. #1
    Junior Member level 1
    Points: 328, Level: 3

    Join Date
    Jul 2011
    Posts
    18
    Helped
    0 / 0
    Points
    328
    Level
    3

    need example for pic16f877

    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.

  2. #2
    Advanced Member level 3
    Points: 5,999, Level: 18
    Achievements:
    7 years registered

    Join Date
    Jun 2007
    Posts
    821
    Helped
    219 / 219
    Points
    5,999
    Level
    18

    Re: need example for pic16f877

    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



  3. #3
    Advanced Member level 5
    Points: 33,613, Level: 44
    ckshivaram's Avatar
    Join Date
    Apr 2008
    Location
    villingen (Germany) / Bangalore
    Posts
    5,070
    Helped
    2154 / 2154
    Points
    33,613
    Level
    44
    Blog Entries
    1

    Re: need example for pic16f877

    your solution is here

    http://yunus.hacettepe.edu.tr/~cdogr...NTERFACING.pdf

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

    also check these
    INTERFACING PIC MICROCONTROLLERS APPLICATION PAGE LIST
    http://picnote.blogspot.com/2008/06/...ic16f877a.html
    " It is so simple to be happy,
    but it is so difficult to be simple"


    4 members found this post helpful.

  4. #4
    Advanced Member level 2
    Points: 1,782, Level: 9

    Join Date
    Jul 2009
    Location
    philippines
    Posts
    606
    Helped
    66 / 66
    Points
    1,782
    Level
    9

    Re: need example for pic16f877

    Quote Originally Posted by Setsuna13 View Post
    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..

    My Embedded World: LCD interfacing with Microcontrollers tutorial - 4-bit Mode
    The biggest thing I learned in life is that the real world does not follow a comprehensive step by step program. I learned early on to hope for the best, and prepare for the worst. Disappointments will be many. But you must always accept, adapt and move on.


    1 members found this post helpful.

    •   Alt25th August 2011, 11:14

      advertising

        
       

  5. #5
    Advanced Member level 5
    Points: 38,206, Level: 47
    Achievements:
    Created Album pictures Created Blog entry 7 years registered
    Tahmid's Avatar
    Join Date
    Jun 2008
    Location
    Silicon Valley, California, USA (from Dhaka, Bangladesh)
    Posts
    4,758
    Helped
    1788 / 1788
    Points
    38,206
    Level
    47
    Blog Entries
    22

    Re: need example for pic16f877

    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.



  6. #6
    Junior Member level 1
    Points: 328, Level: 3

    Join Date
    Jul 2011
    Posts
    18
    Helped
    0 / 0
    Points
    328
    Level
    3

    Re: need example for pic16f877

    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...



  7. #7
    Administrator
    Points: 68,974, Level: 64
    Achievements:
    Created Album pictures Created Blog entry 7 years registered
    bigdogguru's Avatar
    Join Date
    Mar 2010
    Location
    Southwest, USA
    Posts
    9,812
    Helped
    2350 / 2350
    Points
    68,974
    Level
    64
    Blog Entries
    4

    Re: need example for pic16f877

    Quote Originally Posted by Setsuna13 View Post
    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


    1 members found this post helpful.

    •   Alt26th August 2011, 17:12

      advertising

        
       

  8. #8
    Advanced Member level 5
    Points: 33,613, Level: 44
    ckshivaram's Avatar
    Join Date
    Apr 2008
    Location
    villingen (Germany) / Bangalore
    Posts
    5,070
    Helped
    2154 / 2154
    Points
    33,613
    Level
    44
    Blog Entries
    1
    " It is so simple to be happy,
    but it is so difficult to be simple"


    2 members found this post helpful.

    •   Alt26th August 2011, 17:17

      advertising

        
       

  9. #9
    Junior Member level 1
    Points: 328, Level: 3

    Join Date
    Jul 2011
    Posts
    18
    Helped
    0 / 0
    Points
    328
    Level
    3

    Re: need example for pic16f877

    Quote Originally Posted by ckshivaram View Post
    your solution is here

    http://yunus.hacettepe.edu.tr/~cdogr...NTERFACING.pdf

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

    also check these
    INTERFACING PIC MICROCONTROLLERS APPLICATION PAGE LIST
    http://picnote.blogspot.com/2008/06/...ic16f877a.html
    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 Index of /~cdogruer/Omu409/Documents 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 by Setsuna13; 15th September 2011 at 16:00.



  10. #10
    Advanced Member level 4
    Points: 11,720, Level: 25
    Achievements:
    Created Blog entry 7 years registered
    thannara123's Avatar
    Join Date
    Jan 2010
    Location
    Nedumkandam, India, India
    Posts
    1,346
    Helped
    117 / 117
    Points
    11,720
    Level
    25
    Blog Entries
    2

    Re: need example for pic16f877

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



  11. #11
    Junior Member level 1
    Points: 328, Level: 3

    Join Date
    Jul 2011
    Posts
    18
    Helped
    0 / 0
    Points
    328
    Level
    3

    Re: need example for pic16f877

    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...



  12. #12
    Advanced Member level 5
    Points: 38,206, Level: 47
    Achievements:
    Created Album pictures Created Blog entry 7 years registered
    Tahmid's Avatar
    Join Date
    Jun 2008
    Location
    Silicon Valley, California, USA (from Dhaka, Bangladesh)
    Posts
    4,758
    Helped
    1788 / 1788
    Points
    38,206
    Level
    47
    Blog Entries
    22

    Re: need example for pic16f877

    Looks like a contrast issue. Have you connected a pot on the contrast adjust pin and adjusted the pot until you see the display?

    Take a look here: http://www.edaboard.com/thread194246-2.html#post824737

    Hope this helps.
    Tahmid.



  13. #13
    Junior Member level 1
    Points: 328, Level: 3

    Join Date
    Jul 2011
    Posts
    18
    Helped
    0 / 0
    Points
    328
    Level
    3

    Re: need example for pic16f877

    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



  14. #14
    Administrator
    Points: 68,974, Level: 64
    Achievements:
    Created Album pictures Created Blog entry 7 years registered
    bigdogguru's Avatar
    Join Date
    Mar 2010
    Location
    Southwest, USA
    Posts
    9,812
    Helped
    2350 / 2350
    Points
    68,974
    Level
    64
    Blog Entries
    4

    Re: need example for pic16f877

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

    Are you using the following schematic and code example?

    L10.2KEYPAD LCD INTERFACING: Reading Keypad

    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


    1 members found this post helpful.

  15. #15
    Junior Member level 1
    Points: 328, Level: 3

    Join Date
    Jul 2011
    Posts
    18
    Helped
    0 / 0
    Points
    328
    Level
    3

    Re: need example for pic16f877

    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...



    •   Alt16th September 2011, 07:50

      advertising

        
       

  16. #16
    Administrator
    Points: 68,974, Level: 64
    Achievements:
    Created Album pictures Created Blog entry 7 years registered
    bigdogguru's Avatar
    Join Date
    Mar 2010
    Location
    Southwest, USA
    Posts
    9,812
    Helped
    2350 / 2350
    Points
    68,974
    Level
    64
    Blog Entries
    4

    Re: need example for pic16f877

    Quote Originally Posted by Setsuna13 View Post
    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



  17. #17
    Junior Member level 1
    Points: 328, Level: 3

    Join Date
    Jul 2011
    Posts
    18
    Helped
    0 / 0
    Points
    328
    Level
    3

    Re: need example for pic16f877

    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...



  18. #18
    Junior Member level 1
    Points: 328, Level: 3

    Join Date
    Jul 2011
    Posts
    18
    Helped
    0 / 0
    Points
    328
    Level
    3

    Re: need example for pic16f877

    please help me...



  19. #19
    Newbie level 4
    Points: 188, Level: 2

    Join Date
    Jan 2012
    Posts
    6
    Helped
    0 / 0
    Points
    188
    Level
    2

    Re: need example for pic16f877

    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?



--[[ ]]--