Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

pic18f4680 / 4550 calling functions

2008-09-30
2013-03-12
  • Hello,

    The following code works like a charm on a pic18f4550.
    Output on the serial port is "A6A6A6A6A6A6A6A".

    Now compiling exactly the same source code (or even using the hex-file for the 4550) for a pic18f4680 produces the following output:
    "A≥A„AACAsA£A”A"
    The parameter '6' in test_func is somehow not properly transmitted to the function?!

    Has anyone else seen this behaviour? what can i do to resolve it?
    Might it be related to the sdcc compiler? or is it just my code?

    sdcc -v
    SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 2.8.4 #5242 (Sep 28 2008) (Mac OS X i386)
    (other versions of sdcc produce the same behaviour)

    Nice greetings,
    Georges

    typedef unsigned char uchar;

    uchar test_func(uchar x) {
      return x+48;
    }

    void main(void) {
      ...

      while(1) {
        uart_writeByte('A');
        uart_writeByte(test_func(6));
      }
    }