Re: port I/O abstraction macros



"DAC" <Mister@xxxxxxxxxx> wrote in message
news:448155af$0$29269$afc38c87@xxxxxxxxxxxxxxxxxxxxxxx

"Tom Torfs" <tomtorfs@xxxxxxxxx> wrote in message
news:1149274847.733281.46970@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Everyone,

Earlier I posted some macros that allow you to easily define binary
constants in C (see http://cprog.tomsweb.net/binconst.txt). Playing
similar tricks with the preprocessor, I now created some macros that
allow you to make easy abstraction of port I/O's. It's written for the
MSP430 but the concept can be applied to other embedded architectures.

You simply define your signal location like:
#define LED P1,0
and then use them like:
SETDIR(LED);
CLR(LED);
TOGGLE(LED);

We take on alot of intern students and student projects etc. and I have
always found their ability to do bitwise manipulation in C to be
completely hopeless. What are universities teaching them these days? Its
the year 2006 and they still come out knowing how to program an 8051 in
assembly but not knowing what c &= ~(1<<4); does.

I must say that I graduated in 2001 from a Computer Systems course and at no
point was bitwise manipulation even mentioned unless you took a module
rather unhelpfully named as "industrial control" which scared people off
with talk of dull ladder diagrams but was actually assembly language
programming of PICs. Good course in fact but under-subscribed because no-one
was sure what it actually was.

My degree was a hybrid so I mixed with the Computer Scientists and the
Electronic Engineers but neither of them would have even seen an embedded
system without going on the industrial control module. The closest the EE
guys got was an ancient 6800 programmed in hex via a 16 key keypad but it
was only for one lab class and you just followed the crib *** without
having to understand what you were doing.


.


Quantcast