lost in lcd land


Closed Thread
Results 1 to 27 of 27

Hybrid View

  1. #1


    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

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

  3. #3


    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

  4. #4


    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

  5. #5


    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

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

  7. #7


    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

  8. #8


    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

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

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