[SOLVED] GLCD PIC MPLAB assembly

Status
Not open for further replies.

vishy71

Full Member level 2
Joined
Dec 16, 2010
Messages
126
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,298
Location
Iran
Activity points
2,296
Hi
is there any body say instructions of GLCD intizaling?
for example I know if I send 0x01 to Character LCD (RS=0,EN=1) then the display have been cleared!
but what instructions in GLCD I must use?thanks!8)
 

It depends the controller inside your GLCD. KS108 is a commonly using one. Check the datasheet for controller initialization or if you have any driver code for your GLCD in C then just follow the init steps that in the C code. CCS compiler has a driver for KS108 based GLCDs.


Good Luck.
 
Reactions: vishy71

    vishy71

    Points: 2
    Helpful Answer Positive Rating
Hi,

You refer to a GLCD, that is a totally different display to a LCD.

Is this what you are trying to do ?
 

Attachments

  • ScreenShot001.jpg
    94.8 KB · Views: 101
Last edited:
Reactions: vishy71

    vishy71

    Points: 2
    Helpful Answer Positive Rating
Hi,

Strange the pic ref not displaying in the last post until logged in ?
 

Attachments

  • ScreenShot001.jpg
    94.8 KB · Views: 113
Reactions: vishy71

    vishy71

    Points: 2
    Helpful Answer Positive Rating
Hi
wp100 thanks a lot
but I wanna instruction set to gLCD_init in assembly!
for example you send 0x30 to LCD for 8bit lcd! or send 0x01 to clear display! but what instruction must be send to glcd?
thanks
 

Hi
wp100 thanks a lot
but I wanna instruction set to gLCD_init in assembly!
for example you send 0x30 to LCD for 8bit lcd! or send 0x01 to clear display! but what instruction must be send to glcd?
thanks

Hi,

As anandpv2009 said you have to specify the glcd module type and importantly the internal controller chip the GLCD is using - they all have slight differences.

Again the programming of a GLCD is much more complicated than a LCD.

You can get some idea of the code needed from this project.
Glcds with Pic 18F Assembler
 
Reactions: vishy71

    vishy71

    Points: 2
    Helpful Answer Positive Rating
thanks a lot wp100! I can use 8 bit LCD! but I can't understand 4bit LCD!!!!!!!!!!!!!
I use 74164 for using LCD! and now I wanna try GLCD.say again: thanks a lot!you are the best friend for me!
 

Hi,

Right understand what you are doing - thought you were either using that Proteus example or real hardware to do the tests.

So you are experimenting with the LCD using the 74164; so loading the 8 data bits into the 74164 and manually switching the control lines - yes ?

To use 4 bit mode, the LCD has to be initialised and instructed to use 4 bit mode and which 4 data lines to receive the data on.

What happens is the data bytes lower nibble (bits 0-3 ) are sent out to the lcds data lines 4 -7.
Then the high nibble ( bits 4-7) are sent out on the same lcd data lines 4-7.
The purpose of doing this is that it frees up 4 i/o ports on the micro.

If you have sucessfully got the 8 bit version working and understand it ok, then perhaps it might be best to do the 4 bit method on the PIC / LCD as it will be rather a long job on your 74164 test rig.

As for the GLCD - forget that for now - its nothing like the standard lcd and is not a beginners project.
 
Reactions: vishy71

    vishy71

    Points: 2
    Helpful Answer Positive Rating
Hi
thanks wp100.you right!4 bit LCD is faster than 74164! but with 74164 we can save 2 I/O pins!
and it's useful for me and my projects!
but I will try 4 bit LCD! here is the qustion!please answer!
for example we use portb to 4 bit LCD! RB4..RB7! and RB0,RB1 are EN,RS pins.at frist we send 0...3 bits on register f to port B!right?
ok! but 4...7 bits on register f are 0 so RB0...RB3 will be 0 and this is my problem!because I wanna use RB2,RB3 for other instructions!
I feel you can't understatnd!sorry!!!!

about GLCD! you right!may be I must be profesional in assembly routins and instructions then use GLCD!
thanks for every thing.

oh! another question!
you now the ascii of 'A' is 65! I wanna show 65 on LCD not 'a'! but I don't know how to do it!
thanks
 

Hi
oh! another question!
you now the ascii of 'A' is 65! I wanna show 65 on LCD not 'a'! but I don't know how to do it!
thanks
What you need to do is to write a routine that converts an 8 bit number (ie 65 - A) to its decimal equivalent and then send the correct ascii code for each digit of the conversion to the display.
 
Reactions: vishy71

    vishy71

    Points: 2
    Helpful Answer Positive Rating
frist we send 0...3 bits on register f to port B!right?
ok! but 4...7 bits on register f are 0 so RB0...RB3 will be 0 and this is my problem!because I wanna use RB2,RB3 for other instructions!

No, the 4 bit data is sent to lcd pins 14-11 db 7-4 only.

Say you want to send byte 1011 0110
You first load your 164 with data b'0110 0000' only bits 7 -4 are connected / sent to lcd db7-4

You then load in the second 'nibble' 164 b' 1011 0000' only bits 7-4 are sent to the same lcd db 7 - 4

So Pic Pins RB2 and RB3 as still unused - however when running you lcd on an actual Pic in 4 Bit mode you will find it is difficult to use those pins unless you are very carefull with your coding.

It is much easier and simpler to use a chip with more pins ! - basically use anything other than the obselete 16F84A chip.
The 16F876A or 877A should be readily available at lo cost, but also loook for other 16F chips that have an inbuilt oscillator - save using crystals .


you now the ascii of 'A' is 65! I wanna show 65 on LCD not 'a'! but I don't know how to do it!

Well A is 65 DECIMAL and that is 41 HEX on the Pic so you really want to convert it to two ASCII characters 6 and 5.
You need a code converter from here -PIC Microcontoller Radix Math Method Binary to ASCII, 8 bit to 3 digits
This routine will take your original hex number ( 0-255 decimal) and covert it up to three ascii display numbers
 
Reactions: vishy71

    vishy71

    Points: 2
    Helpful Answer Positive Rating
thanks wp100
I understand your mean.I will save this page to use 4 bit LCD!
for 74164 I don't use crystal!CLK have send from RB1.
4bit is faster than it but about less than 50us(crystal 4mhz)
thanks for your help!here I can't find any body that help me as good as you!I think you are the biggest man in electronics!
I wish the best thing for you
 

Code:
Hundreds	equ 0x20
Tens		equ 0x21
units		equ 0x22
working		equ 0x23
numtocon	equ 0x24
count		equ 0x25
   	
	ORG 0x0000 ;reset vector 

	goto start


Start
		clrf	Hundreds
		clrf	Tens
		clrf	Units

		movlw	d'159'	  ;load w with the number to covert
		movwf	numtocon  ;save the number in variable	

		movlw	d'8'
		movwf	count		
ShiftLoop
;test lowerbcd		
		movfw	units
		andlw	b'1111'
		movwf	working
		movlw	d'5'
		subwf	working,0
		SKPC		
		Goto	TestUpperNibble
		movlw	d'3'
		addwf	units
TestUpperNibble		
		movfw	units
		andlw	b'11110000'
		movwf	working
		movlw	H'50'
		subwf	working,0
		SKPC		
		goto	Shiftbit
		movlw	H'30'
		addwf	units
shiftbit
		rlf	units,1
		rlf	hundreds,1
		SKPNC
		bsf	hundreds,0
		rlf	numtocon,1
		SKPNC	
		bsf	Units,0
		decfsz	count
		goto	ShiftLoop
		movfw	Units
		Movwf	Tens
		swapf	Tens,1
		movlw	b'1111'
		andwf	Units,1
		andwf	Tens,1
		movlw	d'48'
		addwf	Hundreds
		addwf	Tens
		addwf	Units


;your code here to display variables on LCD

If it is of any help the above code will take a 8 bit number and convert into 3 variables Hundreds, Tens & Units. These contain the code for the ascii character to be displayed once converted. The code uses the double -dabble algorithm to convert the 8 bit number.
 
Reactions: vishy71

    vishy71

    Points: 2
    Helpful Answer Positive Rating
oh thanks but these codes dosent work!can you please give me a simple?
for 8bit LCD!
 

Hi

Attached is some code using the above code and an 8 bit display, I have only run it in the PIC simulator and it outputs the correct number. Give it a try and let me know if you still have problems.

the ports details are in the code and may need to be changed depending on your LCD setup.
 

Attachments

  • jdl_lcd.zip
    1.6 KB · Views: 81
Reactions: vishy71

    vishy71

    Points: 2
    Helpful Answer Positive Rating
Hi
thanks!it's working!
can you say what's goto $ please?
 

It causes the program to keep looping, the same as

Code:
loop
        goto   loop

end
 
Reactions: vishy71

    vishy71

    Points: 2
    Helpful Answer Positive Rating
Thanks very much!
your code must be change by me!because of my porpuse!
thanks very very very very much!
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…