TC74 interfacing problem with PIC18

Status
Not open for further replies.
Code:
IdleI2C(); // ensure module is idle 
        StartI2C(); // initiate START condition

Where does this 2 come from? do i need to declare?
 

The I2C routines are contained in the i2c.c and i2c.h files.

Note the following compiler directive:

Code:
#include <i2c.h>

BigDog
 

what do they do actually ?

and what does the following code mean?

Code:
TRIS A = 0XFF;
TRISB = 0X01;
TRISC=0XBB;
TRISD=0X00;
TRISE=0XFF;

LATA =0X00;
LATB=0X00;
LATC=0X80;

- - - Updated - - -

TRISA** correction
 

hi i need to initialize my i2c , is this the correct file to use ?

Please reply asap
 

Attachments

  • i2c.zip
    9.2 KB · Views: 58

Code:
#define		TC74_READ	   0x9B
#define		TC74_WRITE	   0x9A   

//////////////////////////////////////////////////////////////
void tc74_write(unsigned char reg,unsigned char val)
{
i2c_start(); 
i2c_write(TC74_WRITE);    
i2c_write(reg);  
i2c_write(val); 
i2c_stop(); 
}  
//////////////////////////////////////////////////////////////
void tc74_read(unsigned char reg,unsigned char *value)
{
i2c_start();
i2c_write(TC74_WRITE);
i2c_write(reg); 
i2c_repStart();
i2c_write(TC74_READ);
*value=i2c_read(0);  //ACK 
i2c_stop();   
}

START|TC74_WRITE|ACK|reg|ACK|repstart|TC74_READ|AC K|read data|NACK|STOP

 

@Jestin,,

in the stimulation software , what is the ic chip that u used ?

- - - Updated - - -

PHP:
START|TC74_WRITE|ACK|reg|ACK|repstart|TC74_READ|AC K|read data|NACK|STOP

what does this mean ?
 

chip 16f877A

START|TC74_WRITE|ACK|reg|ACK|repstart|TC74_READ|ACK|read data|NACK|STOP

i2c command sequence for access TC74
START= i2c start command
TC74_WRITE = TC74 device address [in this case 0x9A]
ACK=Acknowledgement
repstart = Repeat start i2c command
TC74_READ=TC74 device address|0x1 read command [in this case 0x9B]
read data = read SSPBUF register
NACK = I2C command negative acknowledgement
STOP= I2C command [stop i2c communication ]
 

does that mean i can use Jestin's codes in initialize the I2C ?
any recommended links for initialization of TC74 ?
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…