PIC16F877 & I2C Prob

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View


Hi !

I am using PIC 16F877 and i have a little prob...Any code which is
written after
datahi = donnee[1] doesn't work...Actually the PIC blocks .....
It must normally work but it didn't...
I don't know where the error is...:-/

This is my code (I made a I2C communication):
The Slave took delivery from a 5 Byte Array (This program is in the
slave)

if(test_bit(sspstat,S) && !test_bit(sspstat,R_W) &&
test_bit(sspstat,BF) && test_bit(sspstat,D_A)) //&&
!test_bit(sspstat,R_W)
{

// each times I fill the Array with a char

donnee[idx] = sspbuf;
idx++;
set_bit(portb,6);
if(donnee[4] == 0xAA)
{
valide = true;

}
}

//==============================

// In my main programm, I try to read two value from my array

set_bit (portb,0);
datalo = donnee[2];
datahi = donnee[1];
//unsigned char lo = donnee[2];
//unsigned char hi = donnee[1];
set_bit (portb,2);
MAKESHORT( distance,datalo,datahi);

I tried a simple addition, but unfortunately it didn't work too...
Have someone an idea how i can soluce my prob ?

Thanks

chris


Re: PIC16F877 & I2C Prob



Quoted text here. Click to load it

I do not have an answer for your problem, but could you point me in the
right direction on how to use the onboard sieral programming features? I do
not want to fork out cash for a developement board.



Site Timeline