avr-chat
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-chat] HELP! mega128 USART receive restarts execution


From: David Kelly
Subject: Re: [avr-chat] HELP! mega128 USART receive restarts execution
Date: Sun, 12 Feb 2006 18:24:14 -0600


On Feb 12, 2006, at 1:21 PM, Rick Mann wrote:

If starting from scratch I usually write something like this:

#define TXCIE0_b  (6)
#define TXCIE0_m  (1<<TXCIE0_b)

Traditionally, Mac OS APIs were written like this, giving both a bit number and a mask value.

That is likely where I picked up the habit.

However, the technique doesn't let you explicitly show which bits you want to be zero.

This loops us back around to Larry's concern about the ! not doing what he expected. OR all the _m's that you want to set to ones, then AND ~TXCIE0_m's to clear.

What I'd really rather have is the entire UART abstracted in a struct with overlapping unions and bitfields. IIRC not all the relevant registers were grouped together, and UART0 and UART1's registers were in wildly different places.

Makes for a terribly huge file and atrocious register names but this is exactly what Motorola/Freescale/Metrowerks did for the HCS12 family.

--
David Kelly N4HHE, address@hidden
========================================================================
Whom computers would destroy, they must first drive mad.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]