Hi Kiste, Hmm, my next puzzle for the weekend. Can you send a complete sample program that I can use? It will save me time.
BTW. Did you already test the new build compiler that solves the memory issue? Thanks. Kind regards, Rob ________________________________ Van: 'Oliver Seitz' via jallib <[email protected]> Verzonden: vrijdag 27 november 2020 07:44 Aan: Jallib <[email protected]> Onderwerp: [jallib] Compiler doesn't honour "volatile" Sorry... This isn't in fact the proper list for compiler issues, is it? This one is probably more severe. I'll start with the example. This is the data I've received: ?2807 2808 1 ?2807 2809 2 ?2807 2810 2 ?2807 2811 4 ?2807 2812 4 ?2807 2813 6 ?2807 2814 7 ?2807 2815 8 ?2807 2816 264 It's generated from this part of code, running on an PIC18F27K42. extra_time is increased in an interrupt every 16 seconds. It is declared as var volatile word, so the compiler should make sure that the bytes of the variable are in a consistent state: diff=word(extra_time-last_pulse_time_uw) if print_debug then print_debug=false serial="?" print_word_dec(serial,last_pulse_time_uw) serial=" " print_word_dec(serial,extra_time) serial=" " print_dword_dec(serial,diff) print_crlf(serial) end if Let me repeat some of the results above in hex: AFE-AF7 =7 AFF-AF7 =8 B00-AF7 =108 So, what has happened? The last line is clearly wrong. The subtraction was done just as extra_time was in the process of increasing. The low byte was processed before, the high byte was processed after the interrupt fired. So the actual subtraction done was BFF-AF7, with the result of 108. I've had a look at the asm file. Both bytes of the variable are just handled one after the other, both in the main program and in the interrupt service routine. The "volatile" declaration does not seem to do anything. Greets, Kiste -- You received this message because you are subscribed to the Google Groups "jallib" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]<mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/jallib/1713803051.2007385.1606459457507%40mail.yahoo.com<https://groups.google.com/d/msgid/jallib/1713803051.2007385.1606459457507%40mail.yahoo.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "jallib" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jallib/AM0PR07MB6241378E01DF90BC2AFE3E46E6F80%40AM0PR07MB6241.eurprd07.prod.outlook.com.
