mikroC Pro 4.80 wrong jump address

Beta Testing discussion on mikroC PRO for PIC.
Post Reply
Author
Message
CUR-Systemtechnik
Posts: 4
Joined: 16 Mar 2011 10:16

mikroC Pro 4.80 wrong jump address

#1 Post by CUR-Systemtechnik » 15 Apr 2011 12:42

Hi,

I´m working with the newly supported PIC16F1829 and I´m trying to adapt a firmware to the new controller. After 2 days looking for the error I found the problem, and in my opinion it is not in the firmware...

Below you find a Code-Snippet, where the error happens:

Code: Select all

void interrupt()
{
        if (PIR1.RCIF)                        //Serieller Empfangsinterrupt
        {
                komRxData = RCREG;
                eventKomRX = 1;
        }
        else if (PIR1.TMR2IF)                //Timer 2 Interrupt
        {
          .....   


if PIR1.RCIF is false, the program should jump to "else if ...", but it does a jump somewhere in my program. I examined the Assembler Code and Listing. In assembler, its:

Code: Select all

;.c,294 :: 		if (PIR1.RCIF)                        //Serieller Empfangsinterrupt
	BTFSS      PIR1+0, 5
	GOTO       L_interrupt34
;.c,297 :: 		komRxData = RCREG;
	MOVF       RCREG+0, 0
	MOVWF      _komRxData+0
;.c,298 :: 		eventKomRX = 1;
	BSF        _event_bits0+0, 3
;.c,300 :: 		}
	GOTO       L_interrupt35
L_interrupt34:
;.c,303 :: 		else if (PIR1.TMR2IF)                //Timer 2 Interrupt
	BTFSS      PIR1+0, 1
L_interrupt34 is on address 0x002D, but the program jumps to address 0x082D (this is somewhere in the program). Seems that there is a bug in setting the address register.

This error happens on both, the chip and the simulator.

Best regards
Patric

User avatar
slavisa.zlatanovic
mikroElektronika team
Posts: 1321
Joined: 07 Apr 2009 09:39

Re: mikroC Pro 4.80 wrong jump address

#2 Post by slavisa.zlatanovic » 18 Apr 2011 13:31

Hi!

Please, create a minimal project that depicts the issue you're talking about and send it to my email:
slavisa.zlatanovic@mikroe.com
I'll inspect it and suggest further steps.
Best regards
Slavisa

CUR-Systemtechnik
Posts: 4
Joined: 16 Mar 2011 10:16

Re: mikroC Pro 4.80 wrong jump address

#3 Post by CUR-Systemtechnik » 25 May 2011 10:11

Hi Slavisa,

I sent you 3 emails but got no reply from you. So I try it here.

Below you find a minimal program that can reproduce the error. I figured out, that it only happens, if the program counter before the Interrupt is greater than 0x0800. Thats why the program is filled with nop's.

To reproduce, compile the project and start simulation. Let simulation run for a few ms, then Click "Jump to Interrupt". Now, then you press Step Into (next instruction) it comes to "if (PIR1.RCIF) " (the goto statement in Assembler), and the program jumps to Address 0x080D except of 0x000D.

I hope you can reproduce the error and fix it. If you want to, you can send me a new version of the compiler so i can test it out.

It would be nice if you can tell me, when you planned to release a new version without that error due to a time critical project I am working on.

Best Regards
Attachments
mikroE Bug wrong jump address.rar
Minimal Project, that can reproduce that error.
(1.31 KiB) Downloaded 273 times

p.erasmus
Posts: 3391
Joined: 05 Mar 2009 10:28

Re: mikroC Pro 4.80 wrong jump address

#4 Post by p.erasmus » 26 May 2011 09:39

My advise would be that you find a work around yourself:
This Tread of mine I am waiting now close to 2 months for an answer .
http://www.mikroe.com/forum/viewtopic.php?f=101&t=31600
P.Erasmus
Saratov,Russia
--------------------------------------------------------------

User avatar
rajkovic
mikroElektronika team
Posts: 694
Joined: 16 Aug 2004 12:40

Re: mikroC Pro 4.80 wrong jump address

#5 Post by rajkovic » 26 May 2011 12:09

CUR-Systemtechnik wrote:Hi Slavisa,

I sent you 3 emails but got no reply from you. So I try it here.

Below you find a minimal program that can reproduce the error. I figured out, that it only happens, if the program counter before the Interrupt is greater than 0x0800. Thats why the program is filled with nop's.

To reproduce, compile the project and start simulation. Let simulation run for a few ms, then Click "Jump to Interrupt". Now, then you press Step Into (next instruction) it comes to "if (PIR1.RCIF) " (the goto statement in Assembler), and the program jumps to Address 0x080D except of 0x000D.

I hope you can reproduce the error and fix it. If you want to, you can send me a new version of the compiler so i can test it out.

It would be nice if you can tell me, when you planned to release a new version without that error due to a time critical project I am working on.

Best Regards

Sorry for Delay, Slavisa has manged not to report this issuse to SW department. We have reproduced and fixed this error.
Until you got new version which we expect in about 3 weeks,
you can make workaround (this bug affect p16Enhced family only)

Code: Select all

// you must put this 2 asm instruction at beging of interrupt
void interrupt(){
 asm CLRF PCLATH
 asm CLRF STATUS
 

}

this will work on MCU.

There is bug in IDE simulator does not perform saving PCLATH in shadow set
so simulation will not be correct, but it will work in MCU.

We have fixed this error.
Thank you for report and sorry for inconvenience.

CUR-Systemtechnik
Posts: 4
Joined: 16 Mar 2011 10:16

Re: mikroC Pro 4.80 wrong jump address

#6 Post by CUR-Systemtechnik » 27 May 2011 07:41

I thank you for the fast response and finding a workaround for this problem! I will try it out and report you if it works.

Best Regards!

CUR-Systemtechnik
Posts: 4
Joined: 16 Mar 2011 10:16

Re: mikroC Pro 4.80 wrong jump address

#7 Post by CUR-Systemtechnik » 10 Jun 2011 07:52

Thank you for the workaround, this works fine on MCU.

I think it was luck that someone found that issue, because there is still no support for this MCU in PICFlash. I think when you release a beta Version with new MCU-Support, people must be able to program this MCU with mikroE Hardware.
I was glad to have a PICkit3, that already supports it.

Best Regards

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

Re: mikroC Pro 4.80 wrong jump address

#8 Post by janni » 23 Jun 2011 16:36

rajkovic wrote:There is bug in IDE simulator does not perform saving PCLATH in shadow set
so simulation will not be correct, but it will work in MCU.

We have fixed this error.
Did you also add FSRs saving?

User avatar
rajkovic
mikroElektronika team
Posts: 694
Joined: 16 Aug 2004 12:40

Re: mikroC Pro 4.80 wrong jump address

#9 Post by rajkovic » 24 Jun 2011 10:58

janni wrote:Did you also add FSRs saving?
This is complete list

STATUS
WREG
BSR
PCLATH
FSR0L
FSR0H
FSR1L
FSR1H

all shadow registers


Post Reply

Return to “mikroC PRO for PIC Beta Testing”