Hai,
Here i am trying to communicate sensor ad7156 thorugh I2C communication in pic.
1. Before doing i am checking the status of SDA and SCL, its is still in ideal stage. there was no change of signal in logic analyzer
2. USing MPLAB IDE for coding it was build successful. still not owrking.
somebody can help on this
uploading code here,
Mod edit: code tags
Here i am trying to communicate sensor ad7156 thorugh I2C communication in pic.
1. Before doing i am checking the status of SDA and SCL, its is still in ideal stage. there was no change of signal in logic analyzer
2. USing MPLAB IDE for coding it was build successful. still not owrking.
somebody can help on this
uploading code here,
C:
#include<pic.h>
typedef unsigned char int8;
int i;
void delay()
{
for(i=0;i<10000;i++);
}
void init()
{
TRISC=0X18;
SSPADD=26;
SSPSTAT=0X80;
SSPCON=0X28;
}
void start()
{
SEN=1;
while(!SSPIF);
SSPIF=0;
}
void stop()
{
PEN=1;
while(!SSPIF);
SSPIF=0;
}
void send(int8 b)
{
static bit s;
SSPBUF=b;
while(!SSPIF);
SSPIF=0;
s=SSPSTAT;
delay();
}
void write(int8 b)
{
//start();
//send(0x90);
send(b);
stop();
}
void main()
{
//ADCON1 = 0x06; // no analog
init();
while(1)
{
send('A');
}
}
Last edited by a moderator: