Re: char=int
- From: Neil Kurzman <nsk@xxxxxxxxxxxx>
- Date: Sat, 15 Oct 2005 06:40:35 GMT
bvermeersch@xxxxxxxxx wrote:
> Hello,
>
> I found this in some else's code:
> ...
> void write_E2(unsigned int address, unsigned char data)
> {
> EEADR = address;
> EEADRH = (address >> 8);
> //The EEADRH:EEADR register pair is used to address
> //the data EEPROM for read and write operations.
> //EEADRH holds the two MSbits of the address; the
> //upper 6 bits are ignored. The 10-bit range of the pair
> //can address a memory range of 1024 bytes (00h to
> //3FFh).
> ...
> Is this a correct way of doing if you know:
> ...
> extern volatile near unsigned char EEADR;
> ...
>
> This means putting an int into a char.
> will it choose the right byte, where can i find info about this?
>
> Kind regards, Jef
No
AChar = (char)AnInt; // It is called a "Cast"
The code you have says it writes to an EEPROM (Memory chip)
.
- Prev by Date: Re: Where is my mistake? Now no more mistake
- Next by Date: Re: Size of structs containing unions
- Previous by thread: Use of static ?
- Next by thread: please tell the websites
- Index(es):
Relevant Pages
|