CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

30f4013 and TC74A5 (SOLVED)

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
on7nh



Joined: 05 Jun 2006
Posts: 41
Location: Belgium

View user's profile Send private message Visit poster's website MSN Messenger

30f4013 and TC74A5 (SOLVED)
PostPosted: Wed Apr 16, 2008 3:52 am     Reply with quote

Hello ,
i have a strange problem

I make a I2C connection to a TC74

the loop is working, bu i receive always a "0"

what could be wrong ?
Code:

#include <30f4013.h>
#device adc=10
#FUSES NOWDT // Watch Dog Timer
#FUSES EC
#FUSES PR //Promiary Oscillator
#FUSES NOCKSFSM //Clock Switching is disabled, fail Safe clock monitor is disabled

#FUSES BROWNOUT //Reset when brownout detected
#FUSES MCLR //Master Clear pin enabled
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOWRT //Program memory not write protected
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOCOE //Device will reset into operational mode
#FUSES ICS0 //ICD communication channel 0

#FUSES RESERVED //Used to set the reserved FUSE bits
#define XTAL_FREQUENCY 10000000

#use delay(clock=XTAL_FREQUENCY)
#use i2c(MASTER, SDA=PIN_F2, SCL=PIN_F3, FORCE_HW,slow)
#use rs232(stream = RS232, baud=115200,parity=N,xmit=PIN_F5,rcv=PIN_F4,bits=8)
   int data;
    int ack;
    int fahr;

Void main()
{
   set_tris_b(0xFFFF);

   While(1)
   {
      
      i2c_start();
        ack = i2c_write(0x9A);
        ack = i2c_write(0x00);

        /* send start again */
        i2c_start();
        ack = i2c_write(0x9B);
        data = i2c_read(0);
        i2c_stop();

        printf("temp %D\r\n",data);

   
        delay_ms(200);

   
   }
}


Thanks
Carl

(edit)
Cleared Force_HW in the I2C(master settings....
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group