Cześć wszystkim
Mam ogromną prośbę o pomoc w sprawie otwierania obrazków w formacie *.bgc ktore beda umieszczone na karcie pamięci i atmega ma je otwierać i wyświetlać na kolorowym lcd . Probowałem już kilka różnych sposobów ale za każdym razem obrazek się nie wyswietlał poprawnie . Serdecznie pozdrawiam Bartek
Nizej kod programu do obslugi karty sd i kolorowego lcd
Mam ogromną prośbę o pomoc w sprawie otwierania obrazków w formacie *.bgc ktore beda umieszczone na karcie pamięci i atmega ma je otwierać i wyświetlać na kolorowym lcd . Probowałem już kilka różnych sposobów ale za każdym razem obrazek się nie wyswietlał poprawnie . Serdecznie pozdrawiam Bartek
Nizej kod programu do obslugi karty sd i kolorowego lcd
$regfile = "m32def.dat"
$crystal = 8000000
$lib "Lcd-pcf8833.lbx " 'special color display support '8 MHz
Config Graphlcd = Color , Controlport = Portc , Cs = 3 , Rs = 2 , Scl = 0 , Sda = 1
Const Blue = &B00000011 'predefined contants are making programming easier
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
Glcdcmd &H36 'Mem_control
Glcddata &H48 'My=0 Mx=0 V=1 Lao=1 Rbg=0 "00110000"
Glcdcmd &H21
Config Clock = Soft
Config Date = Mdy , Separator = /
Time$ = "00:00:00"
Date$ = "01/01/10"
Config Watchdog = 2048
Config Timer1 = Pwm , Pwm = 8 , Compare A Pwm = Clear Down , Compare B Pwm = Clear Down , Prescale = 1
Start Timer1
Pwm1a = 150
Cls
$include "CONFIG_AVR-DOS.Bas"
'$include "AVR-DOS.LBX"
'---SPI-HW----------------------------------------------------------------------
Const Cmmc_soft = 0 'SPI HARDWARE
' define Chip-Select Pin
Config Pinb.4 = Output ' define here Pin for CS of MMC/SD Card
Mmc_cs Alias Portb.4
Set Mmc_cs
' Define here SS Pin of HW-SPI of the CPU (f.e. Pinb.0 on M128)
Config Pinb.7 = Output ' define here Pin of SPI SS
Spi_ss Alias Portb.7
Set Spi_ss ' Set SPI-SS to Output and High por Proper work of
' SPI as Master
' HW-SPI is configured to highest Speed
Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = High , Phase = 1 , Clockrate = 4 , Noss = 1 'Config Spi = Soft , Din = Pinb.3 , Dout = Portb.2 , Ss = Portb.0 , Clock = Portb.1
Spsr.0 = 1 ' Double speed on ATMega128
Spiinit ' Init SPI
'Spiinit
' Error
Const Cperrdrivereset = 225 ' Error response Byte at Reset command
Const Cperrdriveinit = 226 ' Error response Byte at Init Command
Const Cperrdrivereadcommand = 227 ' Error response Byte at Read Command
Const Cperrdrivewritecommand = 228 ' Error response Byte at Write Command
Const Cperrdrivereadresponse = 229 ' No Data response Byte from MMC at Read
Const Cperrdrivewriteresponse = 230 ' No Data response Byte from MMC at Write
Const Cperrdrive = 231
Const Cperrdrivenotsupported = 232 ' return code for DriveGetIdentity, not supported yet
Waitms 700
Dim Gbdriveerror As Byte ' General Driver Error register
Dim Gbdriveerrorreg As Byte ' Driver load Error-Register of HD in case of error
Dim Gbdrivestatusreg As Byte ' Driver load Status-Register of HD on case of error
Dim Gbdrivedebug As Byte
Dim B As Word
Dim C As Word
Dim S As String * 96
S = Dir( " * .txt")
$lib "MMC.LIB" ' link driver library
$external _mmc
Enable Interrupts
Box(0 , 0) -(130 , 130) , Blue
Gbdriveerror = Driveinit()
B = Initfilesystem(1)
C = Drivecheck()
'start watchdog
Dim Rozmiar As Long
Rozmiar = Disksize() \ 1000
Dim Wolne As Long
Wolne = Diskfree() \ 1000
Setfont Color8x8
Cls
Box(0 , 0) -(130 , 130) , Blue
If B > 0 Then Lcdat 50 , 10 , "Sprawdz KarteSD" , Darkred , White
Lcdat , 10 , 2 , "AVR-DOS v 2.0" , Black , White
Lcdat , 20 , 2 , "Atmega 32-16PU " , Black , White
Lcdat , 30 , 2 , "CPU at 8 Mhz" , Black , White
Lcdat , 40 , 2 , "Ram size : 2 KB" , Black , White
Lcdat , 50 , 2 , "LCD PCF-8833" , Black , White
Lcdat , 60 , 2 , "Karta SD info" , Black , White
Lcdat , 70 , 2 , "Rozmiar: " ; Rozmiar ; " MB" , Black , White
Lcdat , 80 , 2 , "Wolne : " ; Wolne ; " MB" , Black , White
Lcdat , 90 , 2 , "System OK" , Black , White
End