# I2C Implementation on PIC error

I am referencing this project: http://www.8051projects.net/wiki/I2C_Implementation_on_PIC

I am using PIC16F1847 and XC8 as opposed to PIC16F877 and HiTech C so I've had to make a few changes to the code. After making changes, my compiler gave me an error for the I2CWait function for the while statement. It says "unexpected token amp".

Here is the line in question:

while ((SSPCON2 &amp; 0x1F ) || ( SSPSTAT &amp; 0x04 ) );


I changed the register names to be consistent with my PIC's registers (below) but it didn't solve the problem.

while ((SSP1CON2 &amp; 0x1F ) || ( SSP1STAT &amp; 0x04 ) );


What changes do I need to make to this function so that this error does not occur?

[ Edited Wed Jun 29 2016, 03:37 PM ]

• Compiler talk to You very clearly: "unexpected token amp". Jun 29 '16 at 21:13
• This is a good example of why copying/pasting code without understanding it has its pitfalls. Jun 30 '16 at 0:30

while ((SSPCON2 &amp; 0x1F ) || ( SSPSTAT &amp; 0x04 ) );
while ((SSPCON2 & 0x1F ) || ( SSPSTAT & 0x04 ) );