Dear acehigh99,
PORTA is a memory location. When used as a rvalue (ie. on the right of an assignment) its contents are used, so the line:
LAST_COIL_CTL = COIL_05_CTL;
Just copies the _contents_ of PORTA to LAST_COIL_CTL.
Your code is doing something like the following:
int i;
int j;
......
j = i ;
j = 33;
but you are expecting i to change!
The following code will do what you want (for a different CPU but changes should be obvious):
#include <hidef.h> /* for EnableInterrupts macro */
#include "derivative.h" /* include peripheral declarations */
typedef unsigned char U8;
#define COIL_05_CTL PTAD
#define COIL_05_PIN (1<<5)
U8 *LAST_COIL_CTL;
U8 LAST_COIL_PIN;
void main(void) {
EnableInterrupts; /* enable interrupts */
/* include your code here */
LAST_COIL_CTL = &COIL_05_CTL; // Assign coil 5
LAST_COIL_PIN = COIL_05_PIN; // Assign coil 5 pin
*LAST_COIL_CTL &= (~LAST_COIL_PIN); // Turn off pin 5 of PORT A
}
Hope this helps.
A further tip - It is sometimes useful to to look at the Pre-processed code to see how you macros expand. You can do this by right-clicking and select Preprocess. You can also look at the assembly language generated by selecting Disassemble on the same menu.
bye