Jump to content

janne_aac

Members
  • Content Count

    1
  • Joined

  • Last visited

Community Reputation

0 Neutral

About janne_aac

  • Rank
    Newbrie
  1. Hi Folks, I am seeing a very odd behaviour. This is roughly my test program: void testFunc(char test) { if(test > 3) { LED0_on(); //Turn on LED 0 } else { LED1_on(); //Turn on LED 1 } } ….. testFunc(1); ….. I almost cant believe what I am seeing but what happens is that LED 0 is switched on. How can 1 > 3 be true??? This seems to work correctly: void testFunc(char test) { if(test < 3) { LED0_on(); //Turn on LED 0 } else { LED1_on(); //Turn on LED 1 } } ….. testFunc(4); ….. => LED 1 turns on When I look at the ASM file of the first program I see this which also looks odd: MOVF test_Func_00000_arg_test, W SUBLW 0x03 BTFSC STATUS,C GOTO label1 ..... {if...} label1 {else} Shouldn't SUBWF be used instead of SUBLW?
×
×
  • Create New...