antedeluvian thx for the link, but i already read the tutorial about the lcd's(my lcd data sheet -
https://www.lumex.com/pdf/LCM-S01602DSF+A.pdf). i also tried the to use the program from the 8052.com tutorial on my Silicon Laboratories 8051F330 but it doesnt seem to work.
here is the code:
$NOMOD51
$include (c8051f330.inc) ; Include register definition file.
;-----------------------------------------------------------------------------
; RESET and INTERRUPT VECTORS
;-----------------------------------------------------------------------------
; Reset Vector
cseg AT 0
ljmp Main ; Locate a jump to the start of
; code at the reset vector.
DB0 EQU P0.0
DB1 EQU P0.1
DB2 EQU P0.2
DB3 EQU P0.3
DB4 EQU P0.4
DB5 EQU P0.5
DB6 EQU P0.6
DB7 EQU P0.7
EN EQU P1.5
RS EQU P1.7
RW EQU P1.6
LCDDATA EQU P0
WAIT_LCD:
CLR EN ;Start LCD command
CLR RS ;It's a command
SETB RW ;It's a read command
MOV LCDDATA,#0FFh ;Set all pins to FF initially
SETB EN ;Clock out command to LCD
MOV A,LCDDATA ;Read the return value
JB ACC.7,WAIT_LCD ;If bit 7 high, LCD still busy
CLR EN ;Finish the command
CLR RW ;Turn off RW for future commands
RET
; following program code.
INIT_LCD:
CLR RS
MOV LCDDATA,#38h
SETB EN
CLR EN
LCALL WAIT_LCD
CLR RS
MOV LCDDATA,#0Eh
SETB EN
CLR EN
LCALL WAIT_LCD
CLR RS
MOV LCDDATA,#06h
SETB EN
CLR EN
LCALL WAIT_LCD
RET
CLEAR_LCD:
CLR RS
MOV LCDDATA,#01h
SETB EN
CLR EN
LCALL WAIT_LCD
RET
WRITE_TEXT:
SETB RS
MOV LCDDATA,A
SETB EN
CLR EN
LCALL WAIT_LCD
RET
Main:
; Disable the WDT.
anl PCA0MD, #NOT(040h) ; clear Watchdog Enable bit
mov P0MDOUT, #00h
mov P1MDOUT, #00h
mov XBR0, #40h ; assignments
mov XBR1, #40h ; enable Crossbar
LCALL INIT_LCD
LCALL CLEAR_LCD
MOV A,#'H'
LCALL WRITE_TEXT
MOV A,#'E'
LCALL WRITE_TEXT
MOV A,#'L'
LCALL WRITE_TEXT
MOV A,#'L'
LCALL WRITE_TEXT
MOV A,#'O'
LCALL WRITE_TEXT
MOV A,#' '
LCALL WRITE_TEXT
MOV A,#'W'
LCALL WRITE_TEXT
MOV A,#'O'
LCALL WRITE_TEXT
MOV A,#'R'
LCALL WRITE_TEXT
MOV A,#'L'
LCALL WRITE_TEXT
MOV A,#'D'
LCALL WRITE_TEXT
END
and i can figure out were the problem is could some one send me a working example?
i am a beginner so dont really know how to configure the ports. could someone tell me if its done right in the example above?
tnx all
artem