Jump to content

C2c++ Cross Page Error


Recommended Posts

Using c2c++ I've this code:

 

07F7 10480 label_0003

07F7 1283 10481 bcf STATUS, RP0

07F8 1303 10482 bcf STATUS, RP1

07F9 0820 10483 movf _oLed1, W

07FA 3C00 10484 sublw D'0'

07FB 3001 10485 movlw 1

07FC 1803 10486 btfsc STATUS, C

07FD 0103 10487 clrw

07FE 3C00 10488 sublw 0

07FF 1903 10489 btfsc STATUS, Z

0800 2802 10490 goto label_0004

0801 03A0 10491 decf _oLed1, F

MPASM 03.90.01 Released SIGERTX2.ASM 4-22-2005 13:20:55 PAGE 199

 

 

LOC OBJECT CODE LINE SOURCE TEXT

VALUE

 

10492 ;;;;;;;; if(oLed2.m_timer>0) oLed2.m_timer--;

0802 10493 label_0004

0802 1283 10494 bcf STATUS, RP0

0803 1303 10495 bcf STATUS, RP1

0804 0824 10496 movf _oLed2, W

0805 3C00 10497 sublw D'0'

0806 158A 10498 bsf PCLATH, 3

0807 120A 10499 bcf PCLATH, 4

0808 3001 10500 movlw 1

0809 158A 10501 bsf PCLATH, 3

080A 120A 10502 bcf PCLATH, 4

080B 1803 10503 btfsc STATUS, C

 

 

As you can note at address 0800 there is a goto, but PCLATH bits are missed so the processor jumps at 0002 instead then 0802.

 

Compiler options were:

- (ticked) Insert default interrupt handler

- (not ticked) One local variabile space

- (ticked) Insert source in assembler

- (ticked) Context saving during interrupt

 

What can I do to avoid this (and I don't known how many hidden bugs like this)?

 

Best Regards

Gianfranco M.

Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...