Grant,
As long as all the defines are in one file you can change pins with
impact on just one file.
Atomic bit set/clr instructions have not always been available, and
where port access may happen in different tasks it was common practice
to use a global variable to keep the state of hardware. Then the mask
operations and writing to the hardware was protected by critical.
Bit set/clear doesn't always work across RAM, i.e. AVR, so getting used
to the clumsy mask style may be necessary.
BTW, the PDP-11 was my favorite machine. Interrupt routines on it
could be written that used NO registers because RAM memory could be
used as pointers with post increment/decrement operations.
Sincerely,
David Smead
www.amplepower.com
www.amplepower.net
On Tue, 4 Jul 2006, Grant Edwards wrote:
On 2006-07-04, David Smead <[email protected]> wrote:
You can define all ports and pins in a single file and only need to
change that file if you move pins around. I always put defines in
io_pins.h and do the following
#define ADC_ENABLE_BIT 0x08
#define ADC_PORT P3OUT
#define ADC_ENABLE ( ADC_PORT |= ADC_ENABLE_BIT )
#define ADC_DISABLE ( ADC_PORT &= ~(ADC_ENABLE_BIT) )
True. For some reason I've always found that clumsy. For one
thing need a third definition for reading the bit:
#define ADC_ENABLE (ADC_PORT & ADC_ENABLE_BIT)
Except that conflicts with with the macro you use to set bit.
It always seemed so much cleaner to just do this:
#define ADCEnable P3OUTb.b3
--
Grant Edwards
[email protected]
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Mspgcc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users