I'm glad you got it working.
scswift:
Also I am now pulling my hair out over this:#define WAIT asm volatile ("nop\n\t"
"nop\n\t");I get the error "unexpected unqulified id before stirng constant".
When a macro definition spans more than one line, you need to put a \ at the end of each line except the first, so that the compiler knows that the following line is part of the macro definition.