EmbeddedRelated.com
Forums

FIO and interrupt disabling

Started by brian_myers888 November 11, 2008
--- In l..., Mike Harrison wrote:

>
> About the only time FIOMASK can be useful is where you want to write
simultaneous arbitary 0 and 1
> values to a subset of port bits, AND maximum possible speed is
essential.
> Unless performance is critical, even this is better done with a
combination of FIOSET and FIOCLR
> operations, as FIOMASK is fraught with the sort of dangers you
appear to be experiencing, and its
> use should be avoided unless there really is no alternative.
>

Yes, I understand what you're saying - but, just to be clear, you're
talking about writing FIOPIN in conjunction with FIOMASK (as opposed
to FIOSET and FIOCLR). Because as you say, you can't simultaneously
set and clear different pins at the exact same time without using
FIOPIN. I don't have any requirement to do that.

An Engineer's Guide to the LPC2100 Series

On Wed, 12 Nov 2008 00:19:08 -0000, you wrote:

>--- In l..., Mike Harrison wrote:
>
>>
>> About the only time FIOMASK can be useful is where you want to write
>simultaneous arbitary 0 and 1
>> values to a subset of port bits, AND maximum possible speed is
>essential.
>> Unless performance is critical, even this is better done with a
>combination of FIOSET and FIOCLR
>> operations, as FIOMASK is fraught with the sort of dangers you
>appear to be experiencing, and its
>> use should be avoided unless there really is no alternative.
>>Yes, I understand what you're saying - but, just to be clear, you're
>talking about writing FIOPIN in conjunction with FIOMASK (as opposed
>to FIOSET and FIOCLR).

Yes - if you really need to write the 1's and 0's simultaneously then you'd set up FIOMASK and write
to FIOPIN, otherwise in most cases it would be better to use FIOSET and FIOCLR.

Thanks to all for your input.

The issue is resolved - I chopped out the masking and un-masking
everywhere GPIO pins were set, cleared or checked, and removed the
accompanying interrupt disable/enable code - much nicer. Mask
registers are now set up once at startup and not touched again. Thanks
all for the advice.

I'll get a small speedup, and code size reduction in the deal too :-)