Jump to content

jusic

Members
  • Content Count

    3
  • Joined

  • Last visited

Community Reputation

0 Neutral

About jusic

  • Rank
    Newbrie
  1. My previous post was quite long, wrong title, and didn't contain code which could be easily tested by others, so I try to be more precise this time. Bug Description: status,z -flag is not updated when using if(var != 0) and maximal optimization (used as default optimization ?) Steps to reproduce: Copy the code below and build it with maximal optimization (Settings -> Options -> Optimization) //bug.c // this program turns on all PORTB pins, if everything works void main() { char result = 0; TRISB=0; PORTB=0; while(1) { result=1; //asm movf _result_main,w;
  2. Whops, that last code snip came from the "magic line uncommented version", sorry Here's the asm code without the 'magic line': ;;;;snip ;;;;;;;; //rpyptr++;////////////////////// magic line ;;;;;;;; ;;;;;;;; ;;;;;;;; return 1; movlw D'1' goto destrRS232WaitReply return ;;;;snip
  3. The problem occurs in this part of code I wrote: result = RS232WaitReply(200, "OK^"); if(result != 0) RS232SendCmd("yes\r\n^"); else if(result == 0) RS232SendCmd("no\r\n^"); Let's see what there is in asm: ;;;snip call _RS232WaitReply bcf STATUS, RP0 bcf STATUS, RP1 movwf _result_main ;;;;;;;; if(result != 0) btfsc STATUS, Z ;;; Z flag is not updated! goto label_0004 ;;;snip Here is that wait reply function: char RS232WaitReply( short timeout, const char *reply) { char rpyptr = 0; char temp = 0; for (Time=0; Time<timeout;) // loop until timeout {
×
×
  • Create New...