Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

wanted for project pic16 and lcd, willing to pay

Status
Not open for further replies.

tracidfish

New Member
I am trying to build a project that requires an LCd output..
in order to do this I need a pic 16 that drives a 4x20 lcd.
i have had help from various members of this forum and over a week of playing about with it and yet i cannot get anything to work - i must be doing something wrong.

I am not really very good at electronics but I do enjoy programming.
I wonder if any one would be willing to build a simple pic and lcd for me that actually works!
of course i am willing to pay.!!

It would mean that I will be able to see what a working set up is like and learn from that and would also mean that I could move past this stage and hopefully start getting somethings finished on this project.

any offers please PM me.

it will need
pic16f628
4x20 lcd (4 bit mode) on port A only.

Thanks
 
Hi Charlie,

Filling in the "location" portion of your personal profile is a courtesy that many of us appreciate and it might help you get responses from resources close to you.
 
Last edited:
I know it's not exactly what your after, but I wrote this:
Jake's Electronics | Tutorials

also, not sure if your've seen these pdf's but i found them extreamly helpful when i was learning. (attached)

Oh, and just out of curiosity? Who much were you willing to pay?
 

Attachments

  • LCD Tutorial Part 1.pdf
    240.7 KB · Views: 267
  • LCD Tutorial Part 2.pdf
    159.1 KB · Views: 174
Hi Charlie,

Since you purchased your lcd display from Maplin I'll assume you're UK based. I'd suggest perservering with your code / hardware, it's only an lcd so there can't be that much wrong with it.

I noticed in the code you posted at the end of your previous thread that in a couple of places at least you had two instructions on the same line, hopefully these were just due to poor formatting. Can you do a proper code post using the '#' in the 'Your Message' dialog box?
 
If you're willing to part with cash then why not start with something like the MikroElektronika hardware? I've got a couple of their boards and they're very good, and the limitations on the free compilers are high enough for moderately complex projects.
 
it will need
pic16f628
4x20 lcd (4 bit mode) on port A only.

Thanks

hi,
If you live in the UK, send me a PM and will be pleased to help sort out the project, for no charge.

I have helped others in this way...:)
 
Hi Charlie,

Since you purchased your lcd display from Maplin I'll assume you're UK based. I'd suggest perservering with your code / hardware, it's only an lcd so there can't be that much wrong with it.

I noticed in the code you posted at the end of your previous thread that in a couple of places at least you had two instructions on the same line, hopefully these were just due to poor formatting. Can you do a proper code post using the '#' in the 'Your Message' dialog box?


Hopefuly this will come out better.

The code is from nigels web page, i have modified the LCD initilise routine as i could not get nigels to work.

here is a copy of the data sheet for my LCD, i am trying to use 4 bit mode
https://www.electro-tech-online.com/custompdfs/2010/04/dem16217syh-ly.pdf

Attatched somehwere is a image of the initilaisation procedure.



I would be gratefull of any comments

Code:
	LIST	p=16F628		;tell assembler what chip we are using
	include "P16F628.inc"		;include the defaults for the chip
	ERRORLEVEL	0,	-302	;suppress bank selection messages
	__config 0x3D18			;sets the configuration settings (oscillator type etc.)




		cblock	0x20			;start of general purpose registers
			count			;used in looping routines
			count1			;used in delay routine
			counta			;used in delay routine
			countb			;used in delay routine
			tmp1			;temporary storage
			tmp2
			templcd			;temp store for 4 bit mode
			templcd2	
		endc

LCD_PORT	Equ	PORTA
LCD_TRIS	Equ	TRISA
LCD_RS		Equ	0x04			;LCD handshake lines
LCD_RW		Equ	0x06
LCD_E		Equ	0x07

		org	0x0000

		movlw	0x07
		movwf	CMCON			;turn comparators off (make it like a 16F84)

Initialise	clrf	count
		clrf	PORTA
		clrf	PORTB



SetPorts	bsf 	STATUS,		RP0	;select bank 1
		movlw	0x00			;make all pins outputs
		movwf	LCD_TRIS
		bcf 	STATUS,		RP0	;select bank 0

		call	Delay100		;wait for LCD to settle
		


		call	LCD_Init		;setup LCD


		clrf	count			;set counter register to zero
Message		movf	count, w		;put counter value in W
		call	Text			;get a character from the text table
		xorlw	0x00			;is it a zero?
		btfsc	STATUS, Z
		goto	NextMessage
		call	LCD_Char
		call	Delay255
		incf	count, f
		goto	Message

NextMessage	call	LCD_Line2		;move to 2nd row, first column

		clrf	count			;set counter register to zero
Message2	movf	count, w		;put counter value in W
		call	Text2			;get a character from the text table
		xorlw	0x00			;is it a zero?
		btfsc	STATUS, Z
		goto	EndMessage
		call	LCD_Char
		incf	count, f
		goto	Message2

EndMessage	
		
Stop		goto	Stop			;endless loop




;Subroutines and text tables

;LCD routines

;Initialise LCD
LCD_Init	

      
        movlw   b'00110000'          ; step 1, "function set" 8-bit    |B0
        call    LCD_Cmd          ; write 4-bits only               |B0
		call 	Delay50 
		call 	Delay50

        movlw   b'00110000'            ; step 2, "function set" 8-bit    |B0
        call    LCD_Cmd          ; write 4-bits only               |B0
        call 	Delay50
		call 	Delay50


        movlw   b'00110000'            ; step 3, "function set" 8-bit    |B0
        call   LCD_Cmd          ; write 4-bits only               |B0
       	call 	Delay50
		call 	Delay50


        movlw   b'00100000'            ; step 4, "function set" 4-bit    |B0
        call    LCD_Cmd         ; write 4-bits only               |B0
      	call 	Delay50
		call 	Delay50
;
;  now we're in 4-bit mode and can handle 8-bit transactions
;
        movlw   b'00101000'     ; 4-bit, 2-lines, 5x7 font        |B0
        call    LCD_Cmd          ; send "function set" command     |B0
		call 	Delay50
		call 	Delay50

        movlw   b'00001000'     ; display, cursor, blink all off  |B0
        call    LCD_Cmd          ; send "display on/off" command   |B0
		call 	Delay50
		call 	Delay50

        movlw   b'00000001'     ; clear display (1.53-msecs)      |B0
        call    LCD_Cmd          ; send "entry mode set" command   |B0
       	call 	Delay50
		call 	Delay50
		call 	Delay50

        movlw   b'00000110'     ; cursor inc, shift off           |B0
        call    LCD_Cmd          ; send "entry mode set" command   |B0
		call 	Delay50
		call 	Delay50

        movlw   b'00001100'     ; display on, leave cursor off    |B0
        call    LCD_Cmd          ; send "display on/off" command   |B0
		call 	Delay50
		call 	Delay50



		retlw	0x00

; command set routine
LCD_Cmd		movwf	templcd
		swapf	templcd,	w	;send upper nibble
		andlw	0x0f			;clear upper 4 bits of W
		movwf	LCD_PORT
		bcf	LCD_PORT, LCD_RS	;RS line to 0
		call	Pulse_e			;Pulse the E line high

		movf	templcd,	w	;send lower nibble
		andlw	0x0f			;clear upper 4 bits of W
		movwf	LCD_PORT
		bcf	LCD_PORT, LCD_RS	;RS line to 0
		call	Pulse_e			;Pulse the E line high
		call 	Delay5
		call 	Delay5
		call 	Delay5
		retlw	0x00

LCD_CharD	addlw	0x30
LCD_Char	movwf	templcd
		swapf	templcd,	w	;send upper nibble
		andlw	0x0f			;clear upper 4 bits of W
		movwf	LCD_PORT
		bsf	LCD_PORT, LCD_RS	;RS line to 1
		call	Pulse_e			;Pulse the E line high

		movf	templcd,	w	;send lower nibble
		andlw	0x0f			;clear upper 4 bits of W
		movwf	LCD_PORT
		bsf	LCD_PORT, LCD_RS	;RS line to 1
		call	Pulse_e			;Pulse the E line high
		call 	Delay5
		retlw	0x00

LCD_Line1	movlw	0x80			;move to 1st row, first column
		call	LCD_Cmd
		retlw	0x00

LCD_Line2	movlw	0xc0			;move to 2nd row, first column
		call	LCD_Cmd
		retlw	0x00

LCD_Line1W	addlw	0x80			;move to 1st row, column W
		call	LCD_Cmd
		retlw	0x00

LCD_Line2W	addlw	0xc0			;move to 2nd row, column W
		call	LCD_Cmd
		retlw	0x00

LCD_CurOn	movlw	0x0d			;Set display on/off and cursor command
		call	LCD_Cmd
		retlw	0x00

LCD_CurOff	movlw	0x0c			;Set display on/off and cursor command
		call	LCD_Cmd
		retlw	0x00

LCD_Clr		movlw	0x01			;Clear display
		call	LCD_Cmd
		retlw	0x00

LCD_HEX		movwf	tmp1
		swapf	tmp1,	w
		andlw	0x0f
		call	HEX_Table
		call	LCD_Char
		movf	tmp1, w
		andlw	0x0f
		call	HEX_Table
		call	LCD_Char
		retlw	0x00

Delay255	movlw	0xff		;delay 255 mS
		goto	d0
Delay100	movlw	d'100'		;delay 100mS
		goto	d0
Delay50		movlw	d'50'		;delay 50mS
		goto	d0
Delay20		movlw	d'20'		;delay 20mS
		goto	d0
Delay5		movlw	0x05		;delay 5.000 ms (4 MHz clock)
d0		movwf	count1
d1		movlw	0xC7			;delay 1mS
		movwf	counta
		movlw	0x01
		movwf	countb
Delay_0
		decfsz	counta, f
		goto	$+2
		decfsz	countb, f
		goto	Delay_0

		decfsz	count1	,f
		goto	d1
		retlw	0x00

Pulse_e		bsf	LCD_PORT, LCD_E
		nop
		bcf	LCD_PORT, LCD_E
		retlw	0x00

;end of LCD routines

HEX_Table  	ADDWF   PCL       , f
            	RETLW   0x30
            	RETLW   0x31
            	RETLW   0x32
            	RETLW   0x33
            	RETLW   0x34
            	RETLW   0x35
            	RETLW   0x36
            	RETLW   0x37
            	RETLW   0x38
            	RETLW   0x39
            	RETLW   0x41
            	RETLW   0x42
            	RETLW   0x43
            	RETLW   0x44
            	RETLW   0x45
            	RETLW   0x46


Text		addwf	PCL, f
		retlw	'H'
		retlw	'e'
		retlw	'l'
		retlw	'l'
		retlw	'o'
		retlw	0x00

Text2		ADDWF   PCL, f
            	RETLW   'R'
            	RETLW   'e'
            	RETLW   'a'
            	RETLW   'd'
            	RETLW   'y'
            	RETLW   '.'
            	RETLW   '.'
            	RETLW   '.'
            	RETLW   0x00


		end
 

Attachments

  • lcd.png
    lcd.png
    217.4 KB · Views: 134
No the modified version does not work - hence why i m really stuck, I am confident that the LCd is connected correctly, i just cannot get it to fire.
 
No the modified version does not work - hence why i m really stuck, I am confident that the LCd is connected correctly, i just cannot get it to fire.

I didn't expect the initilisation change to make any difference.

If you wanted to send me an LCD like you're using, I could try it for you.
 
Last edited:
Hitachi compatible? have a look at this:
LCD Simulator {/JavaScipt} <- simulates an LCD, and you can bring each pin high, or low, on the net, once you can do what you want, try it with push buttons:
**broken link removed**
i have done it, it's very simple, after you can use the push buttons, make the PIC take each pin high or low, depending on what you want, the second link has both 8 bit, and 4 bit mode.
To free up pins...

if you can't initialize it with the push buttons, it may be damaged, or check the power lines, is the back light on? and can you mess with the contrast?
 
Hi Charlie,

Your modifications to that Tutorial code won't work. The changes should look something like this instead;

Code:
;
;  Initialise LCD
;
LCD_Init
        movlw   3               ; step 1, "function set" 8-bit
        call    LCD_Nyb         ; write 4-bits only
        movlw   3               ; step 2, "function set" 8-bit
        call    LCD_Nyb         ; write 4-bits only
        movlw   3               ; step 3, "function set" 8-bit
        call    LCD_Nyb         ; write 4-bits only
        movlw   2               ; step 4, "function set" 4-bit
        call    LCD_Nyb         ; write 4-bits only

        movlw   0x28            ;Set display shift
        call    LCD_Cmd
        movlw   0x06            ;Set display character mode
        call    LCD_Cmd
        movlw   0x0d            ;Set display on/off and cursor command
        call    LCD_Cmd
        call    LCD_Clr         ;clear display
        retlw   0x00
;
; command set routine
;
LCD_Cmd
        movwf   templcd
        swapf   templcd,w       ;send upper nibble
        andlw   0x0f            ;clear upper 4 bits of W
        movwf   LCD_PORT
        bcf     LCD_PORT,LCD_RS ;RS line to 0
        call    Pulse_e         ;Pulse the E line high
        movf    templcd,w       ;send lower nibble
LCD_Nyb
        andlw   0x0F            ;clear upper 4 bits of W
        movwf   LCD_PORT
        bcf     LCD_PORT,LCD_RS ;RS line to 0
        call    Pulse_e         ;Pulse the E line high
        call    Delay5
        retlw   0x00
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top