Member | Action | Date |
---|---|---|
![]() |
Replied
to
Configuring 8051F120 as Slave for SPI Communication.
Hi I just want to know that for SPI Communication in 8051F120, the SPI0DAT register will reset after a byte received and read ? if it is not how can I clear the SPI0DAT before the next data receive ???
|
Oct 28 2017, 2:08 PM |
![]() |
Replied
to
Configuring 8051F120 as Slave for SPI Communication.
Hi
I am Configuring 8051f120 as a slave . Master is FPGA and it will send the data to slave when data is selected from GUI . Am getting some wrong data in slave SPI0DAT register , if am sending the data 2 or 3 times , getting the actual data. Is there any Clock Synchronization problem in slave side ??? How can I resolve this issue ??? |
Oct 28 2017, 2:08 PM |
![]() |
Replied
to
Configuring 8051F120 as Slave for SPI Communication.
Sorry , the Pin assignment in the attached code is wrong .it is sbit MOSI = P0^4; sbit SCK = P0^2;
then I am changed the code by including the Interrupt Method . (Note: #define ERROR_OCCURRED 0x40 // Indicator for the Slave to tell the Master an error occurred)
void SPI_ISR (void) interrupt 6
SPIF = 0; // Clear the SPIF flag
I am getting some data in SPI0DAT register but not the correct data . If am trying to send the data from master side 2 or 3 times,then the correct data is getting. if it is a clock Synchronization problem ?? How to resolve it ? |
Oct 28 2017, 2:08 PM |
![]() |
Posted
Configuring 8051F120 as Slave for SPI Communication. on
Forum
Hello, I have configured 8051F120 as a slave for SPI Communication . I am not getting the data send by Master in SPI0DAT register. Clock and data from Master out pin has been verified in Scope . Please check my code and let me know is there anything I have missed out for configuring 8051F120 as a slave . Note : sbit MOSI = P0^2;
void main()
SPI_Data_Read(unsigned char *); } } unsigned char )Disable_WDT(void) char INT_Oscillator_Init(void) char Port_Initialize()
char SPI_Init() unsigned char EnableSPI_Interrupt(unsigned char in_ucInterruptFlag) void SPI_Data_Read(unsigned char *pucData)
void SPIReadByte(unsigned char *pucData) |
Oct 28 2017, 2:08 PM |
![]() |
Replied
to
8051F120DK Port 4 Configuration as Push Pull Output
Thanks for your kind reply. The problem is , I haven't set & restore the SFRPAGE in Power_On_Init() function where I am toggling the P4 Pins. After including the SFRPAGE, now its working fine. But my doubt is, without this SFRPAGE set & restore P0 to P3 is working ? why not P4 to P7 ?? |
Oct 28 2017, 2:08 PM |
![]() |
Replied
to
8051F120DK Port 4 Configuration as Push Pull Output
char Port_Initialize()
void Power_On_Init() PORT_FOUR_ONE = 0;
void main() { }
Note : I have included lines related with the Port 4 only . P0 to P3 is working fine. PORT_FOUR_ZERO macro defined in corresponding header file (sbit PORT_FOUR_ZERO = P4^0 etc ..).
|
Oct 28 2017, 2:08 PM |
![]() |
Replied
to
8051F120DK Port 4 Configuration as Push Pull Output
I have enabled the SFR also.
Show more
|
Oct 28 2017, 2:08 PM |
![]() |
Posted
8051F120DK Port 4 Configuration as Push Pull Output on
Forum
Hi,
Show more
I just want to configure the Port 4 Pin as Push Pull output . So that I have configured P4MDOUT = 0xFF . ( SFR page also selected as CONFIG ) But after making the corresponding pins as low or high . Port pin output state is not latching . Always it's in High state , even I had made it as low . I need to configure any Cross bar register ?Is there anything I have missed out ? Please help me .... |
Oct 28 2017, 2:08 PM |