[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] PORT access
From: |
Àíäðåé |
Subject: |
Re: [avr-gcc-list] PORT access |
Date: |
Thu, 17 May 2001 00:13:13 +0400 |
Hi.
It should work.
void modify_port(u08 adr, u08 mask, u08 data)
{
u08* pp;
u08 tmp;
pp = (u08*)adr;
pp += 0x20;
tmp = *pp;
tmp &= ~mask;
*pp |= (data & tmp);
}
Thursday, April 26, 2001, 7:19:25 PM, you wrote:
> I am using CAN-bus with two MCUs, one is an 8515 and the other is an 8535. I
> would like be able to modify a port using the following example;
> 1: void Modify_Port(u08 address, u08 mask, u08 data)
> 2: {
> 3: u08 tmp;
> 4: tmp = inp(address); // place port reading in tmp
> 5: tmp &= ~mask;
> 6: tmp |= (data & mask);
> 7: outb(tmp, address);
> 8: }
> I made up this example to demonstrate what I am wanting to do. Is there a
> way? This does not work because the value of address is non-constant. I am
> wanting to be able to modify a port in the other MCU via the CAN-bus. Thus,
> controller 'B' could directly set a bit on a port in controller 'A' to sound
> a buzzer. The 'address', 'mask', 'data' is transferred over the CAN-bus.
> Any help would be much appreciated.
> Marlin
> _______________________________________________
> avr-gcc-list mailing list
> address@hidden
> http://avr.jpk.co.nz/mailman/listinfo/avr-gcc-list
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [avr-gcc-list] PORT access,
Àíäðåé <=