??? 11/14/05 14:10 Read: times |
#103690 - Won't work Responding to: ???'s previous message |
Jeff Corr said:
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 approach won't work. You put the data on the stack in a logical order, but LCALL is going to push the return address onto the stack. So when you arrive at INIT_CARD your stack will contained 149, 0, 0, 0, 0, 64, then the 2-byte return address that will contain the address of the INIT_CARD RET instruction. Then CONTROLCARD is going to push its return address onto the stack each time it calls SENDSPI. So SENDSPI is going to always end up popping one byte of the return address and sending it to the SPI bus. It'll then attempt to RETurn to the calling routine, but the correct return address will no longer be on the stack since you just popped part of the return address and sent it to the SPI bus. Generally, data is not passed to routines via the stack using an 8052 (though it's not strictly impossible to do so). Now I'm just kinda confused as to how many clocks I have to send before a reponse is to be received. The response time is variable. You need to keep reading bytes in from the SPI bus until you find a byte that has its high bit clear. If the bytes you read are 80h or above, you need to keep reading since a return value of 80h or above means the card hasn't responded yet. 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? No, just pushes the value on the stack. The value in the register you are pushing onto the stack remains unchanged. Regards, Craig Steiner |
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 |