Hi, I am getting some unknown error that, i cannot get data from SLAVE. I used PCF8574A to get parallel data from slave and tried to send them to PIC master.
I used this following procedure to send serial data.
Let it be P0,P1,P2,..P7
i wrote a program that,
I, first initialized the address of the I/O expander.
i2c_write(0x70); //address of the slave.
SSPBUF=i2c_read(); //Getting Data from Slave and coping it to SSPBUF.
j=SSPBUF; //J is initiated at the top of the program.
Then, i included an another function which is used to check the value of SSPBUF.
So that, if the input data is greater than 0xB0 (0d175) then the IF condition gets executed and turning RB7 from 0 to 1. I have connected an LED to RB7 so that to check whether RB7 turns ON if my input data is above 176.
This is that sub function.
void check(unsigned int c)
{
if(c>=0xB0)
{
RB7=1;
DelayMs(100);
}
else
{
RB7=0;
DelayMs(100);
}
}
After doing this software works, i then jumped into PROTEUS in order to give the circuit connections.
I have given all the circuit connections correctly for PIC16f877a and then i gave connections to PCF8574A which is shown in the below diagram.
In order to provide the value of 0xB0 or 0d176, i just connected the pins P0,P1,P2,P3 and P6 to ground and P4,P5 and P7 as +5v
But, the LED glows even though if i didn't press the push button which is shown in the below diagram.