Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] LCD - CGRAM and LCD graphic datasheet

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
I wanna show some characters which I have create them with LCDCC.now I wanna show them on LCD(character LCD).
I know I must save codes in CGRAM(yes?) but how and then how I can show them on LCD?
I can show them on LCD with basic and proton but I wanna do this with assembly.I can use LCD with assembly but I don't know how can I use from
LCD's CGRAM.

my another question is about graphic LCD.is there any body that can give me datasheet for this LCD.I have some but they are not complate.

thanks thanks and thans:-D
 

What is the controller chipset of your LCD?

The following is a short LCD assembly program which demonstrates the use of CGRAM for storing custom characters:

Code:
 title  "Animate - Draw the 'Walking Man' on an LCD"
;
;  This Code Uses the two wire LCD interface to draw a
;   walking man using User Defined Characters.
;
;
;  Hardware Notes:
;   Reset is tied directly to Vcc and PWRT is Enabled.
;   The PIC is a 16C84 Running at 4 MHz.
;   PortA.0 is the Data Bit
;   PortA.1 is the Clock Bit
;
;  Shift Data:
;  Bit 1 - Always High (Gate for "E")
;  Bit 2 - RS Bit
;  Bit 3 - LCD D4
;  Bit 4 - LCD D5
;  Bit 5 - LCD D6
;  Bit 6 - LCD D7
;
;  Myke Predko
;  99.04.28
;
  LIST P=16C84, R=DEC          ;  16C84 Runs at 4 MHz
  errorlevel 0,-305
  INCLUDE "p16c84.inc"


;  Register Usage
 CBLOCK 0x00C                   ;  Start Registers at End of the Values
Dlay                            ;  8 Bit Delay Variable
Temp                            ;  Temporary Value Used When Sending Out Data
NOTemp                          ;  Temporary Value to "NybbleOutput"
Count                           ;  Character Counter for Output
 ENDC


;  Define Inforation
#DEFINE Data PORTA,0
#DEFINE Clock PORTA, 1


;  Macros
ClockStrobe MACRO               ;  Strobe the Data Bit
  bsf    Clock
  bcf    Clock
 ENDM

EStrobe MACRO                   ;  Strobe the "E" Bit
  bsf    Data
  bcf    Data
 ENDM


 PAGE
 __CONFIG _CP_OFF & _XT_OSC & _PWRTE_ON  & _WDT_OFF
                                ;  Note that the WatchDog Timer is OFF
;  Demo Code, Loop Forever Toggling PA0 (Flashing the LED)

  org    0

  clrf   PORTA

  movlw  0x01C                  ;  Enable PA0 & PA1 for Output
  bsf    STATUS, RP0
  movwf  TRISA ^ 0x080
  bcf    STATUS, RP0

  call   Dlay5                  ;  Wait 20 msecs before Reset
  call   Dlay5
  call   Dlay5
  call   Dlay5

  bcf    STATUS, C              ;  Clear Carry (Instruction Out)
  movlw  0x03                   ;  Reset Command
  call   NybbleOut2             ;  Send the Nybble
  call   Dlay5                  ;  Wait 5 msecs before Sending Again

  EStrobe
  call   Dlay160                ;  Wait 160 usecs before Sending the Third Time

  EStrobe
  call   Dlay160                ;  Wait 160 usecs before Sending the Third Time

  bcf    STATUS, C
  movlw  0x02                   ;  Set 4 Bit Mode
  call   NybbleOut2
  call   Dlay160

  movlw  0x028                  ;  Note that it is a 2 Line Display
  call   SendINS

  movlw  0x008                  ;  Turn off the Display
  call   SendINS

  movlw  0x001                  ;  Clear the Display RAM
  call   SendINS
  call   Dlay5                  ;  Note, Can take up to 4.1 msecs

  movlw  0x006                  ;  Enable Cursor Move Direction
  call   SendINS

  movlw  0x00C                  ;  Turn the LCD Back On
  call   SendINS


  movlw  0x040                  ;  Put the Cursor to the Start of CGRAM
  call   SendINS

  movlw  0x030                  ;  Send 6 Characters of 8 Bytes
  movwf  Count                  ;  Output the User Characters
  clrf   FSR
CharLoop
  movf   FSR, w                 ;  Get the Offset to Output
  incf   FSR
  call   ManChar
  call   SendCHAR               ;  Output the ASCII Character
  decfsz Count                  ;  Do 48x
   goto  CharLoop

  movlw  0x080                  ;  Move the Cursor Back into LCD Memory Space
  call   SendINS

  movlw  0                      ;  Display the Man
  call   SendCHAR

  movlw	 'A'			;  Put in "A" for Comparison
  call	 SendCHAR

Loop                            ;  Loop Forever when Done

  call	 LongDlay		;  Delay Between Movements
  movlw	 0x080			;  Send Char "1"
  call	 SendINS	
  movlw	 1
  call	 SendCHAR

  call	 LongDlay
  movlw	 0x080			;  Send Char "2"
  call	 SendINS	
  movlw	 2
  call	 SendCHAR

  call	 LongDlay
  movlw	 0x080			;  Send Char "3"
  call	 SendINS	
  movlw	 3
  call	 SendCHAR

  call	 LongDlay
  movlw	 0x080			;  Send Char "4"
  call	 SendINS	
  movlw	 4
  call	 SendCHAR

  call	 LongDlay
  movlw	 0x080			;  Send Char "5"
  call	 SendINS	
  movlw	 5
  call	 SendCHAR

  goto   Loop


;  Subroutines
ManChar                         ;  User Characters to Display
  addwf  PCL                    ;  Output the Characters
  retlw  0x00E                  ;  Character 0 - Byte 0
  retlw  0x00E
  retlw  0x004
  retlw  0x004
  retlw  0x004
  retlw  0x004
  retlw  0x00C
  retlw  0x000
  retlw  0x00E                  ;  Character 1 - Byte 0
  retlw  0x00E
  retlw  0x004
  retlw  0x004
  retlw  0x00C
  retlw  0x004
  retlw  0x00C
  retlw  0x000
  retlw  0x00E                  ;  Character 2 - Byte 0
  retlw  0x00E
  retlw  0x004
  retlw  0x004
  retlw  0x00A
  retlw  0x01A
  retlw  0x006
  retlw  0x000
  retlw  0x00E                  ;  Character 3 - Byte 0
  retlw  0x00E
  retlw  0x004
  retlw  0x004
  retlw  0x006
  retlw  0x009
  retlw  0x019
  retlw  0x000
  retlw  0x00E                  ;  Character 4 - Byte 0
  retlw  0x00E
  retlw  0x004
  retlw  0x004
  retlw  0x007
  retlw  0x009
  retlw  0x018
  retlw  0x000
  retlw  0x00E                  ;  Character 5 - Byte 0
  retlw  0x00E
  retlw  0x004
  retlw  0x004
  retlw  0x00C
  retlw  0x006
  retlw  0x00C
  retlw	 0x000			;  Bottom Character

  retlw  0x01F			;  #### - Note Full Line for Bottom Character
				;  #### - To Show, Comment out the Previous Line


SendCHAR                        ;  Send the Character to the LCD
  movwf  Temp                   ;  Save the Temporary Value

  swapf  Temp, w                ;  Send the High Nybble
  bsf    STATUS, C              ;  RS = 1
  call   NybbleOut2

  movf   Temp, w                ;  Send the Low Nybble
  bsf    STATUS, C
  call   NybbleOut2

  return

SendINS                         ;  Send the Instruction to the LCD
  movwf  Temp                   ;  Save the Temporary Value

  swapf  Temp, w                ;  Send the High Nybble
  bcf    STATUS, C              ;  RS = 0
  call   NybbleOut2

  movf   Temp, w                ;  Send the Low Nybble
  bcf    STATUS, C
  call   NybbleOut2

  return

NybbleOut2                      ;  Send a Nybble to the LCD

  movwf  NOTemp                 ;  Save the Nybble to Shift Out
  swapf  NOTemp                 ;  Setup to Output to the High Part of the Byte

  movlw  6                      ;  Clear the Shift Register
  movwf  Dlay
NO2Loop1
  ClockStrobe
  decfsz Dlay
   goto  NO2Loop1

  movlw  5                      ;  Now, Shift out the Data with the "RS" Bit
  movwf  Dlay

  bsf    Data                   ;  Put out the Gate Bit
  ClockStrobe
NO2Loop2
  bcf    Data                   ;  Clear the Data Bit (which is the Clock)
  btfsc  STATUS, C              ;  If the Bit to be output is a "1", Shift it Out
   bsf   Data
  ClockStrobe
  rlf    NOTemp                 ;  Shift the Next Bit into the Carry Flag
  decfsz Dlay
   goto  NO2Loop2

  EStrobe                       ;  Strobe out the LCD Data

  return


LongDlay			;  Delay 200 msecs

  movlw	 40
  movwf	 Count
LDLoop
  call	 Dlay5
  decfsz Count
   goto	 LDLoop

  return

Dlay160                         ;  Delay 160 usecs

  movlw  256 - ( 160 / 4 )      ;  Loop Until Carry Set
  addlw  1
  btfss  STATUS, C
   goto  $-2

  return

Dlay5                           ;  Delay 5 msecs

  movlw  4                      ;  Set up the Delay
  movwf  Dlay
  movlw  256 - 0x0E8
  addlw  1
  btfsc  STATUS, Z
   decfsz Dlay
    goto $-3

  return


  end


The code's project page:



Two very informative pages concerning the initialization and addressing schemes of the Hitachi HD44780 and compatible chipsets:





CGRAM Tutorials:

Printing Custom Characters on a Character LCD



Hope the info helps in your endeavors,

BigDog
 
HI
thanks for youre good helps.
LCD controller chipset is TS12864.thanks
 

The TS12864 is a GLCD and the display's controller is not compatible with the Hitachi HD44780 chipset.

**broken link removed**

The GLCD controller is compatible with the popular KS0108 chipset.

A project utilizing the KS0108 with routines in PIC assembly:



Some interesting utilities for the KS0108:





GLUtil along with GLSDEMO make it very easy to use a 128x64 KS0108 based graphic LCD display to draw circles, charts, rectangles etc.

GLUtil

Handy Font Bitmap Converter:

GLCD Font Creator 2

There does not seem to be an abundance of assembly routines for the KS0108, however I will keep my eye out for any additional examples.

BigDog
 
Hi
thanks for youre help.
I have some questions here about GLCD and LCD.
at frist can you give me an example of GLCD with assembly?
if youre answer is no please say to me than what is RST bit on GLCD?and what I must do with that.
I must send some commands to intizaling GLCD or just I must display on it and then set Y,X and then data?(I know how can send data but I don't know what is Z address!!!)

about LCD(CGRAM):
thanks for youre good example but I can't understand some part of it
I can intizaling LCD in assembly and send commands and characters to it.for save data on CGRAM I must send CGRAM address:
movlw 0x40
call LCD_CMD ;LCD_CMD --> send lcd commands

well,now I wanna send my character to save it in CGRAM and then show it on LCD.I understand that if I use this code I can show my character on LCD which is saved in
CGRAM:

movlw 1
call LCD_CHR ;LCD_CHR --> send character to lcd

here,what is 1 ?it was in youre code.thanks
 

Hi

You might find this code and demo of interest..
 

Attachments

  • glcd.zip
    115.3 KB · Views: 127
at frist can you give me an example of GLCD with assembly?
if youre answer is no please say to me than what is RST bit on GLCD?and what I must do with that.
I must send some commands to intizaling GLCD or just I must display on it and then set Y,X and then data?(I know how can send data but I don't know what is Z address!!!)

You'll need to initialize your KS0108 Compatible GLCD.

I have posted both a KS0108 driver and demo program using the driver. The "initGRLCD" code section in the driver contains the initialization routine for the GLCD.

KS0108 Driver
Code:
;------------------------------------------------------
; Breshenham's line draw for KS0108 based 128x64 LCDs
; (C) Peter Onion 2005
; Use at your own risk !
;------------------------------------------------------ 
	Processor       16F877	
        Radix   DEC
        EXPAND

        include         "p16f877.inc"

	
brWleF macro	F,dst
	subwf	F,W
	skpz
	skpc
	goto	$+2		; YUK!
	goto	dst
	endm



#define CNTLPORT PORTB
#define CNTLTRIS TRISB
#define DATAPORT PORTD
#define	DATATRIS TRISD
	;; For 20Mhz use 12.     Can be reduced at lower clock speeds
	;; For 12.288Mhz use 5   Select on test !
#define DELAY 12
	
		
	;; Definitions for bits in CNTLPORT 
	
#define CSABIT 0
#define CSBBIT 1
#define DIBIT 2
#define RWBIT  3
#define EBIT   4
#define RESETBIT 5

	;; Definitions for bits in the control word
#define	INCX 0
#define INCY 1
#define DECY 2
#define SETCS 3
#define SETPAGE 4
#define FLUSH 5
#define DONE 6
#define	SAVE 7
	

	;; Macros for bit twiddling on the control interface
	
WSTROBE	MACRO
	movlw	12
	movwf	scratch3
	decfsz	scratch3,F
	goto	$-1

	bsf	CNTLPORT,EBIT		; Rising edge 
IF 0
	movlw	1
	movwf	scratch3
	decfsz	scratch3,F
	goto	$-1
ENDIF
	bcf	CNTLPORT,EBIT		; Falling edge
					;  strobes data
	ENDM 	

RSTROBE	MACRO
	movlw	12
	movwf	scratch3
	decfsz	scratch3,F
	goto	$-1
	bsf	CNTLPORT,EBIT		; Rising edge 
If 0
	movlw	1
	movwf	scratch3
	decfsz	scratch3,F
	goto	$-1
ENDIF
	movf	DATAPORT,W
	bcf	CNTLPORT,EBIT		; Falling edge

	ENDM 	

	
	
SETELOW	MACRO
	bcf	CNTLPORT,EBIT
	ENDM
	
		
SETW	MACRO
	bcf	CNTLPORT,RWBIT
	ENDM
	
	
SETR	MACRO
	bsf	CNTLPORT,RWBIT
	ENDM
	
	
SETD	MACRO
	bsf	CNTLPORT,DIBIT
	ENDM
	
SETI	MACRO
	bcf	CNTLPORT,DIBIT
	ENDM
	
	
RESETH	MACRO
	bsf	CNTLPORT,RESETBIT
	ENDM
	
RESETL	MACRO
	bcf	CNTLPORT,RESETBIT
	ENDM
	
		
SELA	MACRO
	bcf	CNTLPORT,CSABIT
	bsf	CNTLPORT,CSBBIT
	ENDM
	
SELB	MACRO
	bsf	CNTLPORT,CSABIT
	bcf	CNTLPORT,CSBBIT
	ENDM

SELBOTH	MACRO
	bcf	CNTLPORT,CSABIT
	bcf	CNTLPORT,CSBBIT
	ENDM
	
SELNONE	MACRO
	bsf	CNTLPORT,CSABIT
	bsf	CNTLPORT,CSBBIT
	ENDM
		
	
DATA1	UDATA	
x1	res 1			; Start ppint
y1	res 1
x2	res 1			; End point
y2	res 1
dx	res 1
dy	res 1
control	res 1
length	res 1
dec	res 1
	
d	res 1
aa	res 1
bb	res 1
temp	res 1
cachestart	res 1
currentbyte	res 1
cachelength	res 1 


count	res 1
pageNo	res 1
AA	res 1
BB	res 1
xpos	res 1
ypos	res 1
ctlCode	res 1			; bits
temp1	res 1
pixelbit res 1
		;; delay	res 1


	;; A cache that hold one "page" of pixels 
CacheRam	UDATA	
cache	res 64


	;; Scratch registers in shared bank. DO not assume they
	;; are preserved by any subroutines.
	extern scratch1,scratch2,scratch3,scratch4
	
	GLOBAL x1,y1,x2,y2

line	CODE


	;; Clear the LCD
	
clearLCD:

	clrf	scratch1	;  set page number to zero

	banksel	CNTLPORT
	SELBOTH			;  Write to both halves together
	SETW
	
	
clrloop:
	SETI
	movf	scratch1,W
	addlw	0xB8		;  set page number
	movwf	DATAPORT

	WSTROBE

	movlw	0x40		; set X address to 0
	movwf	DATAPORT

	WSTROBE
		
	movlw	64
	movwf	scratch2	; counter

	SETW
	SETD

	movlw	0x0		;  clear to OFF
	movwf	DATAPORT
clrloop1:
	
	WSTROBE
	decfsz	scratch2,F
	goto	clrloop1

	incf	scratch1,F	;  loop until page == 8
	btfss	scratch1,3
	goto	clrloop

	SETI
	SELNONE
	
	return




	;; Write used part of cache back to the LCD
flushcache:
	
	BANKSEL	CNTLPORT
	BANKISEL	cache	;  set up for indirect cahce access
	
	movlw	cache
	movwf	FSR
	
	banksel	cachelength
	movf	cachelength,W
	movwf	scratch1	;  hold the counter

	banksel	CNTLPORT
	SETI
	SETW
	
	BANKSEL	DATATRIS	;  reset portd to output
	movlw	0x00
	movwf	DATATRIS

	
	


	banksel	cachestart	
	movlw	0x40		; set y address to first used
	addwf	cachestart,W	; byte in the cache
	banksel DATAPORT
	movwf	DATAPORT

	WSTROBE
	
	SETD			; data
	SETW			; write

	

	
flushloop:	
	
	
	movlw	DELAY
	movwf	scratch2
	decfsz	scratch2,F
	goto	$-1
	

	movf	INDF,W		;  read from the cache

	bsf	CNTLPORT,EBIT	; Rising edge
	movwf	DATAPORT
	bcf	CNTLPORT,EBIT	; Falling edge
				; strobes data


	
	incf	FSR,F
	decfsz	scratch1,F
	goto	flushloop
	
	return
	

linedraw:
	banksel	ctlCode

	clrf	ctlCode
	clrf	control

	comf	y1,F		; Make y = 0 the bottom rather 
	comf	y2,F		; than the top 

		
	movf	x1,W		; check moving left to right 
	subwf	x2,W		; and workout dx
	skpnc	
	goto	ld1
	sublw	0

	movwf	temp

	movf	x1,W		; swap end points so left to right
	movwf	temp1
	movf	x2,W
	movwf	x1
	movf	temp1,W
	movwf	x2

	movf	y1,W
	movwf	temp1
	movf	y2,W
	movwf	y1
	movf	temp1,W
	movwf	y2

	movf	temp,W

ld1
	movwf	dx		; dx = |x1 - x2|


	movf	y1,W
	subwf	y2,W
	skpnc	
	goto	ld2
	sublw	0	
	bsf	ctlCode,0	;  Going Up or Down
ld2
	movwf	dy		; dy = |y1 - y2|


	movf	dy,W		; test if steep or shallow line
	subwf	dx,W
	skpnc	
	goto	ld3

	movf	dx,W		; swap to make shallow
	movwf	temp
	movf	dy,W
	movwf	dx
	movf	temp,W
	movwf	dy
	
		
	bsf	ctlCode,1	;  set "steep flag"
ld3
	clrf	dec
	bcf	STATUS,C
	rrf	dx,W		; W = dx >> 1
	rlf	dec,F		; dec = dx & 1
	subwf	dy,W		; W = dy - (dx >> 1)
	movwf	d		; d = W

	movf	dx,W
	subwf	dy,W
	movwf	AA		; A = dy -dx

	movf	dy,W
	movwf	BB		;  B = dy

	movf	AA,W
	subwf	dec,F		;  dec -= A
	subwf	d,F		;  d   -= A

	movf	dx,W
	sublw	0
	movwf	AA		; A = -dx

	
	movf	x1,W		; set up for looping
	movwf	xpos
	movf	y1,W
	movwf	ypos
	movf	dx,W
	movwf	length
	
	clrf	control		; set the inital actions to take
	bsf	control,SETCS	; setup the Chip Selects
	bsf	control,SETPAGE	; set the page number
	bsf	control,SAVE	; 
	
	movf	ypos,W		; Set correct bit in pixelbit  
	andlw	0x7		; for the y position
	addlw	0x1
	movwf	temp
	
	clrf	pixelbit
	bsf	STATUS,C
setyloop:	
	rlf	pixelbit,F
	decfsz	temp,F
	goto	setyloop

	;; loop back here if step over to right hand side
setcs:	banksel	control
	btfss	control,SETCS
	goto	pageSet

	bcf	control,SETCS
	btfsc	xpos,6		; set correct Chip select
	goto	setcs1

	banksel	CNTLPORT
	SELA
	goto	pageSet

setcs1:	banksel	CNTLPORT
	SELB

pageSet:banksel	control
	btfss	control,SETPAGE
	goto	initcache


	
	movf	ypos,W		; set y page address in controler
	movwf	pageNo
	rrf	pageNo,F
	rrf	pageNo,F
	rrf	pageNo,F
	movlw	0x7
	andwf	pageNo,F
	movf	pageNo,W	
	addlw	0xB8
	banksel	DATAPORT
	movwf	DATAPORT
	
	SETI
	SETW
	
	WSTROBE

initcache:	
	bankisel cache
	banksel	cachelength
	
	clrf	cachelength	; initialise the cache
	movlw	cache
	movwf	FSR
	
	movf	xpos,W
	andlw	0x3F
	movwf	cachestart

	movlw	0x40		; set x address 
	addwf	cachestart,W
	banksel	DATAPORT	
	movwf	DATAPORT

	WSTROBE

	clrf	DATAPORT		;  prepare to read from controler
	BANKSEL	DATATRIS
	movlw	0xFF
	movwf	DATATRIS
	BANKSEL DATAPORT

	SETD			; data
	SETR			; read

	RSTROBE			;  Dummy read

readbyte:
	banksel	control
	btfss	control,SAVE
	goto	dontread

	banksel	DATAPORT
	RSTROBE			;  read the byte
	banksel	currentbyte
	movwf	currentbyte

dontread:
	movf	pixelbit,W	;  set the bit
	iorwf	currentbyte,F

	btfsc	control,DONE	; test end flag
	goto	alldone

	clrf	control		;  reset all the flags

	;; DANGER DANGER.....  Check for page boundry !!
here:	banksel	ctlCode
	movlw	high $	
	movwf	PCLATH		; page 
	movf	ctlCode,W
	andlw	0x7
	
	addwf	PCL,F
	goto	code0
	goto	code1
	goto	code2
	goto	code3
	
code0:	
	movf	d,W
	brWleF	dec,code01

	movf	AA,W
	addwf	d,F

	bsf	control,INCY
code01:	movf	BB,W
	addwf	d,F
	bsf	control,INCX
	goto	common


code1:	movf	d,W
	brWleF	dec,code11

	movf	AA,W
	addwf	d,F
	
	bsf	control,DECY
code11:	movf	BB,W
	addwf	d,F
	bsf	control,INCX
	goto	common

	
code2:	
	movf	d,W
	brWleF	dec,code21

	movf	AA,W
	addwf	d,F
	
	bsf	control,INCX
code21:	movf	BB,W
	addwf	d,F
	bsf	control,INCY
	goto	common

	
code3:	movf	d,W
	brWleF	dec,code31

	movf	AA,W
	addwf	d,F

	bsf	control,INCX
code31:	movf	BB,W
	addwf	d,F
	bsf	control,DECY
	goto	common
	
	

common:	
	decf	length,F
	skpnz
	bsf	control,DONE

	btfss	control,INCX	;  did we move to the right ?
	goto	checkINCY

					
	bsf	control,SAVE
	movf	xpos,W		; increment X
	incf	xpos,F
	xorwf	xpos,W
	movwf	temp1
	btfss	temp1,6		; test for left-to-right change
	goto	checkINCY
	
	bsf	control,FLUSH	; set flush
	bsf	control,SETCS	; set setCS
	bsf	control,SETPAGE
checkINCY:	
	
	btfss	control,INCY	;  did we move down ?
	goto	checkDECY
	
	incf	ypos,F
	bcf	STATUS,C
	rlf	pixelbit,F	; move bit
	btfss	STATUS,C	; if carry set, we ned to move to next bank
	goto	checksave

	rlf	pixelbit,F	
	bsf	control,SETPAGE
	bsf	control,SAVE
	bsf	control,FLUSH
	goto	checksave

checkDECY:
	btfss	control,DECY	;  did we move up ?
	goto	checksave
	
	decf	ypos,F
	bcf	STATUS,C
	rrf	pixelbit,F
	btfss	STATUS,C
	goto	checksave

	rrf	pixelbit,F
	bsf	control,SETPAGE
	bsf	control,SAVE
	bsf	control,FLUSH
	goto	checksave	

checksave:			; do we need to save byte to cache ?
	btfss	control,SAVE
	goto	checkflush
	
	movf	currentbyte,W	;  write byte to cache
	movwf	INDF
	incf	FSR,F
	incf	cachelength,F
	
checkflush:			; do we need to flush the cache ?
	btfss	control,FLUSH
	goto	readbyte

	call	flushcache

	goto	setcs


alldone:			;  write endpoint and flush cache
	movf	currentbyte,W
	movwf	INDF
	incf	FSR,F
	incf	cachelength,F
	
	call	flushcache
	return

[COLOR="#FF8C00"]initGRLCD:	

	banksel	DATATRIS
	clrf	DATATRIS
	clrf	CNTLTRIS
	
	banksel	DATAPORT	
	
	RESETL			; 5      XX0XXXXX
		
	SELBOTH			; 0 1    XX0XXX00
		

	SETELOW			; 4      XX00XX00
	SETI			; 2      XX00X000
	SETW			; 3      XX000000
	RESETH			;        XX100000
	
	movlw	0x3F		; Display ON
	movwf	DATAPORT
	movlw	9
	movwf	scratch1
	decfsz	scratch1,F
	goto	$-1

	WSTROBE	
	
	movlw	0x40		; set x address to 0
	movwf	DATAPORT
	WSTROBE
	
	movlw	0xBF		;  set page to 0 
	movwf	DATAPORT
	WSTROBE

	movlw	0xC0		;  set display start line to 0
	movwf	DATAPORT
	WSTROBE
	return[/COLOR]

	
		
	GLOBAL	linedraw,initGRLCD,clearLCD
	
	END

Demo Program
Code:
	; Created by LCDtrigtable360.c

 	Processor       16F877
	
trig	CODE
	GLOBAL xtable,ytable
xtable:
	DW 0x40
	DW 0x40
	DW 0x41
	DW 0x42
	DW 0x43
	DW 0x43
	DW 0x44
	DW 0x45
	DW 0x46
	DW 0x47
	DW 0x47
	DW 0x48
	DW 0x49
	DW 0x4A
	DW 0x4B
	DW 0x4B
	DW 0x4C
	DW 0x4D
	DW 0x4E
	DW 0x4E
	DW 0x4F
	DW 0x50
	DW 0x51
	DW 0x51
	DW 0x52
	DW 0x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	DW 0x3C
	DW 0x3C
	DW 0x3D
	DW 0x3D
	DW 0x3D
	DW 0x3D
	DW 0x3D
	DW 0x3D
	DW 0x3E
	DW 0x3E
	DW 0x3E
	DW 0x3E
	DW 0x3E
	DW 0x3E
	DW 0x3E
	DW 0x3E
	DW 0x3E
	DW 0x3E
	DW 0x3E
	DW 0x3E
	DW 0x3E
	DW 0x3E
	DW 0x3F

 	END

+
shares this code:

    	
    	
    	Processor       16F877	
    	
            Radix   DEC
            EXPAND

            include         "p16f877.inc"

    	
    	
    	
    	EXTERN initGRLCD,clearLCD,linedraw
    	EXTERN x1,y1,x2,y2
    	EXTERN xtable,ytable
    	

    shared	UDATA_SHR
    FSR_TEMP	res 1
    W_TEMP		res 1
    STATUS_TEMP	res 1
    scratch1	res 1		; work space
    scratch2	res 1
    scratch3	res 1
    scratch4	res 1
    scratch5	res 1

    	GLOBAL	scratch1,scratch2,scratch3



    	UDATA

    count	res 1
    xx	res 1
    yy	res 1
    angleL	res 1
    angleH	res 1

    	
    	
    _ResetVector    set     0x00

    	ORG	_ResetVector

    	movlw	high Start
    	movwf	PCLATH
    	goto	Start


    	
    application CODE


    Start:

    		
    	pagesel	initGRLCD
    	call	initGRLCD

    	pagesel	clearLCD
    	call	clearLCD

    	
    	
    	movlw	0x0
    	movwf	xx
    	movlw	0x3F
    	movwf	yy
    	

    	movlw	21
    	movwf	count

    loop:	
    	movf	xx,W
    	movwf	scratch1
    	movf	yy,W
    	movwf	scratch2	
    	
    	
    	banksel	x1
    	movlw	0
    	movwf	x1
    	movf	scratch2,W
    	movwf	y1

    	movf	scratch1,W
    	movwf	x2
    	movlw	0x0
    	movwf	y2

    	pagesel	linedraw
    	call	linedraw

    	banksel	xx
    	movlw	6
    	addwf	xx,F
    	movlw	3
    	subwf	yy,F

    	clrf	scratch1
    	clrf	scratch2
    	movlw	0x1
    	movwf	scratch3

    	decfsz	scratch1,F
    	goto	$-1

    	decfsz	scratch2,F
    	goto	$-3

    	decfsz	scratch3,F
    	goto	$-5
    	

    	
    	decfsz	count,F
    	goto	loop

    	pagesel	clearLCD
    	call	clearLCD
    loop3:	
    	banksel	angleL
    	clrf	angleL
    	clrf	angleH
    	movlw	60
    	movwf	count
    loop2:		
    	pagesel	clearLCD
    	call	clearLCD	
    	pagesel $

    	banksel	x1
    	movlw	0x40
    	movwf	x1
    	movlw	0x20
    	movwf	y1
    	
    	call	xsinlookup
    	banksel	x2
    	andlw	0x7F
    	movwf	x2
    	
    	call	ycoslookup
    	banksel	y2
    	andlw	0x3F
    	movwf	y2
    	
    		
    	pagesel	linedraw
    	call	linedraw

    	pagesel $
    		
    	clrf	scratch1
    	clrf	scratch2
    	movlw	0x4
    	movwf	scratch3

    	decfsz	scratch1,F
    	goto	$-1

    	decfsz	scratch2,F
    	goto	$-3

    	decfsz	scratch3,F
    	goto	$-5

    	
    	banksel	angleL
    	movlw	6
    	addwf	angleL,F
    	btfsc	STATUS,C
    	incf	angleH,F

    	decfsz	count,F
    	goto	loop2
    	goto	loop3

    commonlook:	
    	banksel	EEADRH
    	movwf	EEADRH

    	
    	movf	scratch1,W
    	banksel	EEADR
    	movwf	EEADR
    	banksel	EECON1
    	bsf	EECON1 & 0x7F,EEPGD
    	bsf	EECON1 & 0x7F,RD
    	nop
    	nop

    	banksel	EEDATA
    	movf	EEDATA,W
    	banksel	angleL

    	return

    	
    xsinlookup:
    	banksel	angleL
    	movf	angleL,W
    	addlw	low	xtable
    	movwf	scratch1

    	
    	
    	movlw	high	xtable
    	btfsc	STATUS,C
    	addlw	1
    	addwf	angleH,W
    	goto	commonlook

    	
    xcoslookup:	
    	banksel	angleL
    	clrf	scratch2
    	movf	angleL,W
    	addlw	90
    	movwf	scratch1
    	btfsc	STATUS,C
    	incf	scratch2,F
    	
    	addlw	low	xtable
    	movwf	scratch1
    	btfsc	STATUS,C
    	incf	scratch2,F
    	
    	movlw	high	xtable
    	addwf	scratch2,W
    	addwf	angleH,W
    	goto	commonlook

    	
    	
    ysinlookup:
    	banksel	angleL
    	movf	angleL,W
    	addlw	low	ytable
    	movwf	scratch1
    	movlw	high	ytable
    	btfsc	STATUS,C
    	addlw	1
    	addwf	angleH,W
    	goto	commonlook

    ycoslookup	
    	banksel	angleL
    	clrf	scratch2
    	movf	angleL,W
    	addlw	90
    	movwf	scratch1
    	btfsc	STATUS,C
    	incf	scratch2,F
    	
    	addlw	low	ytable
    	movwf	scratch1

    	
    	
    	btfsc	STATUS,C
    	incf	scratch2,F
    	
    	movlw	high	ytable
    	addwf	scratch2,W
    	addwf	angleH,W
    	goto	commonlook
    		


    	


    	END

about LCD(CGRAM):
I can intizaling LCD in assembly and send commands and characters to it.for save data on CGRAM I must send CGRAM address:
movlw 0x40
call LCD_CMD ;LCD_CMD --> send lcd commands

well,now I wanna send my character to save it in CGRAM and then show it on LCD.I understand that if I use this code I can show my character on LCD which is saved in
CGRAM:

movlw 1
call LCD_CHR ;LCD_CHR --> send character to lcd

here,what is 1 ?it was in youre code.thanks

The "1" represent the custom character you stored in the CGRAM, there is storage in the CGRAM for a total of eight custom characters designated by 0x00 to 0x07, so the example above actually represents the second custom character stored in CGRAM. Also it should be noted that after the custom characters are written in CGRAM a 0x80 command must be issued to return address back to the DDRAM where you can issue a data write of 0x00 to 0x07 to display the appropriate custom character.

BigDog
 
Last edited:
  • Like
Reactions: vishy71

    vishy71

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top