Hi Jim Dougherty and friends,
Thank you so much for your mail.
Actually this "BASE" is not a register it is a memory location.
I am actually new to C.
Then can i do like this.
In file1.h i will define
#define BASE (0x00800000) // address of BASE
In file2.h i will define
#define base_ptr ((volatile unsigned char *)BASE)
then i will change the following statements as
> *((volatile uint *) 0x00850000) = 0x000a0041;
> *((volatile uint *) 0x00850004) = 0x00870000;
*BASE+0x50000 = 0x000a0041;
*BASE+0x50004 = *BASE+70000;
Please kindly help me...
I must define a base_ptr in file2.h and then i should be able to use it.
I will be waiting for your reply.
Thanks & Regards,
SS...
Jim Dougherty <[EMAIL PROTECTED]> wrote: [email protected] wrote:
> Hi Friends,
>
> I have defined a variable in file1.h as
>
> #define BASE (0x00800000) // address of BASE
>
> and i defined a pointer to the same variable as in file2.h
>
> #define base_ptr (volatile uint *) BASE)
>
> Now my requirement is i have to change the following statements by
> using the base_ptr which i defined in file2.h
>
> *((volatile uint *) 0x00850000) = 0x000a0041;
> *((volatile uint *) 0x00850004) = 0x00870000;
>
> can i do like this
>
> *((volatile uint *) (ibuf_base_ptr+0x50000))= 0x000a0041;
> *((volatile uint *) (ibuf_base_ptr+0x50004))= (ibuf_base_ptr+70000);
>
> I tried in so many ways but didn't get it.
> Can you please help me .
> With Regards,
> ss...
>
I do this type of stuff a lot for accessing hardware registers (real time
machine control applications) and here is an example of how I do it:
#define BASE_ADDRESS 0x01000
#define SYSTEM_CONTROL_REGISTER *((unsigned char far *)(BASE_ADDRESS + 0x22))
To read from the register:
unsigned char temp;
temp = SYSTEM_CONTROL_REGISTER;
To write to the register:
SYSTEM_CONTROL_REGISTER = ;
In your case, this is what I would do (change the names to something more
meaningful:
#define BASE (0x00800000)
#define REGISTER1 *((volatile uint *) (BASE+0x50000))
#define REGISTER2 *((volatile uint *) (BASE+0x50004))
REGISTER1 = 0x000a0041;
REGISTER2 = 0x00870000;
To unsubscribe, send a blank message to .
Yahoo! Groups Links
[Non-text portions of this message have been removed]