ISSUE – Destination and RAM access bit specified

This used to be requried for asm code when you wanted to tell it the ,d and ,a bits of the instruction:

near static unsigned char uc_asm_irq_temp;		// near qualifier specifies access RAM
near static unsigned char uc_asm_irq_temp1;

		movlw	0xcb
		addwf	_uc_asm_irq_temp,f,c			//(1 = file register, 0 = access ram)
		movlw	0xf3
		addwfc	_uc_asm_irq_temp1,f,c			//(1 = file register, 0 = access ram)

In a Microchip lets make like difficuilt for programmers step the 1 and 0 values the PIC device datasheets specify for theser bits can'#t actually be used, so ,f and ,c have to be used instead,  However not they don's seem to work either (2017-05) and to get the instructions above to work properly we have to change them to this:

		movlw	0xcb
		addwf	_uc_asm_irq_temp
		movlw	0x63
		addwfc	_uc_asm_irq_temp1

So the full code in our heartbeat timer which works is now:

		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	0xcb
		addwf	_uc_asm_irq_temp
		movlw	0x63
		addwfc	_uc_asm_irq_temp1
		movff	_uc_asm_irq_temp1,TMR0H			//Store new value (high byte first)
		movff	_uc_asm_irq_temp,TMR0L



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.


Your email address will not be published.