Jump to content

Hiker

EstablishedMember
  • Content count

    11
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Hiker

  • Rank
    Newbrie
  1. Xc8 Hitechc To Sourceboost Issues

    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. Problem With Signed Short Type On 18Fxxxx

    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 can we expect the error to be corrected? BoostC Compiler Version 7.03 for PIC18, MPLAB v8.63, Win7 Pro 64
  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. Errors In Square Root Function?

    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 my PC, there are problems with the sqrt() routine, and sqrt1() gives true result by the square numbers: Cntr, Square, Root, Root1 17, 289, 16, 17 33, 1089, 32, 33 34, 1156, 32, 34 35, 1225, 32, 35 65, 4225, 64, 65 66, 4356, 64, 66 67, 4489, 64, 67 68, 4624, 64, 68 69, 4761, 64, 69 70, 4900, 64, 70 71, 5041, 64, 71 97, 9409, 96, 97 129, 16641, 128, 129 130, 16900, 128, 130 131, 17161, 128, 131 132, 17424, 128, 132 133, 17689, 128, 133 134, 17956, 128, 134 135, 18225, 128, 135 136, 18496, 128, 136 137, 18769, 128, 137 138, 19044, 128, 138 139, 19321, 128, 139 140, 19600, 128, 140 141, 19881, 128, 141 142, 20164, 128, 142 143, 20449, 128, 143 193, 37249, 192, 193 194, 37636, 192, 194 I have not tried to find out how the rounding is, at the intermediate values between the square numbers. My setup is: Win XP, En, SP3 MPLAB v8.40 BoostC v6.97 Target: PIC18F67J10
×