We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
bit CheckPacket(void) { unsigned char idata *pBuf = g_UART0Buf; unsigned char len, checksum; if (*pBuf == PACKET_START_ID / 256) { pBuf++; if (*pBuf == PACKET_START_ID % 256) { pBuf++; len = *pBuf; checksum = *pBuf; pBuf++; len++; do { checksum += *pBuf; pBuf++; len--; } while (len); if(!checksum) { return 1; } } } return 0; }
; FUNCTION CheckPacket (BEGIN) ; SOURCE LINE # 13 ; SOURCE LINE # 14 ; SOURCE LINE # 15 E MOV R7,#LOW g_UART0Buf ;---- Variable 'pBuf' assigned to Register 'R7' ---- ; SOURCE LINE # 18 MOV R0,AR7 MOV A,@R0 XRL A,#07H R xJNZ ?C0001 ; SOURCE LINE # 19 ; SOURCE LINE # 20 INC R7 ; SOURCE LINE # 21 INC R0 MOV A,@R0 XRL A,#0EH R xJNZ ?C0001 ; SOURCE LINE # 22 ; SOURCE LINE # 23 INC R7 ; SOURCE LINE # 24 INC R0 MOV A,@R0 MOV R6,A ;---- Variable 'len' assigned to Register 'R5' ---- MOV R5,A ; SOURCE LINE # 25 ;---- Variable 'checksum' assigned to Register 'R6' ---- ; SOURCE LINE # 26 INC R7 ; SOURCE LINE # 27 INC R5 ?C0005: ; SOURCE LINE # 29 ; SOURCE LINE # 30 MOV R0,AR7 MOV A,@R0 ADD A,R6 MOV R6,A ; SOURCE LINE # 31 INC R7 ; SOURCE LINE # 32 R DJNZ R5,?C0005 ; SOURCE LINE # 33 ; SOURCE LINE # 34 R xJNZ ?C0001 ; SOURCE LINE # 35 ; SOURCE LINE # 36 SETB C RET ; SOURCE LINE # 37 ; SOURCE LINE # 38 ; SOURCE LINE # 39 ?C0001: ; SOURCE LINE # 40 CLR C ; SOURCE LINE # 41 ?C0007: RET ; FUNCTION CheckPacket (END)
He must have mistyped. Probably meant to say "use less R7".
Try searching the documentation for:
#pragma USE_LESS(Rn)
It might allow you to specify usage of individual registers.
There might also be:
#pragma USE_MORE(Rn)
And finally:
#pragma USE_WITH_EQUAL_AMOUNTS_TO_AVOID_SUGGESTION_OF_FAVOURITISM(Rn)