Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 08, 2016, 06:57:39 06:57


Login with username, password and session length


Pages: [1]
Print
Author Topic: [RQD] help with ISIS and MMC card  (Read 5135 times)
0 Members and 1 Guest are viewing this topic.
Wizpic
Global Moderator
Hero Member
*****
Offline Offline

Posts: 976

Thank You
-Given: 197
-Receive: 344



« on: May 14, 2010, 07:33:51 19:33 »

I'm trying to simulte an SD card in ISIS but I don't seem to be getting any where  Cry
 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  Grin)

Wizpic
sample code:
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



 

Logged

When you think, "I can't do anymore. I need a break," that is the time to challenge yourself to keep going another five minutes. Those who persevere for even an extra five minutes will win in life..
Alienbeing
Active Member
***
 Muted
Offline Offline

Posts: 166

Thank You
-Given: 68
-Receive: 45


« Reply #1 on: May 14, 2010, 10:23:50 22:23 »

Didn't ISIS have a MMC memory card example? Thought I have seen it in one of their examples. Isn't SD similar to MMC cards? Both can use SPI.

Alienbeing
Logged
Wizpic
Global Moderator
Hero Member
*****
Offline Offline

Posts: 976

Thank You
-Given: 197
-Receive: 344



« Reply #2 on: May 15, 2010, 11:24:43 11:24 »

Yes they are simular, I did look for the sample but I cant find it, looked in ISIS foleders but can't find it otherwise i would not be asking
Logged

When you think, "I can't do anymore. I need a break," that is the time to challenge yourself to keep going another five minutes. Those who persevere for even an extra five minutes will win in life..
Top
Senior Member
****
Offline Offline

Posts: 325

Thank You
-Given: 38
-Receive: 1633


« Reply #3 on: May 15, 2010, 01:34:41 13:34 »

You need to use something like WinImage (http://www.winimage.com/winimage.htm) to make an empty SD card image; just a normal FAT16 image of whatever size you want to simulate. Call it something like 'sdcard.bin' and load it into the model. When you've finished simulating open it in WinImage to extract the files.
Logged
sohel
Senior Member
****
Offline Offline

Posts: 437

Thank You
-Given: 140
-Receive: 124



WWW
« Reply #4 on: May 15, 2010, 08:09:26 20:09 »

Yes they are simular, I did look for the sample but I cant find it, looked in ISIS foleders but can't find it otherwise i would not be asking

here it is-> Program Files\Labcenter Electronics\Proteus 7 Professional\SAMPLES\VSM for USB\PICDEM FS USB\MSD
Logged

A Thousand Miles Journey Start With a Single Step<br />http://www.youtube.com/user/masud58
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC