-----Messaggio originale----- Da: Clyde Smith-Stubbs A: PICLIST@MITVMA.MIT.EDU Data: sabato 6 maggio 2000 3.35 Oggetto: Re: questions >On Sat, May 06, 2000 at 02:02:58AM +0200, Massimiliano Dellisanti Vilardi wrote: >> - Is there a way to compile a c source where there are unsigned long variable? How can I solve this problem? How can I use 32 bit integers? Can I solve this problem with the new C18 compiler? > >Yes, get HI-TECH C. It supports all ANSI data types. > Is it possible to get an evaluation version? Does it work with PIC17C766 ? >> - Is there another way to reset a bit? I mean is there a better C code than this : PORTX &= (0xFF - mybit) ?? > >Like this: > > PORTX &= ~mybit; > >This assumes that "mybit" is a byte-size thing, and you want to reset the >corresponding bits. The ~ operator is a bitwise inversion. To reset a single bit, use > > PORTX &= ~(1 << bitno); > >A decent compiler will optimize this when bitno is a constant to a single instruction. > ...but what happens if some lines of PORTX are configured as Output? The statement (PORTX &= something) means that PORTX must be read and then written: what happens when I read output lines? I thought there was a way to access directly a bit: I guess this is possible using assembly: isn't there a way to do it in C ? Thank you for your answer. Max