piclist 2010\07\06\033355a
>
Thread:
Accessing File registers in C by address. Pointers again
www.piclist.com/techref/microchip/languages.htm?key=c
BY
:
Peter email (remove spam text)
William "Chops" Westfield <westfw <at> mac.com> writes:
> volatile neat unsigned char *addr;
>
> Various C's are variously picky about having all those extra
> bits match up. You can also cast, but that would be evil.
Some compilers (which?) support an extended notation like:
#define LSFR ...
unsigned int foo @ LSFR;
And later foo can be used as usual.
I can find no references on 'neat', do you have a pointer for documentation on
that please?
Also one tries to use a predefined type or such to avoid too much typing.
I think that it is also valid to use a #defined or inlined function to represent
the hairy assignment. I.e. something like:
#define fsrub(addr) (*((unsigned char*)addr))
#define fsruw(addr) (*((unsigned short*)addr))
...
Then one could write:
fsrub(LFSR) = my_usqrt(fsrub(LFSR) + bias); ...
Defining the above as functions during debug time can add the possibility of
argument type and range checking, to be followed by recompilation with suitable
#defined flags to use the presumably shorter #defined code.
-- Peter
<loom.20100706T091311-255@post.gmane.org> 7bit
See also: www.piclist.com/techref/microchip/languages.htm?key=c
Reply
You must be a member of the
piclist mailing list
(not only a www.piclist.com member) to post to the
piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
month overview.
new search...