Do you have a question? Post it now! No Registration Necessary
February 9, 2006, 6:27 pm

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
Site Timeline
- » PIC16F877 and Pins Prob
- — Next thread in » Microcontroller Discussions
-
- » Looking for the right 8051 to use on your next project ?
- — Previous thread in » Microcontroller Discussions
-
- » New(ish) assembler for PIC16 microcontrollers (asm1825)
- — Newest thread in » Microcontroller Discussions
-
- » Возможности тестера DT-830B
- — The site's Newest Thread. Posted in » Electronic Circuits (Russian)
-