Hi,

oke, I will file a bug tomorrow.. this was one hell of a debugging session since last friday (60+h).
It seems to be a general problem with arrays. I found another (probably similar) problem with this line of code :
    TXREG = uart_start_condition[uart_tx_start_condition_index++];

Here uart_tx_start_condition_index won't be incremented.

I'll check the assembly code tomorrow, because i don't have internet on my laptop in linux (my mate-desktop decided to disable the wlan-connection for today...).

Cheers,
Oli

Am 25.02.2014 22:30, schrieb Raphael Neider:

Hi,
On Feb 25, 2014 10:21 PM, "Oliver Meier" <h2obrain@gmail.com> wrote:
>
> When I assign a value from an array of structs to another variable and
> do some math on the same line, I get ot wrong values.
>
> ### wrong value ###
> ;    .line    87; src/modules/app_ep1_out.c    uart_tx_buffer_LEN =
> ep_bdt[2].Cnt-1;
>      MOVFF    (_ep_bdt + 9), (_ep_bdt + 9)
>      DECF    (_ep_bdt + 9), W, B
>      BANKSEL    _uart_tx_buffer_LEN
>      MOVWF    _uart_tx_buffer_LEN, B
>
> uart_tx_buffer_LEN => 216

We are missing a banksel before the decf instruction (i. e., we should expect to have banksel _ep_bdt+9 instead of the movff instruction). That is obviously a bug. Please consider filing this work the bug tracker so it does not get lost.

> I'm really bad at assembler, but maye you see the error here?

For one "really bad in assembly" you managed to pin point the problem rather well - impressive ;-).

> Or is it probably a stack overflow or something?

No, not this time.

Kind regards,
Raphael