LCD BARgraphs


Results 1 to 40 of 233

Thread: LCD BARgraphs

Threaded View

  1. #11
    Join Date
    Oct 2005
    Posts
    34


    Did you find this post helpful? Yes | No

    Default Bar Graph

    This is my version of the bar graph.
    Code:
    '****************************************************************
    '*  Name    : Bargraph.BAS                                      *
    '*  Author  : Chris Bezuidenhout                                *
    '*  Notice  : Copyright (c) 2005 Micro Developments             *
    '*          : All Rights Reserved                               *
    '*  Date    : 2005/07/19                                        *
    '*  Version : 1.0                                               *
    '*  URL     : http://www.patenttrade.net                        *
    '*  E-mail  : [email protected]                             *
    '*  Mobile  : +27-72-795-0107                                   *
    '*  Notes   : This is a bargraph demo for a 2X20 LCD Display    *
    '*          : it is free to use and distribute by any one       *
    '*          : as long as this Copyright note is not altered or  *
    '*          : removed, can be used as an analog meter.          *
    '*  Device  : PIC16F877 can be altered to work on other devices *
    '****************************************************************
    	INCLUDE "Modedefs.Bas"
    
    DEFINE 	OSC 4		' Set Xtal Frequency 		
    DEFINE LCD_DREG PORTA     ' Set LCD Data port
    DEFINE LCD_DBIT 0         ' Set starting Data BIT (0 OR 4) IF 4-BIT bus
    DEFINE LCD_RSREG PORTA    ' Set LCD Register Select port               
    DEFINE LCD_RSBIT 4        ' Set LCD Register Select BIT                
    DEFINE LCD_EREG PORTE     ' Set LCD Enable port, for other devices, use PORT A or B                           
    DEFINE LCD_EBIT 0         ' Set LCD Enable BIT                         
    DEFINE LCD_BITS 4         ' Set LCD bus side (4 OR 8 bits)             
    DEFINE LCD_LINES 2        ' Set number of lines ON LCD
    
    ' md Declare the Variables md
    
    	counter		VAR		BYTE
    	Text		VAR		BYTE[20]
    	X			VAR		BYTE
    	Y			VAR		BYTE
    PAUSE 500
    Main:	
    '*********Modefy first 5 characters in LCD character generator to display bargraph**********
    		LCDOut $fe,%1000000           'SET CG RAM ADD.
    		FOR X =1 TO 8                 
    		LCDOUT %10000
    		next x
    		FOR X=1 TO 8
    		LCDOUT %11000
    		NEXT X
    		FOR X=1 TO 8
    		LCDOUT %11100
    		NEXT X
    		FOR X=1 TO 8
    		LCDOUT %11110
    		NEXT X
    		FOR X=1 TO 8
    		LCDOUT %11111
    		NEXT X
    		LCDOut $fe,%10000000             'SET DD RAM ADD.
    '		FOR X = 0 TO 255
    '		LCDOUT $FE,1,#X,X
    '		PAUSE 100
    '		NEXT X
    LOOP1:		LCDOUT $FE,1,"This is a test"
    		
    		LCDOUT $FE,$C0          'clear second line and display bar graph
    		LCDOUT 0                'print first character
    		for X= 0 TO 19	        'change 19 to 15 for 16 character display
    		PAUSE 100
    		LCDOUT $FE,$10,1        'move curser back and overprint previous character
    		PAUSE 100
    		LCDOUT $FE,$10,2        'move curser back and overprint previous character
    		PAUSE 100
    		LCDOUT $FE,$10,3        'move curser back and overprint previous character
    		PAUSE 100
    		LCDOUT $FE,$10,4        'move curser back and overprint previous character
    		PAUSE 100
    		LCDOUT $FE,$14          'print next character
    		LCDOUT $FE,0
    		NEXT X
    
     		
     		GOTO LOOP1
    		
     END
    Last edited by ChrisMicro; - 9th January 2008 at 17:26.
    You can't teach an old dog new tricks, but I'm always willing to try.

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