#asm
	GLOBAL _uc_asm_irq_temp
	GLOBAL _uc_asm_irq_temp1
	//Reset timer for next rollover
	movff	TMR0L,_uc_asm_irq_temp			//read_current_timer_value (read low byte loads high byte)
	movff	TMR0H,_uc_asm_irq_temp1
	movlw	0xfb
	addwf	_uc_asm_irq_temp,1,0				//(1 = file register, 0 = access ram)
	movlw	0xd8
	addwfc	_uc_asm_irq_temp1,1,0			//(1 = file register, 0 = access ram)
	movff	_uc_asm_irq_temp1,TMR0H			//Store new value (high byte first)
	movff	_uc_asm_irq_temp,TMR0L
	#endasm

Newer versions of XC8 generate a "error: (876) syntax error" to the use of the above. It turns out ",1,0" on the end of the addwf and addwfc lines are the issue (even though these numeric values are specified for use in device datasheets).  

The '1' needs to change to 'f' for file register.

The '0' needs to change to 'c' for common memory / access ram (the alternative would be 'b' for bank select register.

See XC8 user guide in section 6.2.1 


#asm
	GLOBAL _uc_asm_irq_temp
	GLOBAL _uc_asm_irq_temp1
	//Reset timer for next rollover
	movff	TMR0L,_uc_asm_irq_temp			//read_current_timer_value (read low byte loads high byte)
	movff	TMR0H,_uc_asm_irq_temp1
	movlw	0xfb
	addwf	_uc_asm_irq_temp,f,c				//(1 = file register, 0 = access ram)
	movlw	0xd8
	addwfc	_uc_asm_irq_temp1,f,c			//(1 = file register, 0 = access ram)
	movff	_uc_asm_irq_temp1,TMR0H			//Store new value (high byte first)
	movff	_uc_asm_irq_temp,TMR0L
	#endasm

 

USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.

Comments

Your email address will not be published. Required fields are marked *