Hi Gurus,
I sent an email to support about possibly providing a "Read Screen" for graphic screens so that the image can be saved in a file or sent to serial or USB or MM card. This would be useful in a project which displays built up visual data like a Oscilloscope or Logic analyser. This would allow the user to save the display to a file for latter inclusion into a document as a screen grab or just as a file (Excel CSV).
Then I thought, Support have enough on their plate with other more pressing requests.
So I dug out the data sheet for the glcdKS108 type LCDs, (in my case was a Powertip 128x64) to have a go myself, had a read, and initially seemed reasonably straight forward.
According to the data sheet which is fairly vague in it's descriptions and no examples, the idea is to
-Set the page (a page being one line, so for the 128x64 there is 8 lines, therefore 8 pages (0-7) the page being 8 pixels high
-Set the Address 0-63 and 64-128 in that line. This number is the number of bytes in that page. and there is two sides to the display 0-63
and the right 64-128. This address gets automatically incremented with each read.
-Do an enable pulse
-Do a read the data from the data port.
From what I can gather, this is how it supposed to work
Here's what I played with so far.
Near the bottom of the above code, is a representation of what I expect to see on the Terminal program.
What I get is repeating Bin 01000000
Also tried the Bascom
GLCDCMD Byte
GLCDData Byte
but both are send data routines and I couldn't get them to do the necessary command scorrectly, so reverted to bit setting and clearing directly on the ports.
Any Ideas, anyone managed to successfully do this?
[code:1:16703bc74c]
$regfile = "m32def.dat"
$crystal = 16000000
$hwstack = 20
$swstack = 60
$framesize = 20
$timeout = 10000
$lib "glcdKS108.lib"
Baud = 56000
'' ===[ Setup LCD Display ]======================================================
Config Graphlcd = 128 * 64sed , Dataport = Portc , Controlport = Portb , Ce1 = 0 , Ce2 = 1 , Cd = 2 , Rd = 3 , Reset = 4 , Enable = 5 , Mode = 6
Config Portc = Output
Config Portb = Output
Setfont Font8x8
Dim Addr As Byte
Dim Rdstatus As Byte
Statce1 Alias portb.0
Statce2 Alias Portb.1
Statdi Alias Portb.2
Statread Alias Portb.3
Statrst Alias Portb.4
Staten Alias Portb.5
'Set Enable normally low
Reset Staten
Cls
Print "PSU ready"
Lcdat 1 , 1 , "PSU Ready"
''Data Direction = Output to send data to LCD
Ddrc = 0
''======================================
''Set page
''======================================
''Page 0
Reset Statdi
Reset Statread
Portc = &B10111000
'Positive Enable pulse
Set Staten
Waitms 2
Reset Staten
waitms 1
''=======================================
''Set Addr
''=======================================
'' Address 0
Reset Statdi
Reset Statread
Portc = &B01000000
'Positive Enable pulse
Set Staten
Waitms 2
Reset Staten
Ddrc = &HFF
''=======================================
'For P = 0 To 7 'Will be the page change
For Addr = 0 To 63
Waitms 1
''Data Direction = Input to Rx data from LCD
Set Statdi
Set Statread
'Positive Enable pulse
Set Staten
Waitms 2
Reset Staten
'Read data to variable
Rdstatus = Portc
'Print to serial terminal in binary so that the image can be seen on the terminal in bit formation.
Print Bin(rdstatus )
'Should print on terminal (I Think)
' 11111111
' 00001001 | A "P" On its side.
' 00001001 |
' 00001001 |
' 00000110 /
' 00000000
' 00000000
' 00000000
'What I get
' 01000000
' 01000000 .
' 01000000
' 01000000
' 01000000
' 01000000
' 01000000
' 01000000
Next Addr
'Next P
Do
Loop
$include "font8x8.font"
[/code:1:16703bc74c]
[b:16703bc74c][color=red:16703bc74c](BASCOM-AVR version : 2.0.7.7 , Latest : 2.0.7.6 )[/b:16703bc74c][/color:16703bc74c]
↧