Hi Vaclav,

I started to play with software I2C on 12F675 and found that TRISIO_bits definition is missing. Can somebody add following (or something similar) into pic12f675.h (and corresponding "volatile __TRISIO_bits_t .." line into .C file) ?

Included in r5287; I also consolidated the device libs for 12f629 and 12f675. I used TRISIOx rather than IOx as the bit names according to the data sheet.

Thank you for the report.

BTW, I tried following macros ( Raphael recommended them in 2007-12 ), but no success with the new SDCC:
#define SETB(reg,bit) (reg) |= (1<<(bit))
#define CLRB(reg,bit) (reg) &= ~(1<<(bit))

#define LED1 GPIO,0
#define LED2 GPIO,2

SETB(LED1);

I get following error (it looks like no expansion is done in preprocessor ? ) :
main.c:100:17: error: macro "SETB" requires 2 arguments, but only 1 given
main.c:100: error 20: Undefined identifier 'SETB'

Please find attached a working version of the macros.
Basically you need two levels of expansion here:

#define SETB2(reg,bit)   (reg) |= (1<<(bit))
#define SETB(PIN)        SETB2(PIN)

Now SETB expands its argument and passes the expanded form ("GPIO,0") to the SETB2 macro.

Regards,
Raphael

Attachment: setb.c
Description: Binary data

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to