'R: Re: questions'
o Dellisanti Vilardi
Da: Clyde Smith-Stubbs <HTSOFT.COM> clyde
A: MITVMA.MIT.EDU < PICLISTMITVMA.MIT.EDU> PICLIST
Data: sabato 6 maggio 2000 3.35
Oggetto: Re: questions
>On Sat, May 06, 2000 at 02:02:58AM +0200, Massimiliano Dellisanti Vilardi
>> - 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) ??
> 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
...but what happens if some lines of PORTX are configured as Output? The
statement (PORTX &= something) means that PORTX must be read and then
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.
|> 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 htsoft.com for more information. sales
> ...but what happens if some lines of PORTX are configured as Output? The
> statement (PORTX &= something) means that PORTX must be read and then
> 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.
Clyde Smith-Stubbs | HI-TECH Software
Email: htsoft.com | Phone Fax clyde
WWW: http://www.htsoft.com/ | USA: (408) 490 2885 (408) 490 2885
PGP: finger htsoft.com | AUS: +61 7 3355 8333 +61 7 3355 8334 clyde
HI-TECH C: compiling the real world.
More... (looser matching)
- Last day of these posts
- In 2000
, 2001 only
- New search...