Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Hiker

  • Rank
  1. I only have a partial answer to the questions. The delay routines is with an unsigned char argument, and when the compiler does not warn about to large constants, you will only get 244 mSec delay in the example. Generally I do not use these routines for more than small single digit microseconds, as it is an empty loop that blocks the processor to perform all other tasks than interrupts.
  2. Hi This post may be a little off topic - more towards algorithms. The line: accumulated_value * = -1L; Can be rewritten as: accumulated_value = -accumulated_value; As compiles inline, to a few instructions, without calls to subroutines. I have only tested on the v7.22 compiler, with PIC18F87J10 as target, but here uses 10 instructions in total.
  3. Whether it is a writing error, I do not know, but there are no comma after the address? So that line should be: #pragma DATA 0xBC00, 0x11, 0x22, 0x33, 0x44
  4. I have also had problems with comparisons between Interger and constants. My results show a pattern that only a few combinations of small negative constants (8 bit) there are problems with. if(SignInt >= -20) if(SignInt > -21) // Error // if(SignInt <= -20) // Error // if(SignInt < -19) if(SignInt <= 20) if(SignInt < 21) if(SignInt >= 20) if(SignInt > 19) if(SignInt >= -300) if(SignInt > -301) if(SignInt <= -300) if(SignInt < -299) if(SignInt <= 300) if(SignInt < 301) if(SignInt >= 300) if(SignInt > 299) When c
  5. I can't find the ANSELL register in the listing? All portbits with ADC function, initializes as ADC and then read as low. And so it goes wrong with the bit set and bit clear instructions. My guess is that both outputs have five cycles high?
  6. When will the Version Log page will be updated with the v7.04 changes?
  7. Hello again Now I finally have time to test whether my problem is solved with BoostC v7.03 At the exact square numbers both sqrt() and sqrt1() gives the correct result. But the values between the squares numbers, it appears that sqrt() always rounds down to nearest integer and sqrt1() rounds to the nearest integer. The most accurate result is still sqrt1(), except when you reach over 65280 (255.5^2) where the return value is rounded up to 256 and returned as a zero.
  8. It is the right method, but I do not agree with the specified constant - instructions and configuration is 14 bits wide, and it should give a 0x3FFF mask.
  9. I have not gone through the complete listing, but try putting the following to OFF instead: // Extended Instruction Set: #pragma config XINST = ON // Enabled
  10. I have not tried with the following command line switch to Boost Link: There is a bit more description on page 24 of BoostC.pdf version 7 file.
  11. Hi I found something I see as an arithmetic error in the sqrt() function. Initially, I chose to use the sqrt1() function, when it immediately seemed to work as expected. But to be sure that there were errors, I tried to write a small test routine: unsigned int Cntr, Square, Root, Root1; // DebugPrint("Cntr, Square, Root, Root1"); for(Cntr = 0; Cntr <= 255; Cntr++) { Square = Cntr * Cntr; Root = sqrt(Square); Root1 = sqrt1(Square); if((Root != Cntr) || (Root1 != Cntr)) // DebugPrint("%4u,%7u,%5u,%5u", Cntr, Square, Root, Root1); } And the result shows that, on
  • Create New...