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.

Simple question, simple response?

Status
Not open for further replies.

southafrikanse

Junior Member level 1
Junior Member level 1
Joined
Jun 12, 2007
Messages
15
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Amora, Portugal
Activity points
1,418
#use i2c(master, sda=ds1307_sda, scl=ds1307_scl)

Hello

I'm a newbie on C language and I just want to know what is the difference when you type BYTE or byte.

Is it cause BYTE can be considered an output while byte is input?

By the way, what does:

# use i2c()

stand for?

Any help is welcomed.
 

"byte" is not a type specifier in C language, as "int" or "char" are.
Usually this type is defined in some ".h" file with typedef. It may be called "byte", "BYTE", or both. It is a matter of style to use upper- or lower-case.
Regards

Z
 
# use i2c()

That looks like an error in standard C. There is no "use" preprocessing directive. It could be a special feature provided by a particular compiler.
 

I think its not just C but CCS. And its used to set a Soft- or Hardware I2C master

#use I2C(master, sda=PIN_B0, scl=PIN_B1)

will set and I2C master in RB0 & RB1 and will be used with the subs

i2c_start();
ack=i2c_write(DATA);
val=i2c_read(ACK);
i2c_stop();

wish it helps...
 

Kurenai_ryu

CCS? Is it possible to turn it into C?

My code is this:

Code:
#define DS1307_SDA  PIN_B1
#define DS1307_SCL  PIN_B0
#use i2c(master, sda=DS1307_SDA, scl=DS1307_SCL)




//==========================
// initial DS1307
//==========================
void init_DS1307()
{
   output_float(DS1307_SCL);
   output_float(DS1307_SDA);
}
//==========================
// write data one byte to
// DS1307
//==========================
void write_DS1307(byte address, BYTE data)
{
   short int status;
   i2c_start();
   i2c_write(0xd0);
   i2c_write(address);
   i2c_write(data);
   i2c_stop();
   i2c_start();
   status=i2c_write(0xd0);
   while(status==1)
   {
      i2c_start();
      status=i2c_write(0xd0);
   }
}
//==========================
// read data one byte from DS1307
//==========================
BYTE read_DS1307(byte address)
{
   BYTE data;
   i2c_start();
   i2c_write(0xd0);
   i2c_write(address);
   i2c_start();
   i2c_write(0xd1);
   data=i2c_read(0);
   i2c_stop();
   return(data);
}

Isn't this C?
 

CCS is a C compiler por PIC microcontrollers...
thats yours! :)
visit https://www.ccsinfo.com/ for more info...

maybe you got a CCS example or got CCS as C compiler... anyway, could you explain what is your project?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top