Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 09, 2016, 12:32:27 12:32


Login with username, password and session length


Pages: [1]
Print
Author Topic: I need idea RS232 to LCD via pic display  (Read 5863 times)
0 Members and 1 Guest are viewing this topic.
tango
Junior Member
**
Offline Offline

Posts: 52

Thank You
-Given: 27
-Receive: 11


« on: May 11, 2008, 10:08:51 22:08 »

Here what I need if some good idea.
I want to display some data like word "DOG" at specific part of LCD 4x20 chr.
The word wil be receive from PC via RS232 to 16F877@20Mhz.
Hove to I configure what will be send from PC to PIC ?
I was think to send maybe 1DOG to PIC and maybe decode first number like what line I wil use and next word DOG is what I will show on LCD.Maybe is some good idea also for wich position will be display word etc....

Did someone have good idea for that simple protocol?

Any suggest Huh

Many thanks to all from me..
Tango
Logged
jeanninemtv
Senior Member
****
Offline Offline

Posts: 315

Thank You
-Given: 57
-Receive: 25


« Reply #1 on: May 11, 2008, 10:41:02 22:41 »

use the RCIF  in the interrupt
use a tail char like $FF to end every frame...

use array to put every byt you receive until $FF

then


use a header, y,x, and the string to print...
then use a flag to validate print at x,y,stringgroup in the main loop


see you











Logged
free
Active Member
***
Offline Offline

Posts: 115

Thank You
-Given: 66
-Receive: 13


« Reply #2 on: May 12, 2008, 02:30:09 02:30 »

What is the compiler you are using?
If it's mikrobasic, you only need USART and LCD library.
The libraries are helpfull to your project.
Logged

Some dream to escape reality, some to change it forever.
- Soichiro Honda -
maddoc
Newbie
*
Offline Offline

Posts: 32

Thank You
-Given: 49
-Receive: 14


« Reply #3 on: May 12, 2008, 09:35:10 09:35 »

In my displays I emulate the Matrix Orbital protocol, it helps me connect the LCD with diverse software on the computer (LCDSmartie for instance - displays system stats).

Code:
DEVICE 16F877
DECLARE XTAL 20
CONFIG HS_OSC,WDT_OFF,PWRTE_ON,LVP_OFF,CP_OFF,BODEN_OFF,DEBUG_OFF,WRTE_ON,CPD_OFF
ALL_DIGITAL=TRUE

TRISB = %00000000        ' PORTB OUTPUT
TRISD = %00000000
LOW PORTB
LOW PORTD
LOW PORTC.1   'BACKLIGHT
LOW PORTC.2   'CONTRAST


HSERIAL_BAUD = 19200 ' Set baud rate
HSERIAL_RCSTA = %10010000 ' Enable serial port and continuous receive
HSERIAL_TXSTA = %00100100 ' Enable transmit and asynchronous mode
HSERIAL_CLEAR = ON ' Optionally clear the buffer before receiving


SYMBOL PRT PORTB 'D0-7 = PORTB0-7
SYMBOL E1 PORTD.7 'E1
SYMBOL RW PORTD.6 'RW
SYMBOL RS PORTD.5 'RS
SYMBOL E2 PORTD.4 'E2


EDATA "              MadDOC's LCD              "
EDATA "                                        "
EDATA "                                        "
EDATA "             LCD rev. 0.9               "


DIM C AS BYTE
DIM X AS BYTE
DIM B AS BYTE
DIM CMND AS BYTE
DIM COL AS BYTE
DIM ROW AS BYTE
DIM FLAG AS BYTE
DIM BL AS BYTE          'Backlight
DIM CNT AS BYTE        'Contrast
BL = 80
CNT = 80

'===========================================================================

GOSUB INIT
GOSUB LCDCLEAR

FOR X = 0 TO 79
C = EREAD X
GOSUB WC1
NEXT
FOR X = 80 TO 159
C = EREAD X
GOSUB WC2
NEXT
GOSUB LCDHOME

HPWM 1, CNT, 2000
HPWM 2, BL, 2000

GOTO MAIN 

'============================================================================

MAIN:
C = HRSIN    
IF C <> $FE THEN
    IF FLAG = 1 THEN
    GOSUB CB
LOW RW
HIGH RS
DELAYUS 45
PRT = C
HIGH E1
DELAYUS 45
LOW E1
LOW RS
    ELSE
    GOSUB CB
LOW RW
HIGH RS
DELAYUS 45
PRT = C
HIGH E2
DELAYUS 45
LOW E2
LOW RS
    ENDIF
ELSE
CMND = HRSIN
SELECT CMND

CASE 71     'POSITION COMMAND
  COL = HRSIN
  ROW = HRSIN
  IF ROW = 1 THEN
      C = 127 + COL
FLAG = 1
  ELSEIF ROW = 2 THEN
      C = 191 + COL
FLAG = 1
      ELSEIF ROW = 3 THEN
      C = 127 + COL
FLAG = 2
  ELSE
  C = 191 + COL
FLAG = 2
  ENDIF
  LOW RS
  LOW RW
  IF FLAG = 1 THEN
  GOSUB WB1
  ELSE
  GOSUB WB2
  ENDIF

CASE 78             'CUSTOM CHARACTER
  C = (HRSIN * 8) + 64
    GOSUB WB
  FOR X = 0 TO 7
  C = HRSIN
    HIGH RS
  GOSUB WB
  NEXT
  LOW RS

CASE 88       'CLEAR DISPLAY
    GOSUB LCDCLEAR
 
CASE 72         'HOME POSITION
      GOSUB LCDHOME

CASE 66      'BL ON, TIME
  X = HRSIN
  HPWM 2, BL, 2000

CASE 70    'BL OFF
  HPWM 2, 0, 2000


CASE 153    'BRIGHTNESS 153
  BL = HRSIN
  HPWM 2, BL, 2000  


CASE 152    'BRIGHTNESS + SAVE
  BL = HRSIN
  HPWM 2, BL, 2000
 

CASE 145      'CONTRAST + SAVE 145
  CNT = HRSIN
  HPWM 1, CNT, 2000

 
CASE 80  'CONTRAST
  CNT = HRSIN
  HPWM 1, CNT, 2000


CASE 55              'DISPLAY TYPE LK404-55
  HRSOUT $0A
 
CASE 54
  HRSOUT "0.9"

ENDSELECT
ENDIF
GOTO MAIN


'Other Display commands supported by MO displays
'147 SET REMEMBER
'86 GPO OFF
'87 GPO ON
'76 CURSOR LEFT
'77 CURSOR RIGHT
'51 SET I2C ADDRESS
'55 READ MODULE TYPE 0x0A 4x40
'57 SET RS-232 SPEED
'52 SET SERIAL NUMBER
'53 READ SERIAL NUMBER
'54 READ VERSION NUMBER
'51 AUTOSCROLL ON
'52 AUTOSCROLL OFF
'74 UNDERLINE ON
'75 UNDERLINE OFF
'83 BLOCK CURS ON
'84 BLOCK CURS OFF
'64 STORE STARTUP SCREEN

WB:       'WRITE BYTES
DELAYUS 45
PRT = C
HIGH E1
HIGH E2
DELAYUS 45
LOW E1
LOW E2
RETURN

WB1:      'WRITE BYTE 1
DELAYUS 45
PRT = C
HIGH E1
DELAYUS 45
LOW E1
RETURN

WC1:  'WRITE CHAR 1
GOSUB CB
LOW RW
HIGH RS
GOSUB WB1
LOW RS
RETURN

WB2:  'WRITE BYTE 2
DELAYUS 45
PRT = C
HIGH E2
DELAYUS 45
LOW E2
RETURN

WC2:   'WRITE CHAR 2
GOSUB CB
LOW RW
HIGH RS
GOSUB WB2
LOW RS
RETURN

LCDCLEAR: 'LCD CLEAR THEN HOME
GOSUB CB
LOW RS
LOW RW
C = %00000001
GOSUB WB
RETURN

LCDHOME: 'LCD HOME
GOSUB CB
C = %00000010
GOSUB WB
FLAG = 1
RETURN

CB:         'CHECK BUSY
TRISB = %11111111
LOW RS
HIGH RW
HIGH E1
DELAYUS 50
B = PRT
LOW E1
IF B > %01111111 THEN GOTO CB
LOW RW
TRISB = %00000000
RETURN

INIT:     'INIT
DELAYMS 100
C = %00111000
GOSUB WB
C = %00001100
GOSUB WB
C = %00000001
GOSUB WB
DELAYMS 2
C = %00000110
GOSUB WB
RETURN

END ' END OF PROGRAM
Logged
tango
Junior Member
**
Offline Offline

Posts: 52

Thank You
-Given: 27
-Receive: 11


« Reply #4 on: May 12, 2008, 08:31:04 20:31 »

I was forgat to write I use PBP2.50A.
Pic is 16F877@20Mhz.
LCD is smart display 4x20 chr  PRC2004AW.

Regards
Logged
zokij
Senior Member
****
Offline Offline

Posts: 330

Thank You
-Given: 196
-Receive: 617


Nice time :)


« Reply #5 on: May 12, 2008, 09:12:15 21:12 »

I was forgat to write I use PBP2.50A.
Pic is 16F877@20Mhz.
LCD is smart display 4x20 chr  PRC2004AW.

Regards

You also forgot use "Thank You" button to members which  try to help you....
as you can see on your stat you receive 7 but give 0 thanks !!!
why you expect help if you discomfort to give one thanks to members???
Logged
tango
Junior Member
**
Offline Offline

Posts: 52

Thank You
-Given: 27
-Receive: 11


« Reply #6 on: May 13, 2008, 08:59:40 20:59 »

I was write some code nd work fine but only via 2x16 display and via hser in pic to pc.
When I was probe 4x20 display i was have problem!
Is some trick in PBP2.50 for define 4x20 display ?
Any idea ??
Regards
Logged
maddoc
Newbie
*
Offline Offline

Posts: 32

Thank You
-Given: 49
-Receive: 14


« Reply #7 on: May 13, 2008, 09:16:44 21:16 »

Usually 4x20 displays have a different order for the rows.

Some have 1,2,3,4 other use 1,3,2,4.
Characters will start appearing on the first line and continue the 3rd visible line, then jump to the second and continue to the 4th visible line.
You have to take that into account.
Always read the datasheet at least 4 times to get everything right.

If i remember correctly, compilers like PBP don't support displays with more then 2 lines.
You could try to use for the 1st line something like this: print at 1,1,"text max 20 chars"
You could try to use for the 2nd line something like this: print at 2,1,"text max 20 chars"
You could try to use for the 3rd line something like this: print at 1,21,"text max 20 chars"
You could try to use for the 4th line something like this: print at 2,21,"text max 20 chars"

See if this helps.
« Last Edit: May 13, 2008, 09:20:10 21:20 by maddoc » Logged
joker12
Junior Member
**
Offline Offline

Posts: 82

Thank You
-Given: 11
-Receive: 77


« Reply #8 on: May 13, 2008, 09:59:04 21:59 »

With 4 line display, you need to set the "DEFINE LCD_LINES 4"

You should also download the Manual from the Mfg's site.

http://www.melabs.com/support/index.htm

There are tons of sites showing how to program LCD's. Just do a google search.

Good Luck Cheesy
Logged
tango
Junior Member
**
Offline Offline

Posts: 52

Thank You
-Given: 27
-Receive: 11


« Reply #9 on: May 16, 2008, 09:34:56 21:34 »

Yes but I can't get anything on lcd it come full black after reset...that is problem.
Same pinout only redefine on no of lines use from 4 to 2 and use 2x16 with same hardware work 100%

Posted on: May 14, 2008, 06:46:37 06:46 - Automerged

I dont have more problem,problem was in extra sense contrast,and I was have fix network of resistors on that pin on lcd (pin3),the 2x16 chr have bad contrast and i was see "test" on it.
Now I was reduce voltage on pin3 at 4x20chr lcd and it work 100% ok.
Sorry for all but it was big problem becouse i wasnt know what is it!

Regards to all good peoples here who push me to little beter think about my problem.

Posted on: May 14, 2008, 05:54:36 17:54 - Automerged

Usually 4x20 displays have a different order for the rows.

Some have 1,2,3,4 other use 1,3,2,4.
Characters will start appearing on the first line and continue the 3rd visible line, then jump to the second and continue to the 4th visible line.
You have to take that into account.
Always read the datasheet at least 4 times to get everything right.

If i remember correctly, compilers like PBP don't support displays with more then 2 lines.
You could try to use for the 1st line something like this: print at 1,1,"text max 20 chars"
You could try to use for the 2nd line something like this: print at 2,1,"text max 20 chars"
You could try to use for the 3rd line something like this: print at 1,21,"text max 20 chars"
You could try to use for the 4th line something like this: print at 2,21,"text max 20 chars"

See if this helps.

The best way what I was find is to send from pc to picmicro next:
"128ABCDE" that is 128=first line first position becouse:
4x20 chr lcd have next schematic of places for chr:

Line 1 goes from 128 to 147                                 
Line 2 goes from 192 to 211                                 
Line 3 goes from 148 to 167                                   
Line 2 goes from 212 to 231

and you can simple send from wich position you want to print word or etc on display and receive that to array of 8 bit.
after that you can easy use data what you receive from pc.

All work good ....

Regards for all help from all good peoples here

Sorry for my bad english !!!
Logged
kalpakchiev
Active Member
***
Offline Offline

Posts: 137

Thank You
-Given: 34
-Receive: 67



« Reply #10 on: July 04, 2008, 09:35:20 21:35 »

try this one it is interrupt driven:
@ DEVICE PIC16F628, INTRC_OSC_NOCLKOUT, WDT_Off, PWRT_ON, MCLR_OFF, BOD_OFF, CPD_OFF, PROTECT_OFF
DEFINE LCD_DREG PORTB
DEFINE LCD_DBIT 4
DEFINE LCD_RSREG PORTA
DEFINE LCD_RSBIT 2
DEFINE LCD_EREG PORTA
DEFINE LCD_EBIT 1
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
DEFINE LCD_COMMANDUS 2000
DEFINE LCD_DATAUS 50
DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 24h
DEFINE HSER_BAUD 2400
DEFINE HSER_CLROERR 1 'Hser clear overflow automatically

'ADCON1 = 7            ' Set PortA and E to digital operation

RCIF   VAR   PIR1.5      ' Alias RCIF (USART Receive Interrupt Flag)
OERR   VAR   RCSTA.1      ' Alias OERR (USART Overrun Error Flag)
CREN   VAR   RCSTA.4      ' Alias CREN (USART Continuous Receive Enable)
trisb.1=1

Buf_Size   CON   32      ' Sets the size of the ring buffer
Buffer   VAR   BYTE[Buf_Size]   ' Array variable for holding received characters
Ind_In   VAR   BYTE   ' Pointer - next empty location in buffer
Ind_Out   VAR   BYTE   ' Pointer - location of oldest character in buffer
BufChar   VAR   BYTE   ' Stores the character retrieved from the buffer
I      VAR   BYTE   ' loop counter
Col      VAR   BYTE   ' Stores location on LCD for text wrapping
ErrFlag   VAR   BYTE   ' Holds error flags
INIT:
 Ind_In = 0:Ind_out = 0:I = 0:Col = 1
 INTCON = %11000000     ' Enable interrupts
 ON INTERRUPT GoTo SER_IN' Declare interrupt handler routine
 PIE1.5 = 1              ' Enable interrupt on USART
PAUSE 500
LCDOut $FE,1,"READY"
LOOP:
 enable interrupt
DISPLAY:            ' Dump the buffer to the LCD
 IF errflag Then error   ' Handle error if needed
 IF Ind_In = Ind_Out Then Loop   ' loop if nothing in buffer
 GoSub getbuf   ' Get a character from buffer   
 LCDOut bufchar   ' Send the character to LCD
 col = col + 1   ' Increment LCD location
 IF col > 20 Then   ' Check for end of line
   col = 1         ' Reset LCD location
   GOSUB LINE2:LCDOUT REP " "\20   ' Clear line-2 of LCD
   LCDOut $FE,2   ' Tell LCD to return home
EndIF
GoTo display         ' Check for more characters in buffer
disable interrupt
Error:            ' Display error message if buffer has overrun
' IF errflag.1 Then   ' Determine the error
'  Gosub LINE2:Lcdout "Buffer Overrun"   ' Display buffer error on line-2
'   Else
'  Gosub LINE2:LCDOUT "USART Overrun"   ' Display usart error on line-2
' EndIF
' Gosub LINE1      ' Send the LCD cursor back to line-1 home
' For i = 2 to Col   ' Loop for each column beyond 1
'  LCDOut $FE,$94   ' Move the cursor right to the right column
' Next i
' errflag = 0         ' Reset the error flag
 CREN = 0         ' Disable continuous receive to clear overrun flag
 CREN = 1         ' Enable continuous receive
 GoTo Display      ' Carry on
' Subroutines ------------------------------------------------------------------------
HOME:
 LCDOut $FE,1
return
LINE1:
 LCDOut $FE,$80
return
LINE2:
 LCDOUT $FE,$C0
return
'------------------------------------------------------------------------------------- 
Disable               ' Don't check for interrupts in this section
GetBuf:               ' move the next character in buffer to bufchar
 Ind_Out = (Ind_Out + 1)         ' Increment index_out pointer (0 to 63)
 IF Ind_Out > (Buf_Size-1) Then Ind_Out = 0   ' Reset pointer if outside of buffer
 bufchar = buffer[Ind_Out]         ' Read buffer location
Return
' Interrupt handler ------------------------------------------------------------------
SER_IN:            ' Buffer the character received
   IF OERR Then Usart_Err         ' Check for USART errors
   Ind_In = (Ind_In + 1)         ' Increment index_in pointer (0 to 63)
   IF Ind_In > (Buf_Size-1) Then Ind_In = 0   'Reset pointer if outside of buffer
   IF Ind_In = Ind_Out Then Buf_Err   ' Check for buffer overrun
   HSerin [buffer[Ind_In]]         ' Read USART and store character to next empty location
   IF RCIF Then SER_IN            ' Check for another character while we're here
Resume               ' Return to program

Buf_Err:
   errflag.1 = 1      ' Set the error flag for software
' Move pointer back to avoid corrupting the buffer. MIN insures that it ends up within the buffer.   
   Ind_In = (Ind_In - 1) MIN (Buf_Size - 1)   
   HSerin [buffer[Ind_In]]   ' Overwrite the last character stored (resets the interrupt flag)
Usart_Err:
   errflag.0 = 1      ' Set the error flag for hardware
Resume               ' Return to program
'End               

Posted on: July 04, 2008, 09:31:54 21:31 - Automerged

or this one without interrupts:

@ DEVICE PIC16F628, INTRC_OSC_NOCLKOUT, WDT_Off, PWRT_ON, MCLR_OFF, BOD_OFF, CPD_OFF, PROTECT_OFF
DEFINE OSC 20
DEFINE LCD_DREG PORTB
DEFINE LCD_DBIT 4
DEFINE LCD_RSREG PORTA
DEFINE LCD_RSBIT 2
DEFINE LCD_EREG PORTA
DEFINE LCD_EBIT 1
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
DEFINE LCD_COMMANDUS 2000
DEFINE LCD_DATAUS 50
Ser_Mode con 396
L1  var byte[25]
L2  Var Byte[25]
I   var byte
J   var byte
Ch  var byte
LenL1 var l1[0]
LenL2 var L2[0]
B0 var PortB.0
B1 var PortB.1
B2 var PortB.2
B3 var PortB.3
RS var PortA.0
TrisA=%11111001
TrisB=%00001111

INIT:
 CLEAR
 Pause 250
 Gosub HOME
lcdout  $FE,1,"ready"
 LOOP:
  serin2 RS,Ser_Mode,5,LOOP,[Ch]  '50
  I=0
  NEXT_Char:                                 
   I=I+1:L1=Ch
   Serin2 RS,Ser_Mode,50,END_Char,[Ch]   '250
   goto Next_Char
  END_Char:
   LenL1=I
   gosub Home
   Gosub Line1
   For J=1 to LenL2:lcdout L2[j]:next J
   GOSUB LINE2
   For J=1 to LenL1:lcdout L1[j]:Next J
   for J=0 To Lenl1:L2[j]=l1[j]:Next J
 goto LOOP
 
HOME:   LCDOUT $FE,1:Return
LINE1:  lcdout $FE,$80:return
LINE2:  LCDOUT $FE,$C0:return
Logged

A known mistake is better than an unknown truth.
micropar
Active Member
***
Offline Offline

Posts: 173

Thank You
-Given: 44
-Receive: 13


« Reply #11 on: July 21, 2008, 05:19:06 05:19 »

Hi maddoc,

Quote
In my displays I emulate the Matrix Orbital protocol, it helps me connect the LCD with diverse software on the computer (LCDSmartie for instance - displays system stats).

Thanks for the above code. But which compiler is needed to compiler you code?

Regards with thanks in advance,
--micropar--
Logged
pickit2
Moderator
Hero Member
*****
Offline Offline

Posts: 3816

Thank You
-Given: 567
-Receive: 2049


There is no evidence that I muted SoNsIvRi


« Reply #12 on: July 27, 2008, 02:57:57 14:57 »

maddoc is using proton for code.
Logged

Note: If you have no posts other than, I want or reporting a dead link Then you can't complain If I remove your post So Stop Leeching
raidera
Newbie
*
Offline Offline

Posts: 24

Thank You
-Given: 5
-Receive: 2


« Reply #13 on: February 22, 2010, 10:04:30 10:04 »

In my displays I emulate the Matrix Orbital protocol, it helps me connect the LCD with diverse software on the computer (LCDSmartie for instance - displays system stats).

Code:
DEVICE 16F877
DECLARE XTAL 20
CONFIG HS_OSC,WDT_OFF,PWRTE_ON,LVP_OFF,CP_OFF,BODEN_OFF,DEBUG_OFF,WRTE_ON,CPD_OFF
ALL_DIGITAL=TRUE

TRISB = %00000000       ' PORTB OUTPUT
TRISD = %00000000
LOW PORTB
LOW PORTD
LOW PORTC.1  'BACKLIGHT
LOW PORTC.2  'CONTRAST


HSERIAL_BAUD = 19200 ' Set baud rate
HSERIAL_RCSTA = %10010000 ' Enable serial port and continuous receive
HSERIAL_TXSTA = %00100100 ' Enable transmit and asynchronous mode
HSERIAL_CLEAR = ON ' Optionally clear the buffer before receiving


SYMBOL PRT PORTB 'D0-7 = PORTB0-7
SYMBOL E1 PORTD.7 'E1
SYMBOL RW PORTD.6 'RW
SYMBOL RS PORTD.5 'RS
SYMBOL E2 PORTD.4 'E2


EDATA "              MadDOC's LCD              "
EDATA "                                        "
EDATA "                                        "
EDATA "             LCD rev. 0.9               "


DIM C AS BYTE
DIM X AS BYTE
DIM B AS BYTE
DIM CMND AS BYTE
DIM COL AS BYTE
DIM ROW AS BYTE
DIM FLAG AS BYTE
DIM BL AS BYTE          'Backlight
DIM CNT AS BYTE        'Contrast
BL = 80
CNT = 80

'===========================================================================

GOSUB INIT
GOSUB LCDCLEAR

FOR X = 0 TO 79
C = EREAD X
GOSUB WC1
NEXT
FOR X = 80 TO 159
C = EREAD X
GOSUB WC2
NEXT
GOSUB LCDHOME

HPWM 1, CNT, 2000
HPWM 2, BL, 2000

GOTO MAIN  

'============================================================================

MAIN:
C = HRSIN  
IF C <> $FE THEN
   IF FLAG = 1 THEN
   GOSUB CB
LOW RW
HIGH RS
DELAYUS 45
PRT = C
HIGH E1
DELAYUS 45
LOW E1
LOW RS
   ELSE
   GOSUB CB
LOW RW
HIGH RS
DELAYUS 45
PRT = C
HIGH E2
DELAYUS 45
LOW E2
LOW RS
   ENDIF
ELSE
CMND = HRSIN
SELECT CMND

CASE 71   'POSITION COMMAND
 COL = HRSIN
 ROW = HRSIN
 IF ROW = 1 THEN
      C = 127 + COL
FLAG = 1
 ELSEIF ROW = 2 THEN
      C = 191 + COL
FLAG = 1
     ELSEIF ROW = 3 THEN
      C = 127 + COL
FLAG = 2
 ELSE
  C = 191 + COL
FLAG = 2
 ENDIF
 LOW RS
 LOW RW
 IF FLAG = 1 THEN
 GOSUB WB1
 ELSE
 GOSUB WB2
 ENDIF

CASE 78         'CUSTOM CHARACTER
 C = (HRSIN * 8) + 64
    GOSUB WB
 FOR X = 0 TO 7
 C = HRSIN
   HIGH RS
 GOSUB WB
 NEXT
 LOW RS

CASE 88     'CLEAR DISPLAY
    GOSUB LCDCLEAR
 
CASE 72     'HOME POSITION
    GOSUB LCDHOME

CASE 66     'BL ON, TIME
 X = HRSIN
 HPWM 2, BL, 2000

CASE 70     'BL OFF
 HPWM 2, 0, 2000


CASE 153   'BRIGHTNESS 153
 BL = HRSIN
 HPWM 2, BL, 2000  


CASE 152     'BRIGHTNESS + SAVE
 BL = HRSIN
 HPWM 2, BL, 2000
 

CASE 145     'CONTRAST + SAVE 145
 CNT = HRSIN
 HPWM 1, CNT, 2000

 
CASE 80   'CONTRAST
 CNT = HRSIN
 HPWM 1, CNT, 2000


CASE 55         'DISPLAY TYPE LK404-55
 HRSOUT $0A
 
CASE 54
 HRSOUT "0.9"

ENDSELECT
ENDIF
GOTO MAIN


'Other Display commands supported by MO displays
'147 SET REMEMBER
'86 GPO OFF
'87 GPO ON
'76 CURSOR LEFT
'77 CURSOR RIGHT
'51 SET I2C ADDRESS
'55 READ MODULE TYPE 0x0A 4x40
'57 SET RS-232 SPEED
'52 SET SERIAL NUMBER
'53 READ SERIAL NUMBER
'54 READ VERSION NUMBER
'51 AUTOSCROLL ON
'52 AUTOSCROLL OFF
'74 UNDERLINE ON
'75 UNDERLINE OFF
'83 BLOCK CURS ON
'84 BLOCK CURS OFF
'64 STORE STARTUP SCREEN

WB:     'WRITE BYTES
DELAYUS 45
PRT = C
HIGH E1
HIGH E2
DELAYUS 45
LOW E1
LOW E2
RETURN

WB1:     'WRITE BYTE 1
DELAYUS 45
PRT = C
HIGH E1
DELAYUS 45
LOW E1
RETURN

WC1:   'WRITE CHAR 1
GOSUB CB
LOW RW
HIGH RS
GOSUB WB1
LOW RS
RETURN

WB2:   'WRITE BYTE 2
DELAYUS 45
PRT = C
HIGH E2
DELAYUS 45
LOW E2
RETURN

WC2:   'WRITE CHAR 2
GOSUB CB
LOW RW
HIGH RS
GOSUB WB2
LOW RS
RETURN

LCDCLEAR: 'LCD CLEAR THEN HOME
GOSUB CB
LOW RS
LOW RW
C = %00000001
GOSUB WB
RETURN

LCDHOME: 'LCD HOME
GOSUB CB
C = %00000010
GOSUB WB
FLAG = 1
RETURN

CB:       'CHECK BUSY
TRISB = %11111111
LOW RS
HIGH RW
HIGH E1
DELAYUS 50
B = PRT
LOW E1
IF B > %01111111 THEN GOTO CB
LOW RW
TRISB = %00000000
RETURN

INIT:     'INIT
DELAYMS 100
C = %00111000
GOSUB WB
C = %00001100
GOSUB WB
C = %00000001
GOSUB WB
DELAYMS 2
C = %00000110
GOSUB WB
RETURN

END ' END OF PROGRAM

could you post circuits and .hex file of yours LCD`s and have you develop USB connection to PC witch works with LCDSmartie?
« Last Edit: February 22, 2010, 10:07:09 10:07 by raidera » Logged
pickit2
Moderator
Hero Member
*****
Offline Offline

Posts: 3816

Thank You
-Given: 567
-Receive: 2049


There is no evidence that I muted SoNsIvRi


« Reply #14 on: February 22, 2010, 12:52:26 12:52 »

you could build it in proteus and test it with slcd.hex in rar attachment slcd.rar
Logged

Note: If you have no posts other than, I want or reporting a dead link Then you can't complain If I remove your post So Stop Leeching
raidera
Newbie
*
Offline Offline

Posts: 24

Thank You
-Given: 5
-Receive: 2


« Reply #15 on: February 23, 2010, 08:22:06 08:22 »

yes I could, but I don't have circuit diagram
Logged
bbarney
Moderator
Hero Member
*****
Offline Offline

Posts: 2403

Thank You
-Given: 405
-Receive: 544


Uhm? where did pickit put my mute button


« Reply #16 on: February 23, 2010, 05:19:10 17:19 »

try here
http://lcdsmartie.sourceforge.net/circuits.htm
Logged

Ever wonder why Kamikaze pilot's wore helmet's ?
raidera
Newbie
*
Offline Offline

Posts: 24

Thank You
-Given: 5
-Receive: 2


« Reply #17 on: February 24, 2010, 09:47:11 09:47 »

yes,
but I need circuit for connections between LCD and the PIC, witch is connected to Serial port on the PC
Logged
oldvan
V.I.P
Senior Member
*****
Offline Offline

Posts: 375

Thank You
-Given: 152
-Receive: 106


If the van is a Rockin'...


WWW
« Reply #18 on: February 24, 2010, 10:38:53 10:38 »

yes, but I need circuit for connections between LCD and the PIC, witch is connected to Serial port on the PC

The connections from the PIC to the LCD are detailed in the code:
Code:
LOW PORTC.1 'BACKLIGHT
LOW PORTC.2 'CONTRAST
...
SYMBOL PRT PORTB 'D0-7 = PORTB0-7
SYMBOL E1 PORTD.7 'E1
SYMBOL RW PORTD.6 'RW
SYMBOL RS PORTD.5 'RS
SYMBOL E2 PORTD.4 'E2

Those plus the datasheet for the PIC and the one for your LCD should get you out of the woods.
Logged

Give a man a fish and you feed him for a day.
Teach a man to fish and he will sit around in a boat drinking beer all day.
raidera
Newbie
*
Offline Offline

Posts: 24

Thank You
-Given: 5
-Receive: 2


« Reply #19 on: February 24, 2010, 11:35:09 11:35 »

OK that right,
but in circuit must have other elements around the PIC and RS232 communication
Logged
SpaleKG
Junior Member
**
 Muted
Offline Offline

Posts: 38

Thank You
-Given: 16
-Receive: 15


« Reply #20 on: February 26, 2010, 07:22:10 19:22 »

OK that right,
but in circuit must have other elements around the PIC and RS232 communication

try this:
http://www.mikroe.com/pdf/easypic6/easypic6_schematic_v101.pdf

In this schematic you can see how to connect PIC to RS232 by using MAX202,
also you can see how to connect display (LCD 4bit or 8bit or GLCD) to PIC. It is very easy.

RS232 connection is on 1st page at upper left corner.
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC