lost in lcd land


Closed Thread
Results 1 to 27 of 27
  1. #1

    Unhappy lost in lcd land

    new to picpro trying to get a lcd display using lcdout tried all examples and info i can find hookup seems ok using either f628a or f627 no nothing changed porta to digital nothing any help would be greatly appreicated if i cant get this far
    in trouble

  2. #2
    Join Date
    Jul 2005
    Posts
    78


    Did you find this post helpful? Yes | No

    Default

    Well, if you post a schematic or some code we may be more helpful.

    Re-check the examples shown in the book. Make sure all your define lines are 100%. Buzz out the breadboard again. All wires!

    And lastly, as it catches me near every time I start a new PIC, make sure the pins you connect to are not used for some analog function (PICs default to those). You can try something like setting all the LCD drive pins high and low in a loop, make sure they all do that. Fast loop if you have a scope, slow loop if you use a DVM.

    The LCD stuff works.

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    also there's some i/o that can't be used as OUTPUT, there's also some with open-drain... just post your code here and say if you're using the internal oscillator or an external crystal... if so wich speed.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4


    Did you find this post helpful? Yes | No

    Question update

    the code is the example in pbp book lcdout pg 94
    wiring checks ok using internal osc on 628a

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Did you add CMCON=7 ?
    Is any pull-up resistor on RA.4?
    Did you add a start-up delay for the LCD between 500mSec and 2 Second before using the first LCDOUT?
    Are you sure of your Config Fuse setting for the MCLR pin and Internal OSC?
    ...
    ...
    ...
    Are you sure your LCD controller is compatible with the Hitachi one?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  6. #6


    Did you find this post helpful? Yes | No

    Unhappy internal osc

    problem seems to be activating the internal osc on the f628a
    define osc 4 does not work any help would be appreicated dont see anything in pbp manual

  7. #7


    Did you find this post helpful? Yes | No

    Exclamation still need help

    yes to the first ones ???? how do you set config fuse never seen this one in the manual?? does anyone else think the manual is very weak and not for the newbe

  8. #8
    Join Date
    Jul 2005
    Posts
    78


    Did you find this post helpful? Yes | No

    Default

    The config isn't the easiest thing to set. Here's how I do it:

    First, I set my assembler to MPASM. You'll find a tab for this in MCS under View | Compile & Program Options.

    Then, find the .inc file under the PBP folder that PBP used for your specific device, such as 16F628A.INC for the 628A you mentioned you might use.

    Open this file in any text editor (notepad works!) and find the __config fine, and comment it with a semicolon (that's the comment character in assembly)

    MPLAB makes a nice platform to set your config bits. Select the device you're using and find the config bits panel. You can see all the config choices, select them, and it gives you the proper names and valuses for the config settings.

    In your .bas file, add the config settings. Here's how that looked for a recent F88 project of mine:

    asm
    __config _CONFIG1, 2f50h
    __config _CONFIG2, 3ffch
    endasm

    2cents: When I'm trying to get a new PIC project up, I do the smallest steps first, things like set the osc frequency and have it come out on a pin so I can make sure I at keast have the clock I need.

    The OSC statement does not set the oscillator, it just tells the compiler what freq you think you're running the osc at.

  9. #9


    Did you find this post helpful? Yes | No

    Red face still trying

    thanks for your help. did not find the line in my include file to rem out
    tried adding your line got several errors about symble not defined did assemble
    however it did not solve the problem any help would be appreicated

  10. #10
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Using MPASM
    Code:
        '
        '    PIC Configuration
        '    =================
        @ __CONFIG  _INTRC_OSC_NOCLKOUT & _MCLRE_OFF  &  _LVP_OFF & _WDT_OFF & _PWRTE_ON  & _BODEN_ON  
        
        '
        '    Hardware configuration
        '    ======================
        CMCON=7                    ' disable internal comparator
        TRISA=0                    ' Set all PORTA capable i/o to output
        TRISB=0                    ' Set all PORTB i/o to output
        
        '
        '    Hardware initialisation
        '    =======================
        Pause 1000                 ' 1 second for LCD initialisation
        
        '
        '    Main loop
        '    =========
    Start:
        LCDOUT $FE,1,"Should Work now!"
    Here:
        Goto here
    Using PM
    Code:
        '
        '    PIC Configuration
        '    =================
        @ DEVICE  PIC16F628, INTRC_OSC_NOCLKOUT, WDT_OFF, PWRT_ON, MCLR_OFF, LVP_OFF, PROTECT_OFF
        
        '
        '    Hardware configuration
        '    ======================
        CMCON=7                    ' disable internal comparator
        TRISA=0                    ' Set all PORTA capable i/o to output
        TRISB=0                    ' Set all PORTB i/o to output
        
        '
        '    Hardware initialisation
        '    =======================
        Pause 1000                 ' 1 second for LCD initialisation
        
        '
        '    Main loop
        '    =========
    Start:
        LCDOUT $FE,1,"Should Work now!"
    Here:
        Goto here
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  11. #11


    Did you find this post helpful? Yes | No

    Unhappy still trying

    problem seems to be the microstudio does not like the inc files that came with the pbp and this is the one i seem to need but get many errors works much better with the include files that came with mplab still doesnot give what i want but no errors. tried to unstall everthing and reinstall but no use
    could reall use some help here??/

  12. #12
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    what are the error you get?
    What is your PicBasic Pro version?
    What is your LCD model?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  13. #13


    Did you find this post helpful? Yes | No

    Default keep going

    error message error[118] some file overwriteing previous address contents (2007)
    using a hitachi 44780
    thanks for staying with me

  14. #14


    Did you find this post helpful? Yes | No

    Arrow forgot

    picbasic pro 2.46

  15. #15
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Ahhhh, read the long story there
    http://www.picbasic.co.uk/forum/showthread.php?t=543
    Pay attention to post #5

    As far as i remind, it should work anyway but it's still unpleasant to see some error message

    I don't know why Melabs define them anyways... i always comment out all of them for all PIC i use.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  16. #16


    Did you find this post helpful? Yes | No

    Talking still trying

    we come a long way in the past couple of days however it still does not work even with known operating programs its tough to get the int osc functioning
    dont know whats left

    side thought pbp creates 6 files for a program hex-asm-bas-cod-lst-mac
    know what the first three function be see no informaion on the last 3

    still think the manuals need upgradeing to deal with beginers unless they dont want any
    Last edited by jcleaver; - 21st May 2006 at 03:34.

  17. #17
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    is a simple LED blink work with the same config fuse as posted before?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  18. #18


    Did you find this post helpful? Yes | No

    Default answer

    no | none of my working programs with external osc will work with int osc
    and the described settings.
    thats why i wanted info on files to see if it was really getting changed

  19. #19
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    1. Save the following code as MyTest.BAS into your PBP directory...

    Code:
    	'
    	'	Device Programming Options
    	'	--------------------------
    	@ DEVICE pic16F628, INTRC_OSC_NOCLKOUT
    			' System Clock Options	
    	@ DEVICE pic16F628, WDT_ON
    			' Watchdog Timer
    	@ DEVICE pic16F628, PWRT_ON
    			' Power-On Timer
    	@ DEVICE pic16F628, BOD_ON
    			' Brown-Out Detect
    	@ DEVICE pic16F628, MCLR_OFF
    			' Master Clear Options (Internal)
    	@ DEVICE pic16F628, LVP_OFF
    			' Low-Voltage Programming
    	@ DEVICE pic16F628, CPD_OFF
    			' Data Memory Code Protect
    	@ DEVICE pic16F628, PROTECT_OFF
    			' Program Code Protection
    
    	'
    	'	Hardware Assignments
    	'	--------------------
    	LEDA var PortA.0
    	LEDB var PortB.0
    
    	'
    	'	Initialise PIC
    	'	--------------
    	TRISA=%00000000			' PortA all OUTPUT
    	TRISB=%00000000			' PortB all OUTPUT
    	CMCON=%00000111			' Comparators OFF
    
    	'
    	'	Main Program
    	'	------------
    Loop:
    	Toggle LEDA
    	Pause 500
    	Toggle LEDB
    	Pause 500
    	Goto Loop
    
    	'
    	End
    2. Compile (approx 67 words) by opening up a DOS box, logging into the PBP directory and from it use the command line...

    PBP -p16F628 MyTest -v

    3. Program your PIC...

    Results...

    1. If it fails to Compile you have a bum PBP installation
    2. If it fails to compile you may not have logged into your PBP directory
    3. If it compiles but doesn't program you have a bum programmer/software
    4. If the PIC does not run, your programmer may have changed the CONFIG Fuse Settings - check this before you hit the BURN Button...
    5. If the PIC does not run you have a Bad PIC or have forgotten to pay your electric company.
    6. I'm making assumptions you can wire Vss and Vdd to your PIC (MCLR or xtal/resonator not required), and that you can hang an couple of LEDs with a Series Resistors (any value between 180R-390R) between the approprate PIC pin and Vss (or Vdd), and you can figure which way around to nail it.

    A program compiled for a 16F628 will happilly burn into an 'A' version without needing recompilation.

  20. #20


    Did you find this post helpful? Yes | No

    Default ok

    your a sweetheart. it works fine using this method
    now for the million dollar question why??/

    dont know what to do to get it to function out of microstudio

    any help?//\



    thanks

  21. #21


    Did you find this post helpful? Yes | No

    Default update

    when i tried using my old method microstudio on this program
    got many errors illegal opcode found label after colum one
    error 122 warning 207 so dont know whats going on
    have tried to reinstall the software many many many times??/

    hate to have to learn how to do this in dos

  22. #22


    Did you find this post helpful? Yes | No

    Default update two

    tried doing this not using mpasm and worke fine but dont know how i got here
    but it did work

  23. #23
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    >your a sweetheart.

    I know.

    >it works fine using this method now for the million dollar question why??/

    Because I programmed it.

    >dont know what to do to get it to function out of microstudio

    Neither do I - I don't use those things...

    >any help?//\

    Not with Microcode studio

    >thanks

    You're welcome

    Now let's move on and get your LCD working... connect it as per Page 96 of the manual, copy and save the below code, and compile as before... Remove the LED from PortA.0 but keep the one on PortB.0 - the blinking LED is there to tell you it's all working...

    Code:
    	'
    	'	Device Programming Options
    	'	--------------------------
    	@ DEVICE pic16F628, INTRC_OSC_NOCLKOUT
    			' System Clock Options	
    	@ DEVICE pic16F628, WDT_ON
    			' Watchdog Timer
    	@ DEVICE pic16F628, PWRT_ON
    			' Power-On Timer
    	@ DEVICE pic16F628, BOD_ON
    			' Brown-Out Detect
    	@ DEVICE pic16F628, MCLR_OFF
    			' Master Clear Options (Internal)
    	@ DEVICE pic16F628, LVP_OFF
    			' Low-Voltage Programming
    	@ DEVICE pic16F628, CPD_OFF
    			' Data Memory Code Protect
    	@ DEVICE pic16F628, PROTECT_OFF
    			' Program Code Protection
    
    	'
    	'	Hardware Assignments
    	'	--------------------
    	LEDB var PortB.0
    		'
    		' 	LCD Display
    		'	-----------
    	Define LCD_DREG PORTA		' Port for LCD Data
    	Define LCD_DBIT 0		' Use upper 4 bits of Port
    	Define LCD_RSREG PORTA		' Port for RegisterSelect (RS) bit
    	Define LCD_RSBIT 4		' Port Pin for RS bit
    	Define LCD_EREG PORTB		' Port for Enable (E) bit
    	Define LCD_EBIT 3		' Port Pin for E bit
    	Define LCB_BITS 4		' Using 4-bit bus
    	Define LCD_LINES 2		' Using 2 line Display
    	Define LCD_COMMANDUS 2000	' Command Delay (uS)
    	Define LCD_DATAUS 50		' Data Delay (uS)
    
    	'
    	'	Initialise PIC
    	'	--------------
    	TRISA=%00000000			' PortA all OUTPUT
    	TRISB=%00000000			' PortB all OUTPUT
    	CMCON=%00000111			' Comparators OFF
    	Pause 2000			' wait for LCD to wake-up
    	'
    	'	Main Program
    	'	------------
    Loop:
    	LCDOut $FE,1,"Hello"
    	Pause 500
    	LCDOut $FE,1
    	Toggle LEDB
    	Pause 500
    	Goto Loop
    
    	'
    	End

  24. #24


    Did you find this post helpful? Yes | No

    Talking Thanks

    Still Having Lcd Problems But At Least The Chip Is Now Functioning
    Led Flashing Will Trace Out And Maybe Find Whats Hapeing With It
    Again Thanks
    Will Advise On Progress

  25. #25


    Did you find this post helpful? Yes | No

    Thumbs up Happy Days Are Here Again

    Wow Beauty And Brains
    Got It Working Thanks Thanks

    Now The 2 Million Dollar Question (no Not That One)

    Where Do You Get Manuals For What Your Doing Does Not Seem To Be Whats Happeing With What I Purchased

  26. #26
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Well tell me what you purchased...

    On my part I'm using PBP2.46 with the latest patches taken from the MeLabs website. The manuals are what comes with the product or again downloaded from the MeLabs website. The DATASHEETS for the PICs come from the Microchip Website. I do not use Microcode studio. All code in my examples comes from the Manual or the Datasheet. You should have EXACTLY the same as I have - except you additionally have MCS which dosen't turn me on.

    I also look at what the installation disks have put on my PC. There's stuff to be learnt from that... Readme files and documentation and examples... look and learn...

  27. #27


    Did you find this post helpful? Yes | No

    Arrow thanks

    i have the same thing pbp 2.4 just let in install itself it set up microstudio as the windows interface will searc the cd for more info

    thanks again lady

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 : 1

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