Author | Matthew Schinkel - borntechi.com, copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4l |
this library provides functions for SD memory cards.
SanDisk Secure Digital Card - http://www.cs.ucr.edu/~amitra/sdcard/ProdManualSDCardv1.9.pdf How to use MMC/SDC - http://forums.parallax.com/forums/attach.aspx?a=32012
This version works with only standard capacity sd cards up to 4gb, high capacity up to 32 gb, and Extended Capacity up to 2TB may be supported later on.
const byte SD_SEND_NUM_WR_BLOCKS = 22
const byte SD_PROGRAM_CSD = 27
const dword LARGE_ARRAY_4_SIZE = 512 -- choose number of array variables
const byte SD_STOP_TRANSMISSION = 12
const byte SD_WRITE_MULTIPLE_BLOCK = 25
const byte SD_SEND_SCR = 51
const byte SD_CLR_WRITE_PROT = 29
const byte SD_APP_CMD = 55 -- indicate that the next command is a application specific command
const byte SD_GO_IDLE_STATE = 0
const byte SD_SET_BLOCKLEN = 16
const byte SD_SET_WR_BLK_ERASE_COUNT = 23
const byte SD_SD_STATUS = 13
const byte SD_READ_SINGLE_BLOCK = 17
const byte SD_SEND_OP_COND = 1
const PATA_HARD_DISK = 0
const byte SD_SEND_CID = 10
const byte SD_GEN_CMD = 56
const byte SD_SEND_WRITE_PROT = 30
const byte SD_ERASE_WR_BLK_END = 33
var word sd_sector_count = 0
const byte SD_READ_MULTIPLE_BLOCK = 18
const byte SD_ERASE_WR_BLK_START = 32
const SD_CARD = 1
const byte SD_ERASE = 38
const byte SD_SD_APP_OP_COND = 41
const byte SD_WRITE_BLOCK = 24
var byte sd_word_count = 0
const byte SD_CRC_ON_OFF = 59 -- default is off
const byte SD_SET_WRITE_PROT = 28
const dword LARGE_ARRAY_4_VARIABLE_SIZE = 1 -- choose size of variables
const byte SD_READ_OCR = 58
const DATA_MEDIA = SD_CARD
const byte SD_SEND_STATUS = 13
const byte SD_SEND_CSD = 9 -- sd sends "Card Specific Data" standard or high capacity
const byte SD_SET_CLR_CARD_DETECT = 42
sd_ready()
sd_write_to_sector_end(byte in input_byte)
sd_init()
sd_stop_read()
sd_write_pulse(byte in count1)
send_command(byte in command,dword in data, byte out response)
sd_read_sector()
sd_read_data(byte out low_byte, byte out high_byte)
sd_stop_write()
sd_set_idle()
sd_read_pulse(byte in count1)
sd_start_read(dword in address)
sd_start_write(dword in address)
sd_write_data(byte in low_byte, byte in high_byte)
const byte SD_SEND_NUM_WR_BLOCKS = 22
No documentation found
const byte SD_PROGRAM_CSD = 27
No documentation found
const dword LARGE_ARRAY_4_SIZE = 512 -- choose number of array variables
No documentation found
const byte SD_STOP_TRANSMISSION = 12
No documentation found
const byte SD_WRITE_MULTIPLE_BLOCK = 25
No documentation found
const byte SD_SEND_SCR = 51
No documentation found
const byte SD_CLR_WRITE_PROT = 29
No documentation found
const byte SD_APP_CMD = 55 -- indicate that the next command is a application specific command
Application Specific Commands
const byte SD_GO_IDLE_STATE = 0
Basic Commands
const byte SD_SET_BLOCKLEN = 16
Read Commands
const byte SD_SET_WR_BLK_ERASE_COUNT = 23
No documentation found
const byte SD_SD_STATUS = 13
application specific command, must write command 55 first
const byte SD_READ_SINGLE_BLOCK = 17
No documentation found
const byte SD_SEND_OP_COND = 1
No documentation found
const PATA_HARD_DISK = 0
constants for fat32 library
const byte SD_SEND_CID = 10
No documentation found
const byte SD_GEN_CMD = 56
No documentation found
const byte SD_SEND_WRITE_PROT = 30
No documentation found
const byte SD_ERASE_WR_BLK_END = 33
No documentation found
var word sd_sector_count = 0
No documentation found
const byte SD_READ_MULTIPLE_BLOCK = 18
No documentation found
const byte SD_ERASE_WR_BLK_START = 32
Erase Commands
const SD_CARD = 1
No documentation found
const byte SD_ERASE = 38
No documentation found
const byte SD_SD_APP_OP_COND = 41
No documentation found
const byte SD_WRITE_BLOCK = 24
Write Commands
var byte sd_word_count = 0
counters
const byte SD_CRC_ON_OFF = 59 -- default is off
No documentation found
const byte SD_SET_WRITE_PROT = 28
Write Protection Commands
const dword LARGE_ARRAY_4_VARIABLE_SIZE = 1 -- choose size of variables
No documentation found
const byte SD_READ_OCR = 58
Other Commands
const DATA_MEDIA = SD_CARD
No documentation found
const byte SD_SEND_STATUS = 13
No documentation found
const byte SD_SEND_CSD = 9 -- sd sends "Card Specific Data" standard or high capacity
No documentation found
const byte SD_SET_CLR_CARD_DETECT = 42
No documentation found
sd_ready()
No documentation found
sd_write_to_sector_end(byte in input_byte)
No documentation found
sd_init()
No documentation found
sd_stop_read()
No documentation found
sd_write_pulse(byte in count1)
No documentation found
send_command(byte in command,dword in data, byte out response)
No documentation found
sd_read_sector()
No documentation found
sd_read_data(byte out low_byte, byte out high_byte)
No documentation found
sd_stop_write()
No documentation found
sd_set_idle()
No documentation found
sd_read_pulse(byte in count1)
No documentation found
sd_start_read(dword in address)
No documentation found
sd_start_write(dword in address)
No documentation found
sd_write_data(byte in low_byte, byte in high_byte)
No documentation found
16f877 | 16f877_sd_card.jal |
18f452 | 18f452_sd_card.jal |
18f452 | 18f452_fat32_sd_card.jal |