| ??? 11/14/05 04:23 Read: times |
#103664 - transmission block Responding to: ???'s previous message |
>Compared to some of the other things you've been expressing
>interest in recently, the stack should be pretty easy. Yeah I kinda figured. I've pretty much got the push/pop thing down now. This is kinda what I'm doing so far :
INIT_CARD:
MOV A, #149
Push Acc
MOV A, #0
Push Acc
Push Acc
Push Acc
MOV A, #64
PUSH ACC
LCALL CONTROLCARD
RET
CONTROLCARD:
SETB Dout
CLR CS
MOV R2, #6 ; 6 bytes to transfer to card
LCALL SENDSPI
SETB CS
RET
SENDSPI:
MOV R3, #8
POP ACC
CLOCKBYTE:
RLC A
MOV DIN, C
SETB SPICLK
CLR SPICLK
DJNZ R3, CLOCKBYTE
DJNZ R2, SENDSPI
SETB DIN
So far this -should- load the 6 bytes into the stack, leaving them to be pulled off the stack in transmission order (ie: 40h 00h 00h 00h 00h 95h) and rotate them left through C so they are MSB first, as I believe the datasheets say it should be. The last line in SENDSPI: is SETB DIN, which, again, -should- go high after everything is clocked out. Now I'm just kinda confused as to how many clocks I have to send before a reponse is to be received. I love diving into datasheets. Not. You'll notice the SENDSPI has no RET, since this is now where I should start receiving information... Not done yet :) My biggest confusion in ASM is lines like "MOV A,@R0". I know that means A will contain whatever value is at memory location defined in R0, rather than the value of R0 itself, but I just get stuck on this sometimes. One important question, if the A is "pushed" onto the stack... does that set A back to 00h, or does A retain the value it had in it from before the push? |
| Topic | Author | Date |
| SDcards and filesystems | 01/01/70 00:00 | |
| Some SD/FAT answers | 01/01/70 00:00 | |
| no FS | 01/01/70 00:00 | |
| Also... | 01/01/70 00:00 | |
| Even more... anybody got any ideas? | 01/01/70 00:00 | |
| SD command structure | 01/01/70 00:00 | |
| datasheet | 01/01/70 00:00 | |
| SD card communication | 01/01/70 00:00 | |
| transmission block | 01/01/70 00:00 | |
| Push | 01/01/70 00:00 | |
| Won't work | 01/01/70 00:00 | |
| CRC | 01/01/70 00:00 | |
| Thats called a file system | 01/01/70 00:00 | |
Look Here | 01/01/70 00:00 |



