LCD issue with EasyPIC5


Closed Thread
Results 1 to 13 of 13
  1. #1
    Join Date
    May 2008
    Location
    Florida
    Posts
    64

    Angry LCD issue with EasyPIC5

    Following mister_e's suggestion, I decided to run the examples included with the board.

    I don't use their compiler, but they include a HEX file and the code.

    Code:
    ' *
    ' * Project name
    '     Lcd_Test (Simple demonstration of the LCD Library functions)
    ' * Copyright
    '     (c) MikroElektronika, 2005-2008
    ' * Description
    '     This is a simple demonstration of LCD library functions. LCD is first
    '     initialized, then some text is written at the first row.
    ' * Test configuration
    '     MCU             PIC16F887
    '     Dev.Board       EasyPIC5
    '     Oscillator      HS, 08.0000 MHz
    '     Ext. Modules    LCD 2x16
    '     SW              mikroC v8.0
    ' * NOTES
    '     None.
    ' *
    
    program Lcd_Test
    
    dim text as string[16]
    
    main:
      ANSEL  = 0                              ' Configure AN pins as digital I/O
    	ANSELH = 0
      text = "mikroElektronika"
      Lcd_Config(PORTB,3,2,1,0,PORTB,4,7,5) ' Lcd_Init_EP5, see Autocomplete
    
      LCD_Cmd(LCD_CLEAR)       ' Clear display
      LCD_Cmd(LCD_CURSOR_OFF)  ' Turn cursor off
      LCD_Out(1,1, text)       ' Print text to LCD, 1st row, 1st column
      Delay_ms(1000)
      LCD_Out(2,6,"mikroE")    ' Print text to LCD, 2nd row, 6th column
    end.
    Loaded this up and to my surprise nothing, zip, nada. LCD has blocks, LEDs off.

    Using PIC16F887 included with the board.

    But if I load one of their other LCD examples it works.

    So I fired up PBP and wrote this.
    Code:
    ' PicBasic Pro program to display a message on LCD
    
    ' Define LOADER_USED to allow use of the boot loader.
    ' This will not affect normal program operation.
    'Define	LOADER_USED	1
    define OSC 8
    
    ' Define LCD registers and bits
    Define  LCD_DREG        PORTB
    Define  LCD_DBIT        0
    Define  LCD_RSREG       PORTB
    Define  LCD_RSBIT       4
    Define  LCD_EREG        PORTB
    Define  LCD_EBIT        5
    
            TRISB = 0
            Low PORTB.4     ' LCD R/W line low (W)
            Pause 250       ' Wait for LCD to start up
    
    
    loop:   Lcdout $fe, 1   ' Clear screen
            Pause 250       ' Wait .5 second
    
            Lcdout $FE, $80, "16F84 Working"  
            Pause 500       ' Wait .5 second
    
            Lcdout $fe, $c0, "Board : 8MHz"        
            Pause 2000       ' Wait .5 second
    
            Goto loop       ' Do it forever
            End
    No luck with the 887 PortB.4 LED lights and stays on, but if I change to 16F84 it works fine so I know I'm not too crazy.

    I have set the config bits every way I can think of, no luck.

    I am sure I am over looking something. I am thinking about downloading MikoBasic but don't really see any point.
    Can someone rub my nose in it?

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by manwolf View Post
    Code:
    Define  LCD_RSREG       PORTB
    Define  LCD_RSBIT       4
    
            Low PORTB.4     ' LCD R/W line low (W)
    No luck with the 887 PortB.4 LED lights and stays on, but if I change to 16F84 it works fine so I know I'm not too crazy.
    So, is PortB.4 the RS pin or the R/W pin?

  3. #3
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Talking Rtfds ...

    Hi, Manwolf

    The '887 has ANALOG pins on PortB ... I believe.

    sooooooo ....

    I miss something in your listing.

    Alain

    PS: I already saw that on a ME "C" Forum ... LoL !!! ( you're not the only one !!! )

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  4. #4
    Join Date
    Mar 2004
    Location
    UK-Midlands
    Posts
    84


    Did you find this post helpful? Yes | No

    Default

    Hi Manwolf,

    When using their hex files with their programming software (PicFlash) it somethines uses default fuses.
    Check oscillator is set to HS not 'XT' on the programming software?
    Also the link settings on the board are set ok?

    The suplied hex file works ok on my EP5

    Bob

  5. #5
    Join Date
    May 2008
    Location
    Florida
    Posts
    64


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    So, is PortB.4 the RS pin or the R/W pin?
    According to their schematic RS Ski

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by manwolf View Post
    According to their schematic RS Ski
    Ok, you've got it described as both of them...it's just a note.
    No harm done in setting the R/W pin permanently at the write level, unless you plan on using it's internal CGRAM for a bit of extra ram.

  7. #7
    Join Date
    May 2008
    Location
    Florida
    Posts
    64


    Did you find this post helpful? Yes | No

    Default

    Skimask- they have R\W hardwired to GND on this board.

    Well, Acetronics gets the cookie today.

    Adding:

    INTCON = 0
    ANSEL = 0
    ANSELH = 0

    Gets what I wanted on the LCD. Can't fix the EasyPic5 example code(yet). First learn how to crawl, then with luck I might be able to stand up.

    So far I have been working with 3 different chips, 16F877A, 877, and 84 on two different boards. Should I continue that way or try to focus more on one combination until I get on my feet?

    After spending a few nights reading posts here I saw most common problem was getting the darn chip configured and the ports set properly. I figured using 3 different MCUs would give me more chances to learn setting things up or break them as case may be.

    I want to Thank all of the members who have responded to my posts, don't give up hope.
    I may learn how to read the datasheets. Right now half is in english and the rest is in some ancient dialect that totally escapes me.
    Last edited by manwolf; - 15th June 2008 at 00:14.

  8. #8
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by manwolf View Post
    So far I have been working with 3 different chips, 16F877A, 877, and 84 on two different boards. Should I continue that way or try to focus more on one combination until I get on my feet?
    Which PICs do you actually have on hand?

  9. #9
    Join Date
    May 2008
    Location
    Florida
    Posts
    64


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    Which PICs do you actually have on hand?
    16F84
    16F628
    16F877
    16F887

  10. #10
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by manwolf View Post
    16F84
    16F628
    16F877
    16F887
    If it were me, I'd stick with the 16F887. (also pay attention with the older chips, whether or not they're the A version or not) The 84, 628, and 877 are old school. Nothing wrong with them at all.

    The '887 is comparatively new, has a lot of features that the 877(A) doesn't have.
    If you get used to the '887, everything it does/has easily translates down to the smaller PICs.
    AND...everything the '887 does/has, can be ported to the higher end, faster, bigger, more complex 18Fxxx series.
    As an example that I've used a few times with others...I build an MP3 player awhile back, started off with a 16F877A, ran out of code space, plugged in an 18F452 (double the code space), ran out of code space with that, plugged in an 18F4620.......All without physically changing ANYTHING in the circuit, just a few registers here and there needed to be changed.
    In addition to that, I started out my latest project with an 18F4620, recently moved up to an 18F4685.
    So...in summation:
    PIC16F877A = 16K, PIC18F452 = 32K, PIC18F4620 = 64K, PIC18F4685 = 96K.
    It's all about the toys

  11. #11
    Join Date
    May 2008
    Location
    Florida
    Posts
    64


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    It's all about the toys
    ROFLMAO

    So true, all older chips are A version.

    Thanks for your advise I will focus on the 16F887. Time to break out the old checkbook and get a couple of spares. Guess I might pick up a couple of the 18Fs as well.

  12. #12
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by manwolf View Post
    Thanks for your advise I will focus on the 16F887. Time to break out the old checkbook and get a couple of spares. Guess I might pick up a couple of the 18Fs as well.
    Yep, get to know that '887.
    As far as the 18F, if it was me...I'd grab a couple of 18F4550 (USB) and 18F4685 (lotsa code space + CAN). And if you want the smaller 28 pin package, 18F2550 and 18F2685.
    There are newer ones out there...but I don't have any use for them at the moment so I can't comment on those.

  13. #13
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by manwolf View Post
    Can't fix the EasyPic5 example code(yet).
    Hi, Manwolf

    Want to translate the MKE " LCD Test" you showed ad first post ???

    Really Interesting to see the MKB and PbP differences for LCD commands ...

    Now, for your LED ... Outputs are BISTABLE ... If you "tell" them to be High ... they stay high !!! ( stupid thing ! )

    you also must "tell" them to turn LOW ...

    Also remember you can't use LCD on PortB AND the PortB Leds on EasyBoards at the same time ... ( a look at the board scheme will lit your light )

    You must use another Port for your Leds ...

    A quick tour into PbP Manual seems useful ... you to see how " main" commands work.

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Similar Threads

  1. I can not figure out an LCD issue
    By lilimike in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 11th March 2010, 13:54
  2. 16f688 LCD what have I done wrong
    By spitfiredriver in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 8th August 2009, 19:54
  3. Play with LCD on PICDEM
    By The IceMan in forum mel PIC BASIC
    Replies: 5
    Last Post: - 22nd August 2008, 16:56
  4. Code Issue - select case or 'if' issue - not sure why
    By jamie_s in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 7th October 2007, 08:52
  5. LCD will not start
    By btaylor in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 24th May 2007, 02:30

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts