error 876 syntax error for using movwf inline asm for PIC16f

This forum handles questions and discussions concerning Microchip’s 8-bit compilers, assemblers, linkers and related tools.

error 876 syntax error for using movwf inline asm for PIC16f

Postby wolfrose » Sat Jan 06, 2024 11:07 am

Hi,

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 ?
wolfrose
 
Posts: 2
Joined: Wed Feb 03, 2016 4:38 am

Re: error 876 syntax error for using movwf inline asm for PI

Postby wolfrose » Sat Jan 06, 2024 9:58 pm

OK I removed the `,a` and the code compiled successfully.
wolfrose
 
Posts: 2
Joined: Wed Feb 03, 2016 4:38 am

Re: error 876 syntax error for using movwf inline asm for PI

Postby ric » Sat Jan 13, 2024 7:38 am

Indeed, PIC16F chips don't have an "Access Bank", so don't use that suffix.
Latest test project, an LED matrix display made from one reel of addressable LEDs. here
User avatar
ric
Verified identity
 
Posts: 661
Joined: Sat May 24, 2014 2:35 pm
Location: Melbourne, Australia
PIC experience: Professional 5+ years with MCHP products


Return to MPLAB XC8

Who is online

Users browsing this forum: No registered users and 1 guest

cron