PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Rogue robotics uMMC SD Karte Module mit RNControl Mega32



mjv
02.10.2005, 23:57
dieses Module ist über TTL RS232 gesteuert und braucht kein onboard Speicher/Puffer. Vieleicht von Interesse

'++++++++++++++++++++++++++++++++++++++++
'Demonstration For Initialisation, Writing And Reading To / From
'the uMMC Serial Data Card Module From Rogue Robotics
' ( http://www.roguerobotics.com)
'Using Atmel Arm Mega32 Rncontrol Board
'
'2.10.2005
'++++++++++++++++++++++++++++++++++++++++


$regfile = "m32def.dat"
$crystal = 16000000 'Quarzfrequenz
$baud = 9600
Echo Off

Declare Sub Reply

Dim B As Byte

Wait 2
Print "Starting up"
Print Chr(13)

Open "COMB.3:9600,8,N,1" For Output As #2
Open "COMB.4:9600,8,N,1" For Input As #1

'clear buffer??---------------------------
For B = 1 To 100
Print #2 , Chr(127)
Next

'Initialise until ">" prompt--------------

Do
Print #2 , Chr(13) ; Chr(13)
Get #1 , B
Loop Until B = Chr(62)
Print Chr(b) ; "Start OK"

'send/request some status report commands---------------------


Print "Status is:";
Print #2 , "Z " ; Chr(13);
Gosub Reply

Print "Volume is: ";
Print #2 , "Q " ; Chr(13);
Gosub Reply

Print "Version is: ";
Print #2 , "V " ; Chr(13);
Gosub Reply

Print "First Free Handle is: ";
Print #2 , "F " ; Chr(13);
Gosub Reply

Print "Settings timeout is: ";
Print #2 , "S 1 " ; Chr(13);
Gosub Reply

Print "Settings baudrate is: ";
Print #2 , "S 0 " ; Chr(13);
Gosub Reply

'Print "Change Settings timeout : ";
'Print #2 , "S 1 200 " ; Chr(13);
'Gosub Reply

'some file manipulation commands---------------------
'uncomment as needed
'note: single space at end of single,double triple character commands
'but nb!! no space at the end of the file path in file commands

'Print "Close file";
'Print #2 , "C 1 " ; Chr(13) ;
'Gosub Reply

'Print "Close file";
'Print #2 , "C 2 " ; Chr(13) ;
'Gosub Reply

'Print "Open/Make a path :";
'Print #2 , "M /FILES" ; Chr(13);
'Gosub Reply

'Print "Erase a file :";
'Print #2 , "E FILES/MARTY.LOG" ; Chr(13);
'Gosub Reply

' Print "Open/Make a file :";
' Print #2 , "O 1 A /FILES/MARTY.LOG" ; Chr(13);
'Gosub Reply

' Print "Write some data :";
'NB text exactly (40) characters long, follows directly the W command without acknowledgement
'Print #2 , "W 1 40 " ; Chr(13) ; "The first ever text on the card xxxxxxxx" ; Chr(13)
' Gosub Reply

' Print "Close file";
' Print #2 , "C 1 " ; Chr(13) ;
' Gosub Reply

Print "Open to Read the data :";
Print #2 , "O 1 R /FILES/MARTY.LOG" ; Chr(13);
Gosub Reply

Print "Read the data :";
Print #2 , "R 1 80 " ; Chr(13);
Gosub Reply

Print "Close file";
Print #2 , "C 1 " ; Chr(13) ;
Gosub Reply

Print "All Done"
Print
Print

'++++++++++++++++++++++++++++++++++++
Sub Reply

Do
Get #1 , B
Print Chr(b) ;
Loop Until B = Chr(62)
Print Chr(13)

End Sub
'++++++++++++++++++++++++++++++++++++
Close #1
Close #2

End