AnsweredAssumed Answered

Error using SPI module in P89V51RD2

Question asked by Avanish Ojha on May 11, 2016

Hi, I am trying to use P89V51RD2 controller for SPI module.

I have written

#include<intrins.h>

#include <P89V51Rx2.h>

sbit LE=P1^4;

sbit MOSI=P1^5;

sbit MISO=P1^6;

sbit clk=P1^7;

 

void main(void)

{

TMOD=0x20;//TIMER 1 MODE 2 AUTO RELOAD
TH1=0xFD;//9600 BAUD RATE @11.0592 mhZ

 

SCON=0x50;   // UART in Mode 1, 8Bit Data, 1Stop Bit, 1Start Bit

SPCTL= 0x51;

TR1= 1;
SPDAT=0x48;   // Place value in Buffer
while(SPCFG!=0x80);
SPCFG=0x00;

}

but I could not get anything on port pins MOSI or clk.

Please tell me What am I missing?

Outcomes