HTML      PDF
, , , , msp430, MSP430, Atmel, Maxim, LCD, hd44780, t6963, sed1335, SED1335, mega128, avr, mega128  
  > >

 







- VERSA1

:

VERSA1 HD44780.

, SPI VERSA1.

- HD44780 . FAQ, . Hitachi HD44780, .

-

- , :

  • (DDRAM)
  • (CGROM)
  • (CGRAM)

, .

1 - -.

CGROM -. ASCII . -.

DDRAM , -. DDRAM 80 . 4 20 .

DDRAM . 80 DDRAM, DDRAM . .

2 DDRAM DDRAM 162.

DDRAM -. , .

, 40x2 1-2 3-4 .

CGRAM , , . 8 58 4 510.

CGRAM DDRAM , -. (IR), (DR).

(IR) , -.

(DR) (DDRAM), (CGRAM) .

-

- HD44780 8- 4- D4-D7 . 4 - . 4- 4- ( ). .

- 14 , . - D0-D3 4- . - , 2- , 15 16 .

Pin # Name Function
1 GND Ground
2 +5V Module Supply
3 VC LCD Drive voltage. See the specific LCD datasheet about the voltage to apply to this pin.
4 R/S Register select
0 = Instruction register
1 = Data register
5 R/W Select Read or Write operations
0 = Write
1 = Read
6 E Enable (clock)
7-14 D0 to D7 Data bus
In 4 bits interface mode, Data is transferred via D4-D7. The pins D0-D3 are disabled.
15-16 Backlight Optional backlight pins Often they are placed on the side of the display.

- 5 2 5 .

VC -. , . , VC, 7 +5 , -.

RS - IR DR.

R/W - .

4- 7 - . .

-

4- , IR - Data4 Data7 . .

- . 1 . 37 1,5 . - .

, -. , - .

, R/W 1, RS 0 E. Data 7 E. .

3 , (BF) -.

-

, HD44780.

RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
-

0 0 0 0 0 0 0 0 0 1
,
1,64

0 0 0 0 0 0 0 0 1 -
, . .
1,64

0 0 0 0 0 0 0 1 I/D S 40

-
0 0 0 0 0 0 1 D C B , 40
0 0 0 0 0 1 S/C R/L - -

40
0 0 0 0 1 DL N F - - ,
1.64?
-

0 0 0 1 C5 C4 C3 C2 C1 C0


5-0 -
40
-

0 0 1 D6 D5 D4 D3 D2 D1 D0
D6-D0 -
40

0 1 BF D6 D5 D4 D3 D2 D1 D0
.
D6-D0 -
40

1 0 D7 D6 D5 D4 D3 D2 D1 D0



D7-D0 -

40

1 0 D7 D6 D5 D4 D3 D2 D1 D0
-

D7-D0 -
40

I/D 1/0 /
S 1
S/C 1/0 /
R/L 1/0 /
DL 1/0 8/4
N 1/0 /
F 1/0 510/5x7
BF 1/0 /
- -

-.

- -, 0 4,5 0,1 10 . . - .

4 , - 4- .

-.

-, DDRAM DDRAM.

DDRAM. D0-D7 .

DDRAM ( CGRAM), . -.

LCD CGRAM, 58 510 .

, , . CGRAM , CGRAM.

, CGRAM, CGRAM .

, CGRAM, , 58.

CGRAM
Address
D7 D6 D5 D4 D3 D2 D1 D0
Char x +0 - - - 0 0 0 0 0
Char x +1 - - - 1 0 1 0 1
Char x +2 - - - 0 0 1 0 0
Char x +3 - - - 0 0 1 0 0
Char x +4 - - - 0 0 1 0 0
Char x +5 - - - 1 0 1 0 1
Char x +6 - - - 0 1 1 1 0
Char x +7 - - - 0 1 0 0 0
Char (x+1) +0 Next character mapping follows up to eight 5x8 characters for a total of 64 bytes

CGRAM, - DDRAM.

, , , CGROM. 58 ( 00h 07h).

, CGRAM .

SPI VERSA1

SPI 8 -. 74HC595 .

VERSA1 - 5. 74HC595 - BF. , -.

- - D7-D4 BF. 4,7 .

LCDSP11.asm , BF SPI .

Data7. - BF, SDI. SDI, SPI CS1 SPITX. .

SDI SPIRX.

, SDI, BF / . - open-loop BF , , .

, open-loop . , , -, , -, .

SPI -.

74HC595 SPI VERSA1 5. SPI , CS0 .

, SPI.

7 6 5 4 3 2 1 0
- - CSSB[1:0] MCLK[1:0] SPICKP SPIMA_SL
0 0 00 01 1 1

74HC595. .

RCK SCK -SCLR -G Function
X X X H Qa_h are tri state
X X L L Clear Shift register
X 0->1 H L Shift register clocked
0->1 X H L Contents of shift register sent to output latches

LCDSPI.asm

, , :

  • -

VERSA1

hex- - Goal Semiconductor www.goalsemi.com.

;*  : LCDSPI2.asm *
;* *
;* :    *
;*  LCD   HD44780  VERSA1 *
;*   SPI     74HC595*
;*      *
;*   SDI  SPI.   *
;*      *
;*     *
;*  LCD. *
;* *
;*       LCD. *
;*    LCD    *
;* . *
;* *
;*: SPI     74HC595*
;*      *
;* *
;*     74HC595  *
;* ============================= *
;* | VCC | PIN 16 |   VCC *
;* | GND | PIN 7 |   GND *
;* | !OE | PIN 13 |   GND *
;* | !SRCLR | PIN 10 |   VCC *
;* | RCLK | PIN 12 |   SPI CS0- *
;* | SER | PIN 14 |   SPI SDO *
;* | SRCK | PIN 11 |   SPI SCK *
;* *
;*  74HC595 *
;* =================== *
;* | QA(LSB)| PIN 15 |  *
;* | QB | PIN 1 | LCD RS *
;* | QC | PIN 2 | LCD R/!W *
;* | QD | PIN 3 | LCD E *
;* | QE | PIN 4 | LCD DATA4 *
;* | QF | PIN 5 | LCD DATA5 *
;* | QG | PIN 6 | LCD DATA6 *
;* | QH(MSB)| PIN 7 | LCD DATA7 *
;* | QH' | PIN 9 |   *
;* *
;*    BF: ( ) *
;* ======================= *
;*    4.7  QC, QD, QE  QF *
;*   LCD DATA4 -7 *
;*  DATA7  LCD   SPI SDI *
;* *
;************************************************************************
;* DATE: DECEMBER, 2001 *
;* VERSION: 1.0 *
;* *
;* AUTHOR(s): Francois Turgeon *
;* Goal Semiconductor inc. *
;* 1134 Ste-Catherine West Suite 900 *
;* Montreal Quebec *
;* Canada, H3B -1H4 *
;* *
;* Tel: (514) 871 -2447 *
;* Fax: (514) 394 -0661 *
;* Web: www.goalsemi.com *
;* *
;************************************************************************
;************************************************************
;* V003    *
;************************************************************
;**********************************
;*  *
;**********************************
CPTR EQU 040h ;  
LCDDATA EQU 041h ;      LCD
SPITXMOT EQU 041h ;    SPI
LCDCAR EQU 042h ;    LCD
LCDCMD EQU 043h ;    LCD
USWAIT EQU 044h ;  
CGCPTR EQU 045h ;CGRAM   
;***************************
;*   SPI*
;***************************
SPIINTSTAT EQU 0BCh ;  SPI
SPIRXOVERRUN EQU 0BDh ;SPI RX  
SPICTRL EQU 0B4h ;  SPI
SPIRX EQU 0B5h ;SPI RX 
SPITX EQU 0B6h ;SPI TX 
SPIIRQMASK EQU 0B7h ;   SPI
IOCTRL EQU 0BAh ;  -
;**************************
;*   LCD *
;**************************
LCD_L1C1 EQU 080h ;1 1 LCD 
LCD_L2C1 EQU 0C0h ;2 1 LCD
LCD_CLEAR EQU 001h ; ,  
;  
LCD_HOME EQU 002h ;     
;*********************************
;*    *
;*********************************
ORG 0000h
LJMP INISYSTEM ; 
;**************************
;*   *
;**************************
ORG 0100h
INISYSTEM: CLR DPS ; DATA POINTER 0
MOV SP,#0C0H ;   
;*** SPI   
MOV SPICTRL,#00000111B ;[5:4] CS0
;[3:2] DIVIDER 8:   1MHz
;[1]  
;[0]  
MOV SPIIRQMASK,#00h ; IRQ SPI
LCALL INITSPILCD ;   LCD
; 74HC595
LCALL INILCDCGRAM ; . 
;   LCD CGRAM 
MESSAGELOOP: MOV LCDCMD,#LCD_CLEAR ; LSD
LCALL SPILCDCMD
MOV A,#250 ; 250
LCALL DELAY1MS
MOV DPTR,#LCDMSG1 ; 'VERSA1 '   
LCALL SPILCDSTR
MOV LCDCMD,#08AH ; DDRAM ADRS = LINE=1, COL=10
LCALL SPILCDCMD
MOV LCDCAR,#00 ; .  #1   CGRAM
LCALL SPILCDCAR
MOV A,#250 ; 250
LCALL DELAY1MS
MOV LCDCMD,#LCD_L2C1 ;  LCD   
LCALL SPILCDCMD
MOV DPTR,#LCDMSG2 ; 'LCD INTERF '   
LCALL SPILCDSTR
MOV A,#250
LCALL DELAY1MS
MOV A,#250
LCALL DELAY1MS
MOV A,#250
LCALL DELAY1MS
MOV IOCTRL,#0BH
LJMP MESSAGELOOP ; 
;*********************************************************************
;*********   * ************
;*********************************************************************
;******************************************************
;*********  SPI LCD *****************
;************************************************ ******
;************************************************************************
;*  : INITSPILCD.asm *
;* *
;* :  LCD   SPIBUS  *
;*   74HC595*
;* *
;*: SPI     74HC595*
;*      *
;* *
;*     74HC595  *
;* ============================= *
;* | VCC | PIN 16 |   VCC *
;* | GND | PIN 7 |   GND *
;* | !OE | PIN 13 |   GND *
;* | !SRCLR | PIN 10 |   VCC *
;* | RCLK | PIN 12 |   SPI CS0- *
;* | SER | PIN 14 |   SPI SDO *
;* | SRCK | PIN 11 |   SPI SCK *
;* *
;*  74HC595 *
;* =================== *
;* | QA(LSB)| PIN 15 |  *
;* | QB | PIN 1 | LCD RS *
;* | QC | PIN 2 | LCD R/!W *
;* | QD | PIN 3 | LCD E *
;* | QE | PIN 4 | LCD DATA4 *
;* | QF | PIN 5 | LCD DATA5 *
;* | QG | PIN 6 | LCD DATA6 *
;* | QH(MSB)| PIN 7 | LCD DATA7 *
;* | QH' | PIN 9 |   *
;* *
;*  : SPITXMIT:  8    SPI *
;* SPILCDEPULSE:  1    E LCD*
;* DELAY1MS:  1 *
;* DELAY50US:  50*
 ;* *
;********************************************************************* ***
;* DATE: DECEMBER, 2001 *
;* VERSION: 1.0 *
;* *
;* AUTHOR(s): Francois Turgeon *
;* Goal Semiconductor inc. *
;* 1134 Ste-Catherine West Suite 900 *
;* Montreal Quebec *
;* Canada, H3B -1H4 *
;* *
;* Tel: (514) 871 -2447 *
;* Fax: (514) 394-0661 *
;* Web: www.goalsemi.com *
;* *
;********************************************************* ***************
INITSPILCD: MOV A,#20 ; 20M
LCALL DELAY1MS
MOV LCDDATA,#00110000B ;    ;
;LCD  8  
;D7 D6 D5 D4 E R/W RS NC
;| | | | | | | |
;0 0 1 1 0 0 0 0
;(  SEQ UENCE   3 )
LCALL SPITXMIT
LCALL SPILCDEPULSE ;E= L ->H THEN H->L
;  /  LCD
MOV A,#6 ;DELAY 4.1MS + (5mS USED)
LCALL DELAY1MS
LCALL SPILCDEPULSE ;SECOND TIME. E= L ->H THEN H->L
;   /  LCD
MOV A,#2 ;DELAY 100uS+ (1mS USED)
LCALL DELAY1MS
LCALL SPILCDEPULSE ;THIRD TIME. E= L ->H THEN H->L
;   /  LCD
 MOV A,#6 ;DELAY 4.1mS+ (5mS USED )
LCALL DELAY1MS
MOV LCDDATA,#00100000b ;SET 4BITS OPERATION
LCALL SPITXMIT ;D7 D6 D5 D4 E R/W RS NC
LCALL SPILCDEPULSE ;| | | | | | | |
;0 0 1 0 0 0 0 0
MOV A,#80
LCALL DELAYUS ;DELAY 40uS+
;**      BUSY 
;**    
;**  : 4 , 2 ,  5X8 .
MOV LCDDATA,#00100000b ; 4    1/16
LCALL SPITXMIT ;D7 D6 D5 D4 E R/W RS NC
LCALL SPILCDEPULSE ;| | | | | | | |
;0 0 1 0 0 0 0 0
MOV LCDDATA,#10000000b ;D7 D6 D5 D4 E R/W RS NC
LCALL SPITXMIT ;| | | | | | | |
LCALL SPILCDEPULSE ;N F 0 0 0 0 0 0
;N=0 -> 1 LINE, N=1 -> 2 LINES
;F=0 -> 5x8 FONT, F=1 -> 5x10 FONT
MOV A,#200
LCALL DELAYUS ;  40
;**  ,  ,  
MOV LCDDATA,#00000000b ;  ,  ,  
LCALL SPITXMIT ;D7 D 6 D5 D4 E R/W RS NC
LCALL SPILCDEPULSE ;| | | | | | | |
;0 0 0 0 0 0 0 0
MOV LCDDATA,#11000000B ;D7 D6 D5 D4 E R/W RS NC
LCALL SPILCDEPULSE ;| | | | | | | |
LCALL SPITXMIT ;1 D C B 0 0 0 0
LCALL SPILCDEPULSE ;D=1 ->  , D=0 ->  
MOV A,#80 ;C=1 ->  , C=0 ->  
LCALL DELAYUS ;B=1 ->  , B=0 ->  
;** ;ENTRY MODE SET INCREMENT, NO SHIFT
MOV LCDDATA,#00000000b ;ENTRY MODE SET INCREMENT, NO SHIFT
LCALL SPITXMIT ;D7 D6 D5 D4 E R/W RS NC
LCALL SPILCDEPULSE ;| | | | | | | |
;0 0 0 1 0 0 0 0
MOV LCDDATA,#01000000B ;D7 D6 D5 D4 E R/W RS NC
LCALL SPILCDEPULSE ;| | | | | | | |
LCALL SPITXMIT ;S R x x 0 0 0 0
LCALL SPILCDEPULSE ;S=1 -> 
;S=0 ->  
MOV A,#80 ;R=1 -> 
;R=0 -> 
LCALL DELAYUS
RET
;************************************************************************
;*  : INITSPILCD.asm *
;* *
;* :  8     LCD*
;*  CGRAM LCD   SPI *
;* *
;*   LCD *
;*   5X8. *
;* *
;*     CGRAM   *
;*     8  *
;* CGROM       *
;************************************************************************
;* DATE: DECEMBER, 2001 *
;* VERSION: 1.0 *
;* *
;* AUTHOR(s): Francois Turgeon *
;* Goal Semiconductor inc. *
;* 1134 Ste-Catherine West Suite 900 *
;* Montreal Quebec *
;* Canada, H3B -1H4 *
;* *
;* Tel: (514) 871 -2447 *
;* Fax: (514) 394 -0661 *
;* Web: www.goal semi.com *
;* *
;************************************************************************
INILCDCGRAM: MOV LCDCMD,#040H ;  CGRAM  0000H
LCALL SPILCDCMD
MOV DPTR,#LCDCHAR1
MOV CGCPTR,#64
CHARCOPY: MOV A,#00 ;   
; CGRAM LCD
MOVC A,@A+DPTR
MOV LCDCAR,A
ACALL SPILCDCAR
INC DPTR
DJNZ CGCPTR,CHARCOPY
MOV LCDCMD,#080h ;    00H DDRAM 
LCALL SPILCDCMD
RET
;***  8   
;***     
LCDCHAR1: DB 00000000b ;MAPPING OF THE USER LCD
DB 00010101b ; #1
DB 00000100b ;   LCD CGRAM
DB 00000100b
DB 00000100b
DB 00010001b
DB 00001110b
DB 00000000b
LCDCHAR2: DB 00000000b ;MAPPING OF THE USER LCD
DB 00000000b ;  #2
DB 00000000b ;    LCD CGRAM 
DB 00011111b
DB 00000000b
DB 00000000b
DB 00000000b
DB 00000000b
LCDCHAR3: DB 00000000b ;MAPPING OF THE USER LCD
DB 00000000b ; #3
DB 00000000b ;    LCD CGRAM 
DB 00000000b
DB 00011110b
DB 00000000b
DB 00000000b
DB 00000000b
LCDCHAR4: DB 00000000b ;MAPPING OF THE USER LCD
DB 00000000b ; #4
DB 00000000b ;    LCD CGRAM
DB 00001100b
DB 00000000b
DB 00000000b
DB 00000000b
DB 00000000b
LCDCHAR5: DB 00000000b ;MAPPING OF THE USER LCD
DB 00000000b ; #5
DB 00011111b ;    LCD CGRAM 
DB 00001110b
DB 00000100b
DB 00001110b
DB 00011111b
DB 00000000b
LCDCHAR6: DB 00000000b ;MAPPING OF THE USER LCD
DB 00000000b ; #6
DB 00000000b ;    LCD CGRAM 
DB 00000000b
DB 00000000b
DB 00000000b
DB 00000000b
DB 00000000b
LCDCHAR7: DB 00000000b ;MAPPING OF THE USER LCD
DB 00000000b ; #7
DB 00000000b ;    LCD CGRAM
DB 00000000b
DB 00000000b
DB 00000000b
DB 00000000b
DB 00000000b
LCDCHAR8: DB 00000000b ;MAPPING OF THE USER LCD
DB 00000000b ; #8
DB 00000000b ;    LCD CGRAM
 DB 00000000b
DB 00000000b
DB 00000000b
DB 00000000b
DB 00000000b
MOV 1,1 ;ARTEFACT FOR ASSEMBLER
;************************************************************************
;*  : SPILCDCAR.asm *
;* *
;*:     LCD   SPI *
;*    *
;* *
;*  :    *
;* *
;* : SPITXMIT:  /  LCD *
;* SPILCDEPULSE:       LCD*
;* SPILCDBUSY:     LCD*
;************************************************************************
;* DATE: DECEMBER, 2001 *
;* VERSION: 1.0 *
;* *
;* AUTHOR(s): Francois Turgeon *
;* Goal Semiconductor inc. *
;* 1134 Ste-Catherine West Suite 900 *
;* Montreal Quebec *
;* Canada, H3B -1H4 *
;* *
;* Tel: (514) 871 -2447 *
;* Fax: (514) 394-0661 *
;* Web: www.goalsemi.com *
;* *
;************************************************************ ************
SPILCDCAR: MOV A,LCDCAR ;GET MSQ OF CARACT VALUE TO SEND
ANL A,#0F0H ;ISOLATE MSQ
SETB ACC.1 ;SET LCD RS BIT
MOV LCDDATA,A ;SEN D TO LCD
LCALL SPITXMIT
LCALL SPILCDEPULSE
MOV A,LCDCAR ;GET LSQ OF CARACT TO SEND
SWAP A ;PUT LSQ IN MSQ POSITION
ANL A,#0F0H ;ISOLATE LSQ TO SEND
SETB ACC.1 ;SET LCD RS BIT
MOV LCDDATA,A ;SEND TO LCD
LCALL SPITXMIT
LCALL SPILCDEPULSE
LCALL SPILCDBUSY
RET
;**********************
;* FONCTION SPILCDCMD *
;************************************************************************
;*  : SPILCDCMD.asm *
;* *
;* :  LCD   SPI *
;*    *
;* *
;*  :      * ;* *
;* *
;*  : SPITXMIT:  /  LCD *
;* SPILCDEPULSE:       LCD*
;* SPILCDBUSY:     LCD*
;************************************************************************
;* DATE: DECEMBER, 2001 *
;* VERSION: 1.0 *
;* *
;* AUTHOR(s): Francois Turgeon *
;* Goal Semiconductor inc. *
;* 1134 Ste-Catherine West Suite 900 *
;* Montreal Quebec *
;* Canada, H3B -1H4 *
;* *
;* Tel: (514) 871 -2447 *
;* Fax: (514) 394 -0661 *
;* Web: www.goalsemi.com *
;* *
;************************************************************************
SPILCDCMD: MOV A,LCDCMD ;
ANL A,#0F0H
MOV LCDDATA,A ; MSQ  LCD 
LCALL SPITXMIT
LCALL SPILCDEPULSE
MOV A,LCDCMD
SWAP A
ANL A,#0F0H
MOV LCDDATA,A ; LSQ  LCD
ACALL SPITXMIT
ACALL SPILCDEPULSE
ACALL SPILCDBUSY
RET
;*************************************************** *********************
;*  : SPILCDSTR.asm *
;* *
;*:     LCD   *
;*  SPI    . *
;*    ,  DPTR. *
;*      *
;* *
;*  :      DPTR *
;*  . *
;* *
;*  : SPILCDCAR :    LCD *
;* *
;************************************************************************
;* DATE: DECEMBER, 2001 *
;* VERSION: 1.0 *
;* *
;* AUTHOR(s): Francois Turgeon *
;* Goal Semiconductor inc. *
;* 1134 Ste-Catherine West Suite 900 *
;* Montreal Quebec *
;* Canada, H 3B-1H4 *
;* *
;* Tel: (514) 871 -2447 *
;* Fax: (514) 394 -0661 *
;* Web: www.goalsemi.com *
;* *
;************************************************************************
SPILCDSTR: MOV A,#0 ;   
MOVC A,@A+DPTR ;   DPTR
JZ FINSPILCDSTR ;  == NULL (0)
; ->  
MOV LCDCAR,A ; != NULL ->   LCD
LCALL SPILCDCAR
INC DPTR ;   
AJMP SPILCDSTR ;    
;  LCD
FINSPILCDSTR: RET
;************************************************************************
;*  : SPILCDEPULSE.asm *
;* *
;* :      LCD   SPI  *
;*   . *
;* *
;*  :    LCDDATA *
;* *
;*  : SPITXMIT : * ;*  LCD *
;* *
;************************************************************************
;* DATE: DECEMBER, 2001 *
;* VERSION: 1.0 *
;* *
;* AUTHOR(s): Francois Turgeon *
;* Goal Semiconductor inc. *
;* 1134 Ste-Catherine West Suite 900 *
;* Montreal Quebec *
;* Canada, H3B -1H4 *
;* *
;* Tel: (514) 871 -2447 *
;* Fax: (514) 394 -0661 *
;* Web: www.goalsemi.com *
;* *
;************************************************************************
SPILCDEPULSE: MOV A,LCDDATA
ORL A,#00001000B ; E  1
MOV LCDDATA,A ;   LCDDATA 
LCALL SPITXMIT ;  LCD
NOP ;   1 
NOP
NOP
NOP
NOP
MOV A,LCDDATA ; LCDDATA
ANL A,#11110111B ; E = 0
MOV LCDDATA,A
LCALL SPITXMIT ;  LCD
NOP
NOP
NOP
NOP
NOP
RET
;************************************************************************
;*  : SPIBUSY.asm *
;* *
;* :    LCD *
;* *
;* *
;************************************************************************
;* DATE: DECEMBER, 2001 *
;* VERSION: 1.0 *
;* *
;* AUTHOR(s): Francois Turgeon *
;* Goal Semiconductor inc. *
;* 1134 Ste-Catherine West Suite 900 *
;* Montreal Quebec *
;* Canada, H3B -1H4 *
;* *
;* Tel: (514) 871-2447 *
;* Fax: (514) 394 -0661 *
;* Web: www.goalsemi.com *
;* *
;************************************************************************
SPILCDBUSY: MOV SPITX,#00000100B ; D7 -D4= 1. E=0, RW=1, RS=0
NOP
NOP
NOP
NOP
NOP
NOP
NOTRDY: MOV SPITX,#00001100B ; E= 0 ->1
NOP
NOP
NOP
NOP
NOP
NOP
NOP
MOV SPICTRL,#00000111B ;  SPI  CS1
;   BUSY  SDI
;[5:4] CS1
;[3:2]  8:   1MHz
;[1]  
;[0]  
MOV SPIIRQMASK,#00000010B ;   IRQ
NOP
NOP
NOP
MOV A,SPIRX ;     INTERRUPTS
MOV SPITX,#00H ;    
NOP
NOP
WAITREADBU: MOV A,SPIINTSTAT ; 
ANL A,#00000010B ;  RXDATAAVAILL 
JZ WAITREADBU
MOV SPICTRL,#00000111B ;  SPI  CS0
;[5:4] CS1
;[3:2]  8:   1
;[1]  
;[0]  
MOV SPITX,#00000100B ; D7-D4=1, E=0, RW=1, RS=0
NOP
NOP
NOP
NOP
NOP
NOP
MOV SPITX,#00001100B ; D7 -D4=1, E=1 RW=1, RS=0
NOP
NOP
NOP
NOP
NOP
MOV SPITX,#00000100B ; D7 -D4=1, E=0, RW=1, RS=0
NOP
NOP
MOV A,SPIRX ;  RX
JNZ NOTRDY ; BUSY = 1    BUSY.
NOP
NOP
RET
;********************************************************
;*************   SPI *********** *******
;********************************************************
;************************************************************************
;*  : SPITXMIT.asm *
;* *
;* :     SPI   *
;*    *
;* *
;*  : SPITXMOT (STD RAM ADDRESS) *
;* *
;************************************************************************
;* DATE: July, 2001 *
;* VERSION: 1.0 *
;* *
;* AUTHOR(s): Francois Turgeon / Gilles Rust *
;* Goal Semiconductor inc. *
;* 1134 Ste-Catherine West Suite 900 *
;* Montreal Quebec *
;* Canada, H3B-1H4 *
;* *
;* Tel: (514) 871 -2447 *
;* Fax: (514) 394 -0661 *
;* Web: www.goalsemi.com *
;* *
;************************************************************************
SPITXMIT: MOV A,SPIINTSTAT
JNB ACC.0,SPITXMIT ;   
MOV SPITX,SPITXMOT ;    TX SPI
WAITTXENDSPI: MOV A,SPIINTSTAT ;  
JNB ACC.0,WAITTXENDSPI
RET
;************************************************************************
;*  : DELAY1MS.asm *
;* *
;* :   1. *
;*    *
;*  *
;* *
;*  : ACC =    *
;* *
;************************************************ ************************
;* DATE: July 6, 2001 *
;* VERSION: 2.0 *
;* *
;* AUTHOR(s): Francois Turgeon *
;* Goal Semiconductor inc. *
;* Montreal Quebec *
;* Canada, H3B -1H4 *
;* *
;* Tel: (514) 871 -2447 *
;* Fax: (514) 394 -0661 *
;* Web: www.goalsemi.com *
;* *
;* REVISIONS: 2.0 Adjusted for 16.257MHz Oscillator *
;* *
;************************************************************************
DELAY1MS: MOV CPTR,A ; ACC =    1
MOV A,TMOD
ANL A,#0F0H ;  TIMER0
ORL A,#01H ;TIMER0 = MODE 1,  
CONTROL BY TR0
MOV TMOD,A ;    TMOD
LOOPT01MS: CLR TR0 ; TIMER0
MOV TH0,#0FDH ; TIMER0
MOV TL0,#5EH ;= 1  16.257 - 12 
;  = 674  
;  = 65536 - 674
;= 63515  (FD5Eh)
CLR TF0 ; T0  
SETB TR0 ; 
ACKWTOVRT0: JNB TF0,ACKWTOVRT0 ;  
DJNZ CPTR,LOOPT01MS ;     
RET
;************************************************************************
;*  : DELAY1MS.asm *
;* *
;* :    1 *
;*      US *
;* US = (DELAY / 2) - 2 *
;*     16 *
;* *
;*  : A =   *
;* *
;******************************************* *****************************
;* DATE: August, 2001 *
;* VERSION: 1.0 *
;* *
;* AUTHOR(s): Francois Turgeon / Gilles Rust *
;* Goal Semiconductor inc. *
;* 1134 Ste-Catherine West Suite 900 *
;* Montreal Quebe c *
;* Canada, H3B -1H4 *
;* *
;* Tel: (514) 871 -2447 *
;* Fax: (514) 394 -0661 *
;* Web: www.goalsemi.com *
;* *
;************************************************************************
DELAYUS: MOV USWAIT,A
DELAYUS1: DJNZ USWAIT,DELAYUS1
RET
;***********************************************
;* LCD STRING DEFINITION FOR 20X2 CARACTER LCD *
;***********************************************
ORG 1000H
LCDMSG1: DB 'VERSA1',0
LCDMSG2: DB 'LCD INTERFACE. ',0
END






- - DOC - - - - - - -



 
? | | |
. : +7 (495) 514 4110. e-mail:info@eust.ru
©1998-2016