ADGAN
Full Member level 5
- Joined
- Oct 9, 2013
- Messages
- 295
- Helped
- 4
- Reputation
- 8
- Reaction score
- 4
- Trophy points
- 18
- Activity points
- 1,837
Hi! I converted a code written for PIC18F65J90 to PIC18F45K22. The original code is as follows:
My code is this:
But when I simulate the original code in Proteus I see some data is been moved on the data bus. But when I test my code I don't see any data on the data bus. What could be the reason for this? I'm using MPLAB C18.
Code:
void Output(UINT8 Data)
{
unsigned char ClearBuffer;
while(SSPSTATbits.BF ==1)
ClearBuffer = SSPBUF;
SSPBUF = Data;
PIR1bits.SSPIF = 0;
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
while(!PIR1bits.SSPIF);
Nop();
Nop();
ClearBuffer = SSPBUF;
return;
}
My code is this:
Code:
void Output(UINT8 Data)
{
unsigned char ClearBuffer;
while(SSP1STATbits.BF ==1)
ClearBuffer = SSP1BUF;
SSP1BUF = Data;
PIR1bits.SSP1IF = 0;
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
while(!PIR1bits.SSP1IF);
Nop();
Nop();
ClearBuffer = SSP1BUF;
return;
}
Last edited: