I'm trying to simulte an SD card in ISIS but I don't seem to be getting any where
I created an card image ust using notepad (not sure if this is the correct way) but all that happens is, It asks me to insert card so I click to close card then it just says opening file and sits there and does nothing else.
I found a 32mb image file from here tried that and it just reports file exists.
What is the best way to create a card image file. It works in real life but I really want to use ISIS (been lazy and easier
)
Wizpic
sample code:
Device 18F452
Xtal = 4
'-----------------------------------------------------------
All_Digital = TRUE
'-----------------------------------------------------------
Serial_Baud = 9600
Rsout_Pin = PORTC.6
Rsout_Mode = TRUE
Rsout_Pace = 1
Rsin_Pin = PORTC.7
Rsin_Mode = TRUE
'-----------------------------------------------------------
Dim Response As Byte
Dim SD_IO As Byte
'-----------------------------------------------------------
Symbol SD_CS = PORTC.2 'SPI CS to SD CS (SD pin 1)
Symbol SD_DI = PORTC.5 'SPI DO to SD DI (SD Pin 2)
Symbol SD_CLK = PORTC.3 'SPI CLK to SD CLK (SD Pin 5)
Symbol SD_DO = PORTC.4 'SPI DI to SD DO (SD Pin 7)
'-----------------------------------------------------------
Include "SD_File_System_Code_Lib.pbp" 'Include managed library file
'-----------------------------------------------------------
GoTo Over_Sub 'Jump over the subroutines
'-----------------------------------------------------------
Over_Sub:
DelayMS 200
'-----------------------------------------------------------
Main_Prog:
RSOut "INSERT SD OR MMC",13
Repeat
Response = SD_Init_FS
Until Response = 0
'-----------------------------------------------------------
Open_New_File:
SD_File_Name = "TESTFILE" 'File Name, upper case only!
SD_File_Ext = "TXT" 'File Ext, upper case only!
Response = SD_Check_For_File 'Check if file already exists
If Response = 0 Then
RSOut "FILE EXISTS - STOPPING",13
Stop
Else
RSOut "OPENING FILE",13
SD_New_File 'Open new file
EndIf
'-----------------------------------------------------------
Write_To_File:
RSOut "WRITING TO FILE",13
SD_IO_String = "SD/MMC Code by S Wright"
SD_Write_String_To_File 'Write SD_IO_String to file
SD_Write_Byte_To_File 13
SD_Write_Byte_To_File 10
'-----------------------------------------------------------
Close_File:
SD_Close_File 'Close file
RSOut "FILE CLOSED",13
'Stop
DelayMS 2000
RSOut "INSERT SD OR MMC",13
Repeat
Response = SD_Init_FS
Until Response = 0
SD_File_Name = "TEST001"
SD_File_Ext = "TXT"
Response = SD_Append_File
If Response > 0 Then
RSOut "ERROR - FILE NOT FOUND - STOPPING"
Stop
EndIf
RSOut "APPENDING TO FILE",13
SD_IO_String = "SD/MMC Code Test" + 13 + 10
Response = SD_Write_String_To_File 'Write SD_IO_String to file
SD_Close_File
RSOut "FILE CLOSED",13
'-----------------------------------------------------------
Finish:
RSOut "FINISHED",13
Stop