Coming from the assembler world I like to check, double check and triple check all the code MikroC generates. Today I found a annoying problem with BRA operand, here is an example:
PIC18F1847, simple check for a bit and BRAnch to the check point again if set:
Code: Select all
void chk_go(){
asm{
movlb 1; // banksel ADRESL, ADRESH, ADCON0
bsf ADCON0,GO;
rechk:
btfsc ADCON0,GO;
BRA $-1; // the BRAnch addres is not calculated properly
// BRA rechk; doesn't work either
// but goto $-1; or goto rechk; has no problems
....
....
}