Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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
 

those with I2c are included in the header file
Code:
#include i2c.h
 

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: 40

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

75_1346135243.png
 

@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 ]
 

will there be a difference in the code if i use 18F4520
 

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

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top