<h1>THE FORUM HAS MOVED,  VISIT US AT OUR NEW SITE www.picbasic.org. Access to this Archive is restricted. Visit the NEW site at www.picbasic.org.  Unless you use the url http://www.picbasic.org you will not gain access to the support forum, wiki and knowledge base. Visit WWW.PICBASIC.ORG  Do not try to log in or register here, use your keyboard and enter the url http://www.picbasic.org directly into your browser. </h1>  

Go Back  

THE FORUM HAS MOVED, VISIT US AT OUR NEW SITE www.picbasic.org. Access to this Archive is restricted. Visit the NEW site at www.picbasic.org. Unless you use the url http://www.picbasic.org you will not gain access to the support forum, wiki and knowledge base. Visit WWW.PICBASIC.ORG Do not try to log in or register here, use your keyboard and enter the url http://www.picbasic.org directly into your browser.

> Proton Development Suite > Proton Plus Compiler v3

Proton Plus Compiler v3 Coding problems and general discussion related to the Development Suite

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 3rd February 2010, 17:11   #1
jezsmith
Licensed User
 
Join Date: Sep 2004
Location: E.Yorkshire
Posts: 76
jezsmith is on a distinguished road
Default ea dog graphic lcd

Hi,

I have come across a low cost reflective graphic (EA DOGXL160-7) LCD 160 x 104 res with UC1610 serail/I2c controller, touch screen, 3.3v and has very low profile. Has any one used one of these with pic basic who could speed my flight instrument project up with a few pointers.

regards
Jez
jezsmith is offline   Reply With Quote
Old 6th February 2010, 16:30   #2
davidsgr
Licensed User
 
Join Date: Jul 2009
Location: athens
Posts: 74
davidsgr is on a distinguished road
Send a message via MSN to davidsgr Send a message via Skype™ to davidsgr
Default

link with specs???
davidsgr is offline   Reply With Quote
Old 6th February 2010, 17:01   #3
billyminor
Licensed User
 
Join Date: May 2007
Location: Canada
Posts: 516
billyminor is on a distinguished road
Default

http://www.lcd-module.com/products/dog.html
billyminor is offline   Reply With Quote
Old 6th February 2010, 17:08   #4
davidsgr
Licensed User
 
Join Date: Jul 2009
Location: athens
Posts: 74
davidsgr is on a distinguished road
Send a message via MSN to davidsgr Send a message via Skype™ to davidsgr
Default

try the 2 wire serial to send datas from pic use the schematic from the pdf and make the tests if you need code for the touch ask it and i will post it


http://www.lcd-module.com/eng/pdf/gr...ogxl160-7e.pdf
davidsgr is offline   Reply With Quote
Old 7th February 2010, 17:01   #5
jezsmith
Licensed User
 
Join Date: Sep 2004
Location: E.Yorkshire
Posts: 76
jezsmith is on a distinguished road
Default

no worries guys
Its not arrived yet but reading the data I think I will be able to fire it up. I will see how I get on and post the results good or bad. Dave I would appreciate an assist with the touch screen code as I have not used one before and I am looking at using touch for all control aspects.
cheers
Jez
jezsmith is offline   Reply With Quote
Old 7th February 2010, 19:50   #6
davidsgr
Licensed User
 
Join Date: Jul 2009
Location: athens
Posts: 74
davidsgr is on a distinguished road
Send a message via MSN to davidsgr Send a message via Skype™ to davidsgr
Default

I have attached a part of code with the EA DIP240J-7KLWTP glcd display from the same manifacturer and it is working directly without touch controller it has virtual keyboard function and 4 points callibration
(this is from my machine and this touch has pass all the emc tests without any problem )
this code is from this forum users collected informations and belong to all of us !!!!!
if anyone need extra informations about the touch it will be my pleasure to help...!!!

http://www.lcd-module.de/eng/pdf/grafik/dip240-7e.pdf
Attached Files
File Type: txt touch.txt (21.0 KB, 55 views)
davidsgr is offline   Reply With Quote
Old 8th February 2010, 16:16   #7
jezsmith
Licensed User
 
Join Date: Sep 2004
Location: E.Yorkshire
Posts: 76
jezsmith is on a distinguished road
Default

dave,
thanks, this code looks just what i am after, the LCD is about ten days delivery so I'll crack on with the non screen stuff. I will let you know how it goes when it comes
cheers
Jez
jezsmith is offline   Reply With Quote
Old 8th February 2010, 17:07   #8
billyminor
Licensed User
 
Join Date: May 2007
Location: Canada
Posts: 516
billyminor is on a distinguished road
Default

this might be useful to you too

http://www.mikroe.com/en/article/dow..._pic_01_09.pdf
billyminor is offline   Reply With Quote
Old 8th February 2010, 20:09   #9
jezsmith
Licensed User
 
Join Date: Sep 2004
Location: E.Yorkshire
Posts: 76
jezsmith is on a distinguished road
Default

brian,
thanks
jez
jezsmith is offline   Reply With Quote
Old 11th February 2010, 22:04   #10
jezsmith
Licensed User
 
Join Date: Sep 2004
Location: E.Yorkshire
Posts: 76
jezsmith is on a distinguished road
Default

HI,

I have recieve said display today , I have figured I need to write a few functions to make it usable such as clear the screen print at etc. I have little experience in this area but have managed to read the data sheets and managed to get it working pretty easily. after it initialises it has random pixels all over so I gather a CLS is required to clear the RAM. I have managed to select the starting page and colum address and can clear a single page but how do you iincrement the page number because the page numbers 0 to 31 are derived from the last five bits? bits 7,6 and 5 are always 011 and bits 4-0 i need to increment in loop I reckon.

cheers
Jez
Code:
Device = 18F2525
Xtal = 8
All_Digital = true

Dim initialise As Byte
Dim index As Byte

Symbol CD = PORTC.7
Symbol CS = PORTC.6
Symbol DTA = PORTC.5
Symbol CLK = PORTC.4

       
Init_LCD:
    Low CD
      
    Low CS
         Low PORTB.5
        SHOut DTA,CLK, msbfirst, [$F1] 'Set last COM electrode To 103
        DelayMS 30
         SHOut DTA,CLK, msbfirst, [$67]'Set last COM electrode To 103
        DelayMS 30
         SHOut DTA,CLK, msbfirst, [$C0] 'SEG (column) And COM (row) normal
        DelayMS 30
         SHOut DTA,CLK, msbfirst, [$40] 'Set Display Startline To 0 LSB
        DelayMS 30
         SHOut DTA,CLK, msbfirst, [$50] 'Set Display Startline To 0 MSB
        DelayMS 30
         SHOut DTA,CLK, msbfirst, [$2B]  'Set Panelloading To 28..38nF
        DelayMS 30
         SHOut DTA,CLK, msbfirst, [$EB] 'set bias
        DelayMS 30
         SHOut DTA,CLK, msbfirst, [$81] 'set contrast
        DelayMS 30
         SHOut DTA,CLK, msbfirst, [$5F] 'set contrast
        DelayMS 30
         SHOut DTA,CLK, msbfirst, [$89] 'set aut increment
        DelayMS 30
         SHOut DTA,CLK, msbfirst, [$AF] 'display on
        DelayMS 30
         SHOut DTA,CLK, msbfirst, [$A4] 'set all pixels on but i have this off!!!!
        DelayMS 30
    High CS    
        DelayMS 500
        High PORTB.5     'just let me know its done all this
        
     Low CS   
              SHOut DTA,CLK, msbfirst, [$60] 'page address   0 to 31
        DelayMS 30 
         SHOut DTA,CLK, msbfirst, [$00] 'column address LSB      thinks these start at top left
         DelayMS 30
               SHOut DTA,CLK, msbfirst, [$10] 'column address MSB .... no idea why it needs two????
     High CS

High CD

 For index = 0 To 158   'display is 160 x 104 
 Low CS
       SHOut DTA,CLK, msbfirst, [$00] 'sets pixel to off
 High CS      
Next index
Low CD
Stop
jezsmith is offline   Reply With Quote
Old 11th February 2010, 23:15   #11
davidsgr
Licensed User
 
Join Date: Jul 2009
Location: athens
Posts: 74
davidsgr is on a distinguished road
Send a message via MSN to davidsgr Send a message via Skype™ to davidsgr
Default

how you controll the clock frequency????
davidsgr is offline   Reply With Quote
Old 12th February 2010, 09:57   #12
jezsmith
Licensed User
 
Join Date: Sep 2004
Location: E.Yorkshire
Posts: 76
jezsmith is on a distinguished road
Default

David,


Page 382 In the shin/shout command ref "will generate the clock signal on the clock pin" to collect the data. I reckon its right because the screen is working ok and I can send commands to clear a line of pages of which there are 31 . Next I would like to write a routine to clear the whole screen . A for next loop will do it but struggling a little on how to increment the page numbers which are in hex ,may be I need to convert to dec ? .Then a Print At type command, Any help I can get on this one would be appreciated. The LCD looks great the extra size and very low profile makes all the difference over my 128x64 without being to big. Its low power as well my whole test circuit eats just 3.5ma so I have got to get this thing working.

cheers
Jez
jezsmith is offline   Reply With Quote
Old 12th February 2010, 14:15   #13
davidsgr
Licensed User
 
Join Date: Jul 2009
Location: athens
Posts: 74
davidsgr is on a distinguished road
Send a message via MSN to davidsgr Send a message via Skype™ to davidsgr
Default

in theory everybody can tell you everything send me the part nr of your screen i will order one to make my tests and we will work in this together mabie it fits with my machine i have buy a lot of parts and some has help me in the past mabie this will help me ....!!!!!
davidsgr is offline   Reply With Quote
Old 12th February 2010, 20:53   #14
jezsmith
Licensed User
 
Join Date: Sep 2004
Location: E.Yorkshire
Posts: 76
jezsmith is on a distinguished road
Default

The LCD is a EA DOGXL 160 -7 160x104 UC1610 Yellow/Green refective. Managed a clear screen routine. If any one could set me off in the right direction in providing a print routine prehaps with a font table I would be abliged.

jez


Code:
Device = 18F2525
Xtal = 8
All_Digital = true

Dim initialise As Byte
Dim index As Byte    ' dim for column selecting
Dim lcd_page As Byte ' dim for page increments
Dim page_index As Byte

Symbol CD = PORTC.7
Symbol CS = PORTC.6
Symbol DTA = PORTC.5
Symbol CLK = PORTC.4


Main:
GoSub Init_LCD  
GoSub Clear_Screen

Stop 
          
          
          
Init_LCD:
    Low CD  ' Prepare LCD for command send
      
    Low CS  ' select LCD
         Low PORTB.5
        SHOut DTA,CLK, msbfirst, [$F1]  '$F1  'Set last COM electrode To 103
        DelayMS 30
         SHOut DTA,CLK, msbfirst, [$67]  '$67  'Set last COM electrode To 103
        DelayMS 30
         SHOut DTA,CLK, msbfirst, [$C0]  '$C0  'SEG (column) And COM (row) normal
        DelayMS 30
         SHOut DTA,CLK, msbfirst, [$40]  '$40  'Set Display Startline To 0 LSB
        DelayMS 30
         SHOut DTA,CLK, msbfirst, [$50] '$50  'Set Display Startline To 0 MSB
        DelayMS 30
         SHOut DTA,CLK, msbfirst, [$2B] '$2B  'Set Panelloading To 28..38nF
        DelayMS 30
         SHOut DTA,CLK, msbfirst, [$EB] '$EB  'Set Bias
        DelayMS 30
         SHOut DTA,CLK, msbfirst, [$81]  '$81  'Set Contrast
        DelayMS 30
         SHOut DTA,CLK, msbfirst, [$5F] '$5f  'Set Contrast
        DelayMS 30
         SHOut DTA,CLK, msbfirst, [$89] '$89  'Set Auto-Increment
        DelayMS 30
         SHOut DTA,CLK, msbfirst, [$AF] '$AF  'Display On	
        DelayMS 30

    High CS             ' de selects LCD
        
        High PORTB.5    ' just lets me knoe the code above has run OK
 Return
 
 
'********************************CLEAR SCREEN ***********************************
' this function clears the screen by selecting each row in turn and setting each
' pixel to zero in each row, then it selects the next row and so on
'********************************************************************************
Clear_Screen:
Low CD                                      'prepare LCD for command send
For page_index = 0 To 25                    ' 0 - 25 pages on screen
    lcd_page  = LookUp page_index,[96,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120] ' these are the column page addresses 0-25
    Low CS
    SHOut DTA,CLK, msbfirst, [lcd_page\8]   'page address
    High CS                                 'de select lcd
    High CD                                 'prepare LCD for data send 
    For index = 0 To 159                    '160 columns
        Low CS                              'select lcd
        SHOut DTA,CLK, msbfirst, [$00]      'turn each pixel off in column
        High CS                             'de select lcd
    Next 
    Low CD                                  'select command send
   DelayMS 10                               'slow it down a bit
Next
Return
'*********************************************************************************
jezsmith is offline   Reply With Quote
Old 13th February 2010, 11:41   #15
DaveS
Licensed User
 
Join Date: Aug 2004
Location: North Yorkshire
Posts: 300
DaveS is on a distinguished road
Default

Hi Jez

You could adapt this http://picbasic.org/forum/showthread...ht=large+fonts
or
I might post/share some GLCD drivers I wrote for the Nokia 7110, 3310 and the Ks0108 for more than 2 screens, if I can find them.
The print routine prints any font hight or width, if I can find the most recent files, they have not been worked on for a long while.

Dave
DaveS is offline   Reply With Quote
Old 13th February 2010, 15:38   #16
jezsmith
Licensed User
 
Join Date: Sep 2004
Location: E.Yorkshire
Posts: 76
jezsmith is on a distinguished road
Default

dave,

I need to do a lot of reading to grasp how LCD controllers work, the data sheets are OK if you understand the terminology in the first place. I have managed to write a 4x4 square starting on column 1 on any page(line) I want on the screen up to now. I will look forward to seeing it evolve into text.

thanks
jez
jezsmith is offline   Reply With Quote
Old 13th February 2010, 20:23   #17
pverburg
Licensed User
 
Join Date: Jan 2004
Location: Wellington, New_Zealand
Posts: 724
pverburg is on a distinguished road
Default

Quote:
Originally Posted by DaveS View Post

I might post/share some GLCD drivers I wrote for the Nokia 7110, 3310 and the Ks0108 for more than 2 screens, if I can find them.
The print routine prints any font hight or width, if I can find the most recent files, they have not been worked on for a long while.

Dave
Something for the new web site maybe there is a lot of interest in graphic displays and drivers?

Paul V.
pverburg is offline   Reply With Quote
Old 14th February 2010, 14:36   #18
jezsmith
Licensed User
 
Join Date: Sep 2004
Location: E.Yorkshire
Posts: 76
jezsmith is on a distinguished road
Default

Hi,
After much reading. I have managed to modify some code for a nokia 3310 which seems to have a similar LCD arrangement to the UC1610. The modified code works ok and I can print text on the screen now. The text however is restricted to one row high i.e four pixels. How would I increase the size of the font and therefore use two or more rows?. Also the column address's use the LSB from one command and the MSB from another and together they address a pixel wide column. Is there a way to easily take both LSB and MSB from two seperate numbers and join them together to arrive at the X axis column?

cheers
JEz
Code:
Device = 18F2525
Xtal = 8
All_Digital = true


Dim index As Byte       'dim for column selecting
Dim lcd_page As Byte    'dim for page increments
Dim page_index As Byte  'dim for the for next loop to clear pages in clear screen routine
Dim Col_MSB As Byte     'column MSB part
Dim Col_LSB As Byte     'column LSB part
Dim LCD_Row As Byte     'selects Row 
Dim i As Byte
Dim j As Word
Dim k As Byte
Dim PosX As Byte
Dim PosY As Byte
Dim TempVar1 As Word
Dim FontCache[6] As Byte
Dim LcdStr[26] As Byte
Dim Lcd_Data As Byte
Dim char_mode As Byte


Symbol CD = PORTC.7
Symbol CS = PORTC.6
Symbol DTA = PORTC.5
Symbol CLK = PORTC.4
char_mode =1 ' have not a clue what this does yet

GoSub Init_LCD  
GoSub Clear_Screen
GoTo main

          
          
'****************************Initialise the LCD ********************************          
Init_LCD:
    Low CD              ' Prepare LCD for command send
    Low CS              ' select LCD
    Low PORTB.5         'just let me know its started
    SHOut DTA,CLK, msbfirst, [$f1,$67,$c0,$40,$50,$2b,$eb,$81,$5f,$89,$AF] 	
    High CS             ' de selects LCD
    High PORTB.5        ' just lets me knoe the code above has run OK
 Return                 'go back to old kent road
 
 
'********************************CLEAR SCREEN ***********************************
' this function clears the screen by selecting each row in turn and setting each
' pixel to zero in each row, then it selects the next row and so on
'********************************************************************************
Clear_Screen:
Low CD                                      'prepare LCD for command send
For page_index = 0 To 25                    ' 0 - 25 pages on screen or rows
    lcd_page  = LookUp page_index,[96,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121] ' these are the column page addresses 0-25
    Low CS
    SHOut DTA,CLK, msbfirst, [lcd_page\8]   'page address
    High CS                                 'de select lcd
    High CD                                 'prepare LCD for data send 
    For index = 0 To 159                    '160 columns
        Low CS                              'select lcd
        SHOut DTA,CLK, msbfirst, [$00]      'turn each pixel off in column
        High CS                             'de select lcd
    Next 
    Low CD                                  'select command send
   DelayMS 10                               'slow it down a bit
Next                                        ' increment to next row
Return                                      'go back to old kent road
'********************************************************************************* 
main:

PosY=100:GoSub Lcd_GotoXY               ' selects row dec 100 which is row 5
Str LcdStr="Test printing on Screen",0  ' loads text into string
GoSub Lcd_SentString                    

Stop

'===================================LCD SUBROUTINE=====================================
Lcd_SentByte:
  Low CS
  SHOut DTA,CLK, msbfirst, [ Lcd_Data ]
  High CS
Return
'**************************************************************************************
Lcd_SentChar:
	j=Lcd_Data * 6
	For i=0 To 5
	  Lcd_Data=CRead font1+j+i
	  If char_mode=0 Then Lcd_Data = ~Lcd_Data
	  FontCache[i]=Lcd_Data
	Next
High CD
    Low CS
	SHOut DTA,CLK, msbfirst, [ FontCache[0],FontCache[1],FontCache[2],FontCache[3],FontCache[4],FontCache[5] ]
    High CS
Return
'***********************************************************************
Lcd_SentString:
	For k=0 To 26	  ' step -1
		Lcd_Data=LcdStr[k]
		If Lcd_Data=0 Then Break
		GoSub Lcd_SentChar
	Next
Return
'************************************************************************
Lcd_GotoXY:
  Low CD 'send command
  Lcd_Data= 99 :GoSub Lcd_SentByte	'Y
  'Lcd_Data=%10000000 | PosX :GoSub Lcd_SentByte	'X
Return

'=============================================================================
' Font CDATA table
' Copy and paste this table into your own program
' If an internal font is required.
jezsmith is offline   Reply With Quote
Old 14th February 2010, 15:49   #19
DaveS
Licensed User
 
Join Date: Aug 2004
Location: North Yorkshire
Posts: 300
DaveS is on a distinguished road
Default

Hopefully you are using the Proton pre-release version as this uses the pre-proccessor, if it works let me know and I'll update the driver as I'm flying blind there.

Sorry about no text box forgot how to do them.

Dave


$define GLCD_SendData(P1) DataByte = P1 : GoSub SendBytes
' Useage GLCD_SendData(DataByte)
'************************************************* ***************************
'* Name : GLCD_Write *
'* Purpose : Write a Byte to the screen at current position *
'* : Sends 2 Formated Bytes *
'* Passed : DataByte *
'************************************************* ***************************
'GLCD_Write LineNumber, Xpos, Value

Dim LcdData[2] As Byte ' Pointer to the both pages of a column
Dim NibPos As Byte
Dim DataByteOut As Byte ' Used for bit banging
SendBytes:
LowNib = DataByte & $0F ' LSB 4 Pixels are saved to LowNib
HighNib = DataByte & $F0 ' MSB 4 Pixels are saved to HighNib
HighNib = HighNib >> 4
LcdData[0] = 0 'Zero Vars
LcdData[1] = 0 'Zero Vars
' Each Pixel in the HighNib is converted to 2 Bits, 11 Pixel On - 00 Pixel Off
If (HighNib & $01) = $01 Then LcdData[0] = LcdData[0] + $C0
If (HighNib & $02) = $02 Then LcdData[0] = LcdData[0] + $30
If (HighNib & $04) = $04 Then LcdData[0] = LcdData[0] + $0C
If (HighNib & $08) = $08 Then LcdData[0] = LcdData[0] + $03

' Each Pixel in the LowNib is converted to 2 Bits, 11 Pixel On - 00 Pixel Off
If (LowNib & $01) = $01 Then LcdData[1] = LcdData[1] + $C0
If (LowNib & $02) = $02 Then LcdData[1] = LcdData[1] + $30
If (LowNib & $04) = $04 Then LcdData[1] = LcdData[1] + $0C
If (LowNib & $08) = $08 Then LcdData[1] = LcdData[1] + $03

For NibPos = 0 To 1 ' Font Page Size 2 Pages
'NibPos - Would be different if screen fill set different
'AUTO INC ??
'YOUR CURSOR ROUTINE 'YOUR CURSOR ROUTINE 'YOUR CURSOR ROUTINE
GLCD_GoToYX(NibPos + Y_CursorPos, X_CursorPos)
' A Column that consists of two Pages is sent to the LCD
High LCD_DataOrCmdPin 'Data Mode
'Could bit bang out try after you get it workin
' DataByteOut = LcdData[NibPos]
' Low LCD_ChipSelectPin ' Chip Enabled
' GoSub GLCDSendBits
' High LCD_ChipSelectPin ' Chip Disabled
' OR
SHOut LCD_SerialDataPin,LCD_SerialClockPin, msbfirst, [LcdData[NibPos]]

Next NibPos
Return

'************************************************* ***************************
'* Name : GLCDSendBits *
'* Purpose : Write a data byte to GLCD *
'* : send 8 Bits of Data To GLCD by series bit bang *
'* Passed : DataByteOut *
'************************************************* ***************************
GLCDSendBits: '(DataByteOut)
Dim LcdDataBits As Byte

For LcdDataBits = 0 To 7
Low LCD_SerialClockPin
DelayUS 2 'DO WE NEED THIS
'Check MSB
If (DataByteOut & $80) = 0 Then
Low LCD_SerialDataPin
Else
High LCD_SerialDataPin
EndIf
High LCD_SerialClockPin
DataByteOut = DataByteOut << 1
Next

Return

Last edited by DaveS; 14th February 2010 at 15:56. Reason: wrong vars passed
DaveS is offline   Reply With Quote
Old 14th February 2010, 17:54   #20
DaveS
Licensed User
 
Join Date: Aug 2004
Location: North Yorkshire
Posts: 300
DaveS is on a distinguished road
Default

Hi Jes

Just reliased thats not what you where asking for, a method is in the converted C code I sent you.
Its a complicated one, looks like you set 4 bits then the next 4 bits on the next page down.

Dave

Code:

Symbol Page_Address = $60
Symbol Column_LSB0 = $00
Symbol Column_MSB0 = $10

'************************************************* ***************************
'* Name : GLCD_SetColumnAddress *
'* Purpose : Set/GoTo X Column position *
'* Passed : X_CursorPos *
'* Calls : ''''GLCD_SendCmd *
'************************************************* ***************************
'Dim CA As Byte
SubGLCD_SetColumnAddress: '(Byte - X_CursorPos)
Dim HighNib As Byte
Dim LowNib As Byte
Dim ColumnAddress[2] As Byte

' Seperate Command Address to low and high
LowNib = X_CursorPos & $0F
HighNib = X_CursorPos & $F0
HighNib = HighNib >> 4
' Column Adress CommandLSB = Column Address Initial Command
ColumnAddress[0] = Column_LSB0 + LowNib
' + Column Address bits 0..3
' Column Adress CommandMSB = Column Address Initial Command
ColumnAddress[1] = Column_MSB0 + HighNib
' + Column Address bits 4..7
Low LCD_DataOrCmdPin 'Command Mode
SHOut LCD_SerialDataPin,LCD_SerialClockPin, msbfirst, [ColumnAddress[0], ColumnAddress[1]]
Return

DaveS is offline   Reply With Quote
Old 14th February 2010, 19:57   #21
jezsmith
Licensed User
 
Join Date: Sep 2004
Location: E.Yorkshire
Posts: 76
jezsmith is on a distinguished road
Default

Dave,
thanks
I have managed to sort the column address problem, this code works fine I can now select any colum from 0-159 using this

Lcd_GotoXY:
Low CD ' prepare to send command
Lcd_Data= PosY :GoSub Lcd_SentByte ' page 0-25
Col_MSB = PosX >>4
Col_LSB = PosX <<4
Col_LSB = Col_LSB >>4
Col_MSB = Col_MSB + 16
Lcd_Data= Col_LSB:GoSub Lcd_SentByte ' X co-ord
Lcd_Data = Col_MSB: GoSub Lcd_SentByte ' X co-ord
Return

I am fiddling with the nible code you posted to select two pages to write as one page.

I do not fully understand your first posted nible code but I will work on it.

cheers

Jez
jezsmith is offline   Reply With Quote
Old 14th February 2010, 21:06   #22
DaveS
Licensed User
 
Join Date: Aug 2004
Location: North Yorkshire
Posts: 300
DaveS is on a distinguished road
Default

Good stuff

What I would do is try to set a byte on screen %10001111 for intance useing the code I sent you, hopefully you should get the pixels set.
Page 0
1
1
1
1
Page 1
0
0
0
1
If that works try other position and if that works you are about there.

Dave
DaveS is offline   Reply With Quote
Old 15th February 2010, 17:43   #23
jezsmith
Licensed User
 
Join Date: Sep 2004
Location: E.Yorkshire
Posts: 76
jezsmith is on a distinguished road
Default

Dave,

long day messing with fonts but finaly got a result. I can print a 7x5 font anywere on the screen. The only difficulty is the normal font table is mirrored horatontaly. Solved this by re doing font table looks good LCD has great contast. code is all a bit messy at the moment but realy have learnt al lot. \i suppose it is possible just to doulbe everything up to get a bigger font?.

regards

JEz
Code:
evice = 18F2525
Xtal = 8
All_Digital = true


Dim index As Byte       'dim for column selecting
Dim lcd_page As Byte    'dim for page increments
Dim page_index As Byte  'dim for the for next loop to clear pages in clear screen routine
Dim Col_MSB As Byte     'column MSB part
Dim Col_LSB As Byte     'column LSB part
Dim LCD_Row As Byte     'selects Row 
Dim i As Byte
Dim j As Word
Dim k As Byte
Dim PosX As Byte
Dim PosY As Byte
Dim TempVar1 As Word
Dim FontCache[6] As Byte
Dim LcdStr[26] As Byte
Dim Lcd_Data As Byte
Dim char_mode As Byte
Dim Lcd_column As Byte
Dim LcdData[2] As Byte ' Pointer to the both pages of a column 
Dim NibPos As Byte
Dim DataByteOut As Byte ' Used for bit banging
Dim DataByte As Byte ' Used for bit banging
Dim highnib As Byte
Dim lownib As Byte
Dim ColumnAddress[2] As Byte


Symbol CD = PORTC.7
Symbol CS = PORTC.6
Symbol DTA = PORTC.5
Symbol CLK = PORTC.4

char_mode =1 ' have not a clue what this does yet
LCD_Row = 100
Lcd_column = 40
NibPos = 0 'SET TO 0
GoSub Init_LCD  
GoSub Clear_Screen

'********************************************************************************* 
main:
    PosY = 100                  ' y page/row pos 0-25
    PosX = 40                   ' X column pos 0-159
    Str LcdStr="S S S S X,Y",0   'loads text into string
    GoSub Lcd_SentString        'goto string loading routine              
Stop

SendBytes: 
    lownib = DataByte & $0F     ' LSB 4 Pixels are saved to LowNib 
    highnib = DataByte & $F0    ' MSB 4 Pixels are saved to HighNib 
    highnib = highnib >> 4
    LcdData[0] = 0              'Zero Vars
    LcdData[1] = 0              'Zero Vars
' Each Pixel in the HighNib is converted to 2 Bits, 11 Pixel On - 00 Pixel Off 
    If (highnib & $01) = $01 Then LcdData[0] = LcdData[0] + $C0 
    If (highnib & $02) = $02 Then LcdData[0] = LcdData[0] + $30
    If (highnib & $04) = $04 Then LcdData[0] = LcdData[0] + $0C
    If (highnib & $08) = $08 Then LcdData[0] = LcdData[0] + $03

' Each Pixel in the LowNib is converted to 2 Bits, 11 Pixel On - 00 Pixel Off 
    If (lownib & $01) = $01 Then LcdData[1] = LcdData[1] + $C0 
    If (lownib & $02) = $02 Then LcdData[1] = LcdData[1] + $30
    If (lownib & $04) = $04 Then LcdData[1] = LcdData[1] + $0C 
    If (lownib & $08) = $08 Then LcdData[1] = LcdData[1] + $03

    

    For NibPos = 0 To 1     'Font Page Size 2 Pages 
        GoSub lcd_gotoxy    'Goto the x,y pos on screen
        High CD             'Prepare to send data
            Low CS
                SHOut DTA,CLK, msbfirst, [LcdData[NibPos]] 
            High CS
    Lcd_column = Lcd_column + NibPos  ' advances each data byte one column
   'above line needs to be here to stop bottom page stepping out one pixel messing up font  
    Next NibPos

    Return

  
          
'****************************Initialise the LCD ********************************          
Init_LCD:
    Low CD              ' Prepare LCD for command send
    Low CS              ' select LCD
    Low PORTB.5         'just let me know its started
    SHOut DTA,CLK, msbfirst, [$f1,$67,$c0,$40,$50,$2b,$eb,$81,$5f,$89,$AF] 	
    High CS             ' de selects LCD
    High PORTB.5        ' just lets me knoe the code above has run OK
 Return                 'go back to old kent road
 
 
'********************************CLEAR SCREEN ***********************************
' this function clears the screen by selecting each row in turn and setting each
' pixel to zero in each row, then it selects the next row and so on
'********************************************************************************
Clear_Screen:
Low CD                                      'prepare LCD for command send
For page_index = 0 To 25                    ' 0 - 25 pages on screen or rows
    lcd_page  = LookUp page_index,[96,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121] ' these are the column page addresses 0-25
    Low CS
    SHOut DTA,CLK, msbfirst, [lcd_page\8]   'page address
    High CS                                 'de select lcd
    High CD                                 'prepare LCD for data send 
    For index = 0 To 159                    '160 columns
        Low CS                              'select lcd
        SHOut DTA,CLK, msbfirst, [$00]      'turn each pixel off in column
        High CS                             'de select lcd
    Next 
    Low CD                                  'select command send
   DelayMS 10                               'slow it down a bit
Next                                        ' increment to next row
Return                                      'go back to old kent road

'**********************************************************************************

 lcd_gotoxy:
        
  LCD_Row = 100 + NibPos                    ' selects the row and one below it
  Col_MSB = Lcd_column >>4                  ' shifts data in MSB 4 places to right
  Col_LSB = Lcd_column <<4                  
  Col_LSB = Col_LSB >>4
  Col_MSB = Col_MSB + 16                    'need to add 16 as D4 is always 16
    Low CD
      Low CS
      SHOut DTA,CLK, msbfirst, [LCD_Row,Col_LSB,Col_MSB]   'page address is 100 col=9=(9=lsb+16=msb)
      High CS
Return
 '===================================LCD SUBROUTINE=====================================
Lcd_SentChar:
	j=DataByte * 6
	For i=0 To 5
	  DataByte=CRead Font1+j+i    
	  If char_mode=0 Then DataByte = ~DataByte
	  FontCache[i]=DataByte
	  GoSub SendBytes
	  DelayMS 10
	Next
Return
'***********************************************************************
Lcd_SentString:
	For k=0 To 26	  ' step -1
		DataByte=LcdStr[k]
		If DataByte=0 Then Break
		GoSub Lcd_SentChar
	Next
Return

'=============================================================================
' Font CDATA table
jezsmith is offline   Reply With Quote
Old 15th February 2010, 18:18   #24
DaveS
Licensed User
 
Join Date: Aug 2004
Location: North Yorkshire
Posts: 300
DaveS is on a distinguished road
Default

Jez

First - Post 22 did it display as I thought?

If the above works, you should be able to use the standard Proton Font.
Include "Font.INC"

Will look at your code, but please answer above.

Dave
DaveS is offline   Reply With Quote
Old 15th February 2010, 21:12   #25
DaveS
Licensed User
 
Join Date: Aug 2004
Location: North Yorkshire
Posts: 300
DaveS is on a distinguished road
Default

Jez

Are you still using compiler version 2.1.5, it's worth paying £37.50 +VAT to upgrade and download the pre-release version with the pre-processor, plus all the free plug-ins such as GLCD Data Mate to convert a image to data plus lots of others.


Your codes a bit hard to follow eg. the var j
But since your cracking on heres an image to try to print to screen

Good Luck

Dave


Code:

Dim AddrOfImage As Word
Dim Xpos As Byte
Dim Ypos As Byte
Dim ImageXpos As Byte
Dim ImageYpos As Byte
Dim ImageWidth As Byte
Dim ImageHeight As Byte
Dim Invert As Bit

CallPrintImage:
AddrOfImage = PDS_PUB 'Point to image data address
Ypos = 0 'ScreenPrintPos
Xpos = 0 'ScreenPrintPos
GoSub GLCDImage
Return

GLCDImage:
ImageHeight = (CRead AddrOfImage) - 1
Inc AddrOfImage

ImageWidth = (CRead AddrOfImage) - 1
Inc AddrOfImage



For ImageYpos = Ypos To (Ypos + ImageHeight) 'Number of lines
'Write a Line
LCD_Row = ImageYpos
Lcd_column = Xpos

For ImageXpos = Xpos To (Xpos + ImageWidth) 'Number of Bytes
DataByte = CRead AddrOfImage
If ImageYpos < 160 Then
If ImageXpos < 25 Then

If Invert = 1 Then DataByte = ~DataByte 'Invert Byte
LCD_Row = ImageYpos
Lcd_column = ImageYpos
GoSub lcd_gotoxy
GoSub SendBytes 'Send to LCD

EndIf
EndIf
Inc AddrOfImage
Next
Next


GoTo OverPDS_PUB

' Samsung, Vertical Direction Byte - 70x40 Pixels - Data Bytes(350)
' Graphical - 8 Pixels Per Byte

PDS_PUB:
CData $00,$00,$00,$00,$00,$80,$C0,$E0,$F0,$F0,$F8,$FC,$F C,_
$FC,$FC,$FE,$FE,$FE,$FE,$FE,$FE,$FE,$FC,$FC,$FC,$F 8,_
$F8,$F0,$E0,$E0,$C0,$C0,$40,$20,$20,$30,$10,$10,$1 8,_
$08,$08,$08,$84,$44,$24,$14,$08,$00,$00,$00,$00,$0 0,_
$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$0 0,_
$00,$00,$00,$00,$00,_ ' Y_Bytes 0
$00,$00,$F0,$FC,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$F F,_
$FF,$FF,$73,$C1,$A2,$E2,$F2,$F3,$FB,$FF,$FF,$FF,$F F,_
$FF,$FF,$FF,$FF,$FF,$FF,$FE,$FA,$C2,$42,$22,$12,$0 A,_
$06,$02,$03,$02,$02,$02,$02,$02,$02,$02,$04,$04,$0 4,_
$04,$04,$04,$04,$04,$04,$0C,$08,$08,$08,$08,$08,$1 0,_
$10,$90,$E0,$60,$40,_ ' Y_Bytes 1
$00,$00,$FF,$FF,$BF,$EF,$FF,$6F,$0B,$07,$03,$02,$0 1,_
$81,$81,$81,$80,$80,$80,$80,$00,$00,$00,$00,$00,$0 0,_
$00,$01,$01,$03,$03,$07,$07,$87,$FF,$20,$A0,$A0,$2 0,_
$20,$20,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$0 8,_
$08,$08,$08,$04,$04,$02,$02,$02,$02,$02,$01,$01,$0 1,_
$01,$01,$00,$00,$00,_ ' Y_Bytes 2
$00,$00,$00,$03,$0F,$1B,$27,$40,$80,$80,$00,$00,$0 0,_
$FF,$FF,$30,$30,$30,$31,$1F,$0F,$00,$FC,$FE,$0E,$8 E,_
$8E,$F8,$FC,$0E,$06,$07,$0F,$FD,$F8,$00,$FF,$FF,$0 6,_
$06,$86,$80,$00,$F8,$FC,$0E,$06,$06,$0E,$FC,$F8,$0 0,_
$FE,$FE,$0E,$06,$06,$0E,$FC,$F8,$00,$00,$00,$00,$0 0,_
$00,$00,$00,$00,$00,_ ' Y_Bytes 3
$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$01,$01,$0 2,_
$07,$07,$04,$04,$04,$04,$04,$04,$04,$07,$03,$03,$0 1,_
$00,$00,$01,$03,$03,$03,$03,$01,$00,$00,$03,$03,$0 3,_
$03,$03,$01,$00,$01,$03,$03,$03,$03,$03,$01,$00,$0 0,_
$03,$03,$00,$00,$00,$00,$03,$03,$00,$00,$00,$00,$0 0,_
$00,$00,$00,$00,$00 ' Y_Bytes 4

OverPDS_PUB:



DaveS is offline   Reply With Quote
Old 15th February 2010, 22:20   #26
jezsmith
Licensed User
 
Join Date: Sep 2004
Location: E.Yorkshire
Posts: 76
jezsmith is on a distinguished road
Smile

Dave,

RE post 22 yes it did what it said and displayed the byte on the screen
1
1
1
1
0
0
0
1
ALL OK, however the FONT.INC prints Horizontally mirror. As for the variable j not sure what this does yet as LCD_SentChar routine was pinched from a nokia 3310 prog, I am only guessing , that it represents the 6 bytes in the font table. If I get rid of var j it does not work. I am struggling to follow that bit of code also and such would like to get rid if I can, but for the moment it works so I am stuck with it. My compiler is 3.2.5.5 and the IDE is 1.0.4.6

cheers
Jez
jezsmith is offline   Reply With Quote
Old 15th February 2010, 22:56   #27
DaveS
Licensed User
 
Join Date: Aug 2004
Location: North Yorkshire
Posts: 300
DaveS is on a distinguished road
Default

Jez

Good, it should work with the Font.inc file theres something amiss.
Also that code I posted for an image wont work, need better tracking of the cursor position.

Upgrade to the Pre-release version in the Beta Section bottom of the main forum page and try that first code I sent you in your PM.

Also where do you buy these displays, I might buy one if cheap enough.

Dave
DaveS is offline   Reply With Quote
Old 15th February 2010, 23:26   #28
RGV250
Licensed User
 
Join Date: Aug 2005
Location: Kent.
Posts: 1,477
RGV250 is on a distinguished road
Default

Hi,
i am a little confused by this post, I have been contemplating getting one of the TFT displays from the same people. I have not looked at the display you have in depth but I think it has it's own controller on board so the way I thought it would work is you send it variables and control codes etc and it runs it's own program so you do not have to drive it that much at all. Have you used the simulator and looked at the demo programs?

Regards,
Bob
RGV250 is offline   Reply With Quote
Old 15th February 2010, 23:54   #29
RGV250
Licensed User
 
Join Date: Aug 2005
Location: Kent.
Posts: 1,477
RGV250 is on a distinguished road
Default

Hmm,
I think I am looking at the wrong display, I looked at the KIT160/7 not the DOG160/7

Regards,
Bob
RGV250 is offline   Reply With Quote
Old 16th February 2010, 09:17   #30
jezsmith
Licensed User
 
Join Date: Sep 2004
Location: E.Yorkshire
Posts: 76
jezsmith is on a distinguished road
Default

Bob,

Yes you are looking at the wrong display the one I have bought is a display on glass type with a UC1610 controller.
cheers
Jez
jezsmith is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On


Similar Threads
Thread Thread Starter Forum Replies Last Post
LCD Trouble.. KS0066 bitpick Proton Plus v2.1.5.3 General Discussion 45 7th February 2007 07:42
Pic basic plus commands Mikey Proton Plus v2.1.5.3 General Discussion 22 23rd November 2003 11:00
Graphic LCD and cable problem rsdiol Proton Plus v2.1.5.3 General Discussion 3 22nd January 2003 13:04


All times are GMT +1. The time now is 09:34.



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright © Crownhill Associates Limited 2002 - 2009