LCD BARgraphs


Closed Thread
Results 1 to 40 of 233

Thread: LCD BARgraphs

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Then you would use...

    <pre>PBPW -p16F628 123456789AndAFewMore.bas -v</pre>or use MCSP, it does it automatically.

    But since you bring up the command line option, there's a few things that could be a possible problem. Path settings, current directory ...

    Christopher,
    Are you compiling by command line, or an IDE?
    <br>
    DT

  2. #2
    Join Date
    Oct 2005
    Location
    New Jersey
    Posts
    425


    Did you find this post helpful? Yes | No

    Default

    Here is a screenshot of my error. I took out the LCD stuff just to make sure that wasn't causing the problem.

    Darrel,

    I'm not sure how to answer your question as I still new to PBP. In the screenshot is how I complie programs.

    Chris
    Attached Images Attached Images  

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    If you click on the Include file in the Code Explorer on the left side of the screen, does it pull up the file? Or does it create a new file?

    If it creates a new file, then the Include file is in the wrong folder.

    It should be in the same folder as "Bar Graph.bas".
    <br>
    DT

  4. #4
    Join Date
    Oct 2005
    Location
    New Jersey
    Posts
    425


    Did you find this post helpful? Yes | No

    Default

    Darrel,

    I got it, thanks for the help. The problem was that both files were saved as .pbp files. All of my programs are saved the same way and I have never had an issue.....until now. So, that part works but now I have another problem.

    I have a 2X16 LCD set up on a development board. I have one simple LCD program and that works fine. I put the same LCD commands into the bargraph program and it doesn't work. I can see weird charecters displayed on the first line but nothing on the second line. Within those charecters I do see numbers every now and again and when I turn the pot, I can see the value change so I know it's functional but just not displaying correctly. Here is the program:

    ; Initialize your hardware and LCD first.
    define osc 20

    ' Set LCD Data port
    DEFINE LCD_DREG PORTB
    ' Set starting Data bit (0 or 4) if 4-bit bus
    DEFINE LCD_DBIT 4
    ' Set LCD Register Select port
    DEFINE LCD_RSREG PORTB
    ' Set LCD Register Select bit
    DEFINE LCD_RSBIT 2
    ' Set LCD Enable port
    DEFINE LCD_EREG PORTB
    ' Set LCD Enable bit
    DEFINE LCD_EBIT 3
    ' Set LCD bus size (4 or 8 bits)
    DEFINE LCD_BITS 4
    ' Set number of lines on LCD
    DEFINE LCD_LINES 2
    ' Set command delay time in us
    DEFINE LCD_COMMANDUS 2000
    ' Set data delay time in us
    DEFINE LCD_DATAUS 100
    'This setup will tell PBP a 2-line LCD is connected in 4-bit mode with the data bus on the
    'top 4 bits of PORTB, Register Select on PORTB.1, and Enable on PORTB.0.





    DEFINE ADC_BITS 8 ' Number of bits in ADCIN result
    ADCON1.7 = 1 ' Right Justify AD result

    INCLUDE "LCDbar_INC.bas" ' Include the BARgraph routines

    Value VAR WORD ' Must be a WORD even though AD is 8bit

    LCDOUT $FE, 1 ' Clear Screen
    pause 500

    Loop1:
    ADCIN 2, Value
    LCDOUT $FE,2,"Value = ",DEC Value," "

    ; syntax- BARgraph Value, Row, Col, Width, Range, Style
    @ BARgraph _Value, 2, 0, 16, 255, lines



    GOTO Loop1


    Like I said, these LCD commands were copied word for word from another known program. Any ideas?

    Thanks again for the help.

    Chris

  5. #5
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    The DEFINEs don't match the comments. Might be the prob.

    Defines show RS on PORTB.2, and Enable on PORTB.3

    But, your comment says...
    <pre>'This setup will tell PBP a 2-line LCD is connected in 4-bit mode with the data bus on the<br>'top 4 bits of PORTB, Register Select on PORTB.1, and Enable on PORTB.0.</pre>
    DT

  6. #6
    Join Date
    Oct 2005
    Location
    New Jersey
    Posts
    425


    Did you find this post helpful? Yes | No

    Default

    Now, I am really confused. How come this program worked but the other one didn't?

    DEFINE OSC 20
    INCLUDE "LCDbar_INC.bas" ' Include the BARgraph routines
    ' Set LCD Data port
    DEFINE LCD_DREG PORTB
    ' Set starting Data bit (0 or 4) if 4-bit bus
    DEFINE LCD_DBIT 4
    ' Set LCD Register Select port
    DEFINE LCD_RSREG PORTB
    ' Set LCD Register Select bit
    DEFINE LCD_RSBIT 2
    ' Set LCD Enable port
    DEFINE LCD_EREG PORTB
    ' Set LCD Enable bit
    DEFINE LCD_EBIT 3
    ' Set LCD bus size (4 or 8 bits)
    DEFINE LCD_BITS 4
    ' Set number of lines on LCD
    DEFINE LCD_LINES 2
    ' Set command delay time in us
    DEFINE LCD_COMMANDUS 2000
    ' Set data delay time in us
    DEFINE LCD_DATAUS 100.

    DEFINE ADC_BITS 8 ' Number of bits in ADCIN result
    ADCON1.7 = 1 ' Right Justify AD result

    Value VAR WORD ' Must be a WORD even though AD is 8bit
    pause 1000
    LCDOUT $FE, 1, " "
    loop1:

    adcin 2,value

    LCDOUT $FE,2,"Value = ",DEC Value," "

    ; syntax- BARgraph Value, Row, Col, Width, Range, Style
    @ BARgraph _Value, 2, 0, 16, 255, lines

    goto loop1


    The only thing I adjusted was the pause commands and I moved the include file to the top of the program. I'm happy that it's working but I'd like to know for future reference incase it happens again. Thanks for the help Darrel.

  7. #7
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    You probably have an LCD that is very slow starting up and requires more than 500 ms before receiving it's first command.

    Being that you also have DEFINE LCD_DATAUS 100, it's seems reasonable.
    Most LCD's are happy with LCD_DATAUS 50, and only 250 ms power-up delay. But there are some that aren't.

    Try leaving the INCLUDE where it was, with the longer pauses. Just to see what happens.
    <br>
    DT

Similar Threads

  1. Is this code not initialising the LCD properly?
    By Platypus in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 30th January 2010, 19:14
  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. Need help with LCD number display.
    By Steve Matson in forum mel PIC BASIC
    Replies: 8
    Last Post: - 26th June 2007, 23:07
  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 : 2

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