Truncated match.
PICList
Thread
'R: Re: questions'
2000\05\09@183706
by
o Dellisanti Vilardi
|
-----Messaggio originale-----
Da: Clyde Smith-Stubbs <spam_OUTclydeTakeThisOuT
HTSOFT.COM>
A: .....PICLISTKILLspam
@spam@MITVMA.MIT.EDU <PICLIST
KILLspamMITVMA.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
2000\05\10@005455
by
Clyde Smith-Stubbs
|
> Is it possible to get an evaluation version? Does it work with PIC17C766 ?
Yes it does work with the 17C766. There is a demo version on our web
site, but this does not have the 17Cxx support. We can arrange an evaluation
of the full compiler - contact .....salesKILLspam
.....htsoft.com for more information.
> ...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?
The same thing that happens when you read them in assembler.
> 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 ?
The above C code *will* produce a single bit instruction, but just as in
assembler, this still results in a read/modify/write cycle on the port. Whether
you use assembler or C, you must deal with this if required, by keeping a shadow
copy of the output data. This is required only if a) you intend switching
bits in the port between input and output, or b) if an output pin could be driven
high or low by external logic. If your hardware is properly designed this will only
occur if you use an open-drain output.
But remember, this is not a C or assembler issue, this is a hardware issue.
Regards, Clyde
--
Clyde Smith-Stubbs | HI-TECH Software
Email: EraseMEclydespam_OUT
TakeThisOuThtsoft.com | Phone Fax
WWW: http://www.htsoft.com/ | USA: (408) 490 2885 (408) 490 2885
PGP: finger clyde
spam_OUThtsoft.com | AUS: +61 7 3355 8333 +61 7 3355 8334
---------------------------------------------------------------------------
HI-TECH C: compiling the real world.
More... (looser matching)
- Last day of these posts
- In 2000
, 2001 only
- Today
- New search...