IF-THEN what?


Closed Thread
Results 1 to 11 of 11

Thread: IF-THEN what?

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,172


    Did you find this post helpful? Yes | No

    Default Re: IF-THEN what?

    Thanks Steve. I am using MCSP and Pickit2 with Stand Alone Driver.

    You are right about the weird things. I had some in the past for un-explained reasons.

    Will see.

    Ioannis

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,172


    Did you find this post helpful? Yes | No

    Default Re: IF-THEN what?

    OK. I think Steve was right.

    I have this test code on a Dropbox folder in order to work on different PCs. On a freshly boot PC, guess what. Works OK!

    How can a reboot make a program running as expected (or not...) ?

    Ioannis

    P.S. Maybe it is a tough one for Darrel

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default Re: IF-THEN what?

    I would believe it's more a MCSP behaviour than PBP compiler, but ya never know.

    This said, it happen on other compiler and programming environement too. Visual Studio, etc etc name it. Rebooting once in a while never hurt...
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    952


    Did you find this post helpful? Yes | No

    Default WORDs "cost" can make a huge difference

    Ioannis,

    Depending on the PIC used, you might want to be careful in what syntax you are going tu use.

    This first code costs you i.e. 11 WORDs (PIC16F628) and 13 WORDs (PIC16F690)
    Code:
    w1 var byte
    A  var byte
    B  var byte
    
    IF w1>A THEN
        IF w1<B THEN
        ...
        ENDIF
    ENDIF
    This second code will cost you 60 WORDs (PIC16F628) and 64 WORDs (PIC16F690)
    Code:
    w1 var byte
    A  var byte
    B  var byte
    
    IF w1>A AND w1<B THEN
        ...
    ENDIF
    Last edited by flotulopex; - 22nd June 2011 at 10:39.
    Roger

  5. #5
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default Re: IF-THEN what?

    How can a reboot make a program running as expected (or not...) ?
    in short - it cant. The compiler is going to produce the same .HEX file no matter what.

    If you had a problem with your PC that caused the compiler to generate a bad .HEX file at compile time, I suspect you would be having a great deal more problems than just compiling a PBP program.

    My guess would be you had something loaded in memory, from an old file, that wasn't being updated by your programmer at program time.

    Re-booting or not re-booting your PC should have zero affect on the compiled .HEX file that PBP produced at compile time.

    For example, you compile a program, then you re-boot your PC. How would re-booting your PC alter your previously compiled .HEX file? If it does - you have major issues with your PC..;o)

    If your device programmer is not reloading the new version .HEX file into memory after each compile, prior to progamming the device, that would be an issue.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  6. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,172


    Did you find this post helpful? Yes | No

    Default Re: IF-THEN what?

    @Roger: That was my concern, the produced size of the code. I knew that inline AND command needs more code space.

    @Bruce: Well, I never meant or implied that a reboot would alter my .hex file. It just "seems" that after the reboot the compiler produced a correct hex file. I have to say that I use a lot the Sleep or Hibernate state on my Laptop. Maybe there lies the problem.

    The project files are stored in a Dropbox folder and when a new hex is produced I see the blue rolling arrows that show a sync is taking place, so I am pretty sure the files are updated.

    Now all seems fine after a complete reboot. Both codes work the same as expected.

    Ioannis

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts