AT89C52 interface SD Memory Card
AJAY!! you are so cool men!!
I also need help though..
About my thesis, please see my post
http://www.8051projects.net/forum-t18517.html on this link
Soon we will have a tutorial page for this topic...
Stay tuned...
-Dave
I would like to have some inquiries regarding PIC18F4550..
I found a header file on the MCC18 compiler h lib folder, p18f4550..
Is this the header file that contains the register of PIC18F4550?
If so, how do I use this registers on a program..
Somehow, I did.. I found this code on MAXUSBLAB10 at maxim website which
uses LPC as MCU..
originally, the code goes like this with SSPDR, SSPSR, SSP_BSY
void Hwreg(BYTE reg, BYTE val) // write a host register { HSSEL_LO SSPDR = reg+0x02; // command byte into the FIFO. 0x02 is the write bit SSPDR = val; // data byte into the FIFO while(SSPSR & SSP_BSY) ; // hang until BUSY bit goes low HSSEL_HI }
This is how I revised it using SSPBUF.. also, regarding the way I changed it, was it ok if I removed "hang until busy bit goes low" part?
void Hwreg(BYTE reg, BYTE val) // write a host register { HSSEL_LO SSPBUF = reg+0x02; // command byte into the FIFO. 0x02 is the write bit SSPBUF = val; // data byte into the FIFO HSSEL_HI }
the SSPBUF is declared in the header as
extern volatile near unsigned char SSPBUF;
But, it return an error (syntax error) on SSPBUF..
Whats wrong?
i am waiting for a reply here..
If you are waiting and not reading, then you are doing something wrong. I believe people here will help you if they know something about what you are doing, otherwise they cannot. I have never used a PIC processor, and don't have the time to read the data sheet right now, but I'm sure if you read the data sheet, you will find the answers to what you are confused about.
Also, it would be helpful if you described what development environment you are using: the compiler, assembler, host platform, etc...
All of these things will help the person that decides to help you...
Remember, the people that help you are doing so out of the goodness of their heart; because they want to be nice - They are using their time to help you. They deserve some respect. If you want them to devote their time and effort towards your project, you can hire them and pay them as consultants. Otherwise, please be polite...
-Dave
PS - posting your questions here, along with the answers you receive, can not only help you, but others that might have similar problems - Just like this thread has apparently helped you...Just a thought...
Please stop emailing me at my work. Respect that this is where I work, and they pay me to work on their projects, not yours...Please confine your requests to this forum. Thanks, DavesGarage
It wasn't what I think I meant it to be.
My apologies..
This is taken from the PIC18F4550 Datasheet
19.3.3 ENABLING SPI I/O
To enable the serial port, SSP Enable bit, SSPEN
(SSPCON1<5>), must be set. To reset or reconfigure
SPI mode, clear the SSPEN bit, reinitialize the SSPCON
registers and then set the SSPEN bit. This configures
the SDI, SDO, SCK and SS pins as serial port pins. For
the pins to behave as the serial port function, some must
have their data direction bits (in the TRIS register)
appropriately programmed as follows:
• SDI is automatically controlled by the SPI module
• SDO must have TRISC<7> bit cleared
• SCK (Master mode) must have TRISB<1> bit
cleared
• SCK (Slave mode) must have TRISB<1> bit set
• SS must have TRISA<5> bit set
Any serial port function that is not desired may be
overridden by programming the corresponding data
direction (TRIS) register to the opposite value.
Here is how we programmed it.
//initializing SPI operation //SSPSTAT=11xxxxxx; SSPSTATbits.SMP=1; SSPSTATbits.CKE=1; //SSPCON1=xx110000; SSPCON1bits.SSPEN=1; SSPCON1bits.CKP=1; SSPCON1bits.SSPM3=0; SSPCON1bits.SSPM2=0; SSPCON1bits.SSPM1=0; SSPCON1bits.SSPM0=0; //control bits specified //enabling I/O //SDO must have TRISC<7> bit cleared TRISCbits.TRISC7=0; //SCK must have TRISB<1> bit cleared. TRISBbits.TRISB1=0; LATBbits.LATB1 = 1; LATBbits.LATB0 = 1; SSPBUF=00100110;
are we missing something else?
SSPSTAT=0b11000000; SSPCON1=0b00110000;
or
SSPSTAT=0xC0; SSPCON1=0x30;
is it ok if we do this??
And there is already a discussion going on regarding USB Flag to USB Flash copy. I think you better go through it. I think its in "Project Help" forum.