also für den mega32 habe ich folgendes geändert....
hast du die neueste Bascom version mit dem avr_dos ordner in den samples?
in config_avr_dos habe ich folgendes geändert damit es nicht soviel sram speicher braucht:
dann die datei speichern...Code:' Count of file-handles, each file-handle needs 524 Bytes of SRAM Const Cfilehandles = 1 ' [default = 2] ' Handling of FAT-Buffer in SRAM: ' 0 = FAT- and DIR-Buffer is handled in one SRAM buffer with 561 bytes ' 1 = FAT- and DIR-Buffer is handled in separate SRAM buffers with 1078 bytes ' Parameter 1 increased speed of file-handling Const Csepfathandle = 0 ' [default = 1]
in config_mmc musst du natürlich deine anschlusspins ändern und ob du hardware oder software spi nutzen willst...
datei speichern....
danach kannst du test_dos_drive öffnen und da musst du das mmc_config file einbinden damit es den richtigen karten treiber hat und die letzte zeile für den fs_interpreter auskommentieren da dies nicht auf den mega32 passt...
danach compilieren und übertragen....
dies sieht bei mir dan folgendermassen aus:
gruss bluesmashCode:$regfile = "m32def.dat" $crystal = 16000000 ' Adjust HW Stack, Soft-Stack and Frame size to 128 minimum each!!! $baud = 9600 'Open "Com1:" As Binary As #1 ' use #1 for fs_interpreter Config Clock = Soft Enable Interrupts Config Date = Mdy , Separator = . Dim Btemp1 As Byte Print "Wait for Drive" $include "Config_MMC.bas" ' Include here you driver for Compactflash/HardDisk or other '$include "Config_CompactFlash_M128.bas" ' Does drive init too '$Include "Config_HardDisk_M128.bas" If Gbdriveerror = 0 Then ' Include AVR-DOS Configuration and library $include "Config_AVR-DOS.BAS" Print "Init File System ... "; Btemp1 = Initfilesystem(1) ' Partition 1 ' use 0 for drive without Master boot record If Btemp1 <> 0 Then Print "Error: " ; Btemp1 ; " at Init file system" Else Print " OK" Print "Filesystem: " ; Gbfilesystem Print "FAT Start Sector: " ; Glfatfirstsector Print "Root Start Sector: " ; Glrootfirstsector Print "Data First Sector: " ; Gldatafirstsector Print "Max. Cluster Nummber: " ; Glmaxclusternumber Print "Sectors per Cluster: " ; Gbsectorspercluster Print "Root Entries: " ; Gwrootentries Print "Sectors per FAT: " ; Glsectorsperfat Print "Number of FATs: " ; Gbnumberoffats Print "Disksize : " ; Disksize() ' show disk size in bytes 'Print "Disk free: " ; Diskfree() Print "File Len: " ; Filelen( "TEST2.TXT") ' show free space too End If Else Print "Error during Drive Init: " ; Gbdriveerror End If 'File erstellen und etwas reinschreiben 'dim some test variables Dim S As String * 60 , Fl As String * 12 , Ff As Byte Dim X As Byte Dim I As Word Dim Sdatetime As String * 18 Fl = "test.txt" S = "test this" 'Now we are getting to it 'We can specify a file handle with #1 or #2 etc. or we can ask for a free ' file handle with the FreeFile function. It will return a free handle if there is one. Ff = Freefile() ' get a file handle 'With this file handle we refer to a file Open Fl For Output As #ff ' open fikle for output ' we need to open a file before we can use the file commands ' we open it for OUTPUT, INPUT , APPEND or BINARY ' In this case we open it for OUTPUT because we want to write to the file. ' If the file existed, the file would be overwritten. Print #ff , S ' print some data Print #ff , S Print #ff , S Print #ff , "A constant" ; S 'Testsb Ff Close #ff Print "fertig" End ' If you want to test with File-System Interpreter uncomment next line '$include "FS_Interpreter.bas"







Zitieren

Lesezeichen