I want to port a code from PIC18f46k22 to PIC16f877A for education purposes, I know PIC16f877A is an old chip but the warehouse has PIC16f877A as the best chips available. And it's more than enough for diploma students. For me I personally have PIC18f46k22 as my go-to PIC development set.
So, when I ported the code, everything works ok, but this inline asm didn't work:
- Code: Select all
asm("movwf ?_millis+0,a ");
In this function:
- Code: Select all
uint32_t millis(void)
{
asm("bcf INTCON,"___mkstr(_INTCON_GIE_POSN));
asm("movf __tmr1_ms+0,w ");
asm("movwf ?_millis+0,a ");
// asm("movf __tmr1_ms+1,w ");
// asm("movwf ?_millis+1,a ");
// asm("movf __tmr1_ms+2,w ");
// asm("movwf ?_millis+2,a ");
// asm("movf __tmr1_ms+3,w ");
// asm("movwf ?_millis+3,a ");
asm("retfie "); // return millis with GIEH = 1;
return 0;
}
What to do ?