"C" source code for I2C slave PIC16F81x - Page 2

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Re: "C" source code for I2C slave PIC16F81x
Quoted text here. Click to load it

Hi Bob,  
Thank you for URL.  I checked it:
http://ww1.microchip.com/downloads/en/AppNotes/00734a.pdf but there is
just assembler source.  I need "C" one...

Regards,
tesvit.

Re: "C" source code for I2C slave PIC16F81x

Quoted text here. Click to load it

The MPLAB C18 C compiler Library has several I2C functions in C. Don't know
about Hi-Tech.


Bob

Re: "C" source code for I2C slave PIC16F81x
Quoted text here. Click to load it

So what?

Just rewrite it in C, if you prefer. You cannot avoid at least
reading assembler code if you will to get anywhere in the small
controller world. It pays to get the assembler listings of the
compiler output and have a look at surprises in code generation.
A seemingly innocent C construction can expand to a machine
code monster, and you'll notice where to improve.

--

Tauno Voipio
tauno voipio (at) iki fi


Re: "C" source code for I2C slave PIC16F81x

Quoted text here. Click to load it

Agreed.  I wrote my own EEPROM write routine after I saw the assembler
listing of how CCS PICC was doing it.

On the other hand, I converted an 68HC705 assembly program to ByteCraft C
some years ago as the first step in adding some features.  I was surprised
to see that the resulting object code was smaller than the original
assembler.  I studied the assembler listing from the C code to find out how
they did the improvements.




Re: "C" source code for I2C slave PIC16F81x
Well, I read AN734 and rewrite it in C.
Thank you guys.


Site Timeline