Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.
i've figured it out on my own. It's pretty good and allows for fast development, i've completed an IR comm project since my first posting. For notorious ASM programmers, one easy way to access absolute registers is to define them as volatile i.e. :
__no_init volatile __bank0 unsigned char myReg @ 0x20; // myReg EQU 0x20
For bitwise access i.e. (BSF myReg, 2) you must use a struct:
__no_init volatile __bank0 union
unsigned char parityReg;
unsigned char parityReg0:1;
unsigned char parityReg1:1;
unsigned char parityReg2:1;
unsigned char parityReg3:1;
unsigned char parityReg4:1;
unsigned char parityReg5:1;
unsigned char parityReg6:1;
unsigned char parityReg7:1;
} @ 0x2B;
Variable declarations need not always be declared as volatile but can be declared as local within any other function.
As I kept reading i've used less and less inline asm i.e. asm("CLRW"); The complier is really good and i've found out that you start to think more in C than asm.
Other things that i've stumbled upon are interrupt functions. I remember reading somwhere that a function while in the ISR cannot return a value, so i use an emulated return as follows:
1) declare your function to be called in the ISR as void
2) declare a -bitwise access- RETURN REGISTER as above (this can hold the boolean return status of 8 functions)
3) before 'return' from that function bit set or clear a bit in RETURN REG as required
4) within your ISR check this bit to see the status