On 2006-07-04, David Smead <sm...@amplepower.net> 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
gra...@visi.com



Reply via email to