Witam.
Jako że znalazłem w swoich zbiorach stary wyświetlacz po siemensie c60 motywowany jednym z tematów na tym forum postanowiłem połączyć owy wyświetlacz z atmega8.
Układ na szybko połączyłem według tego schematu:
Jako że nie miałem styczności z tego typu wyświetlaczami więc wsad do procka zaczerpnąłem z innego postu. Trochę go skróciłem i pozmieniałem by się zmieścił do atmegi8 bo docelowo był na atmege32.
Problem w tym, że prócz niebieskiego ekranu nic nie widać... Tak jakby nie było komunikacji. Program napisany w Bascomie.
O to kod:
Jako że znalazłem w swoich zbiorach stary wyświetlacz po siemensie c60 motywowany jednym z tematów na tym forum postanowiłem połączyć owy wyświetlacz z atmega8.
Układ na szybko połączyłem według tego schematu:
Jako że nie miałem styczności z tego typu wyświetlaczami więc wsad do procka zaczerpnąłem z innego postu. Trochę go skróciłem i pozmieniałem by się zmieścił do atmegi8 bo docelowo był na atmege32.
Problem w tym, że prócz niebieskiego ekranu nic nie widać... Tak jakby nie było komunikacji. Program napisany w Bascomie.
O to kod:
$regfile = "m8def.Dat"
$crystal = 8000000
'=== Config the hardware ===
Rs Alias Portd.7 'S65 Data/command pin
Res Alias Portd.6 'S65 Reset pin
Cs Alias Portd.5 'S65 Chip Select pin
Clk Alias Portb.5 'S65 Clock pin
Dat Alias Portb.3 'S65 Data pin
Config Rs = Output
Config Dat = Output
Config Cs = Output
Config Clk = Output
Config Res = Output
Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = Low , Phase = 0 , Clockrate = 128
'=== Define the constante ===
Const Blue = &B00000011 '8bit color RRRGGGBB
Const Yellow = &B11111100
Const Red = &B11100000
Const Green = &B00011100
Const Black = &B00000000
Const White = &B11111111
Const Brightgreen = &B00111110
Const Darkgreen = &B00010100
Const Darkred = &B10100000
Const Darkblue = &B00000010
Const Brightblue = &B00011111
Const Orange = &B11111000
Const Displaysize_x = 101
Const Displaysize_y = 80
Const Total_pixels = Displaysize_x * Displaysize_y
Const Landscape = 1 'Change to 0 if you want to use the display in portrait
Declare Sub Lcdtext(byval S As String , Byval Xoffset As Byte , Byval Yoffset As Byte , Byval Fontset As Byte , Byval Forecolor As Byte , Byval Backcolor As Byte )
Dim C0 As Single
Dim C1 As Single
Dim Y_w0 As Byte
Dim Y_w1 As Byte
Dim X As Byte
Dim Y As Byte
Dim Yh As Byte
Dim Ad0 As Word
Dim Ad1 As Word
Dim Ad_help As Single
Dim Ad_wyn0 As String * 4
Dim Ad_wyn1 As String * 4
'=== Main prog === 'First thing to do, init the display 'Clear the display with white background
Lcdtext "Program Testowy" , 5 , 1 , 1 , Red , White
Lcdtext "SIEMENS" , 5 , 12 , 1 , Black , Orange
Lcdtext "S-65 LCD" , 5 , 23 , 2 , Blue , White
Lcdtext "Dominik Packi v1.1" , 5 , 50 , 4 , Black , White
Lcdtext "Mini-oscyloskop" , 5 , 60 , 4 , Black , White
Wait 2
Delay 'FIRST restore you image before you can show it 'Show your image
Wait 2
'=== Subroutines ===
Sub Lcdtext(byval S As String , Xoffset As Byte , Yoffset As Byte , Fontset As Byte , Forecolor As Byte , Backcolor As Byte ) 'Print text on the display
Local Tempstring As String * 1 , Temp As Byte 'Dim local the variables
Local A As Byte , Pixels As Byte , Count As Byte , Carcount As Byte , Lus As Byte
Local Row As Byte , Byteseach As Byte , Blocksize As Byte , Dummy As Byte
Local Colums As Byte , Columcount As Byte , Rowcount As Byte , Stringsize As Byte
Local Xpos As Byte , Ypos As Byte , Pixel As Byte , Pixelcount As Byte
Stringsize = Len(s) - 1 'Size of the text string -1 because we must start with 0
For Carcount = 0 To Stringsize 'Loop for the numbers of caracters that must be displayed
If Fontset = 1 Then Restore Font8x8 'Add or remove here fontset's that you need or not,
If Fontset = 2 Then Restore Font16x16 'this is the name that you gave to the font, NOT the filename
If Fontset = 3 Then Restore Font6x8 'If you dont know the name, open the font file in wordpad, and there it is,
If Fontset = 4 Then Restore Font5x5 'right on top.
Temp = Carcount + 1 'Cut the text string in seperate caracters
Tempstring = Mid(s , Temp , 1)
Read Row : Read Byteseach : Read Blocksize : Read Dummy 'Read the first 4 bytes from the font file
Temp = Asc(tempstring) - 32 'Font files start with caracter 32
For Lus = 1 To Temp 'Do dummie read to point to the correct line in the fontfile
For Count = 1 To Blocksize
Read Pixels
Next Count
Next Lus
Colums = Blocksize / Row 'Calculate the numbers of colums
Row = Row * 8 'Row is always 8 pixels high = 1 byte, so working with row in steps of 8.
Row = Row - 1 'Want to start with row=0 instead of 1
Colums = Colums - 1 'Same for the colums
For Rowcount = 0 To Row Step 8 'Loop for numbers of rows
A = Rowcount + Yoffset
For Columcount = 0 To Colums 'Loop for numbers of Colums
Read Pixels
Xpos = Columcount 'Do some calculation to get the caracter on the correct Xposition
Temp = Carcount * Byteseach
Xpos = Xpos + Temp
Xpos = Xpos + Xoffset
For Pixelcount = 0 To 7 'Loop for 8 pixels to be set or not
Ypos = A + Pixelcount 'Each pixel on his own spot
Pixel = Pixels.0 'Set the pixel (or not)
If Pixel = 1 Then
Pixel = Forecolor
Else
Pixel = Backcolor
End If
Shift Pixels , Right 'Shift the byte 1 bit to the right so the next pixel comes availible
Next Pixelcount
Next Columcount
Next Rowcount
Next Carcount
End Sub 'End of this amazing subroutine
'=== Includes ===
$include "Font8x8.font" 'Includes here your font files
$include "Font16x16.font" 'If you don't need the files in your program, don't include them,
$include "Font6x8.font" 'these are flash memory eaters.
$include "Font5x5.font"