Today 11:23
Forum: Proton Plus Compiler v3
Starter: Mellbreak
Views: 1053
Replies: 38
Yesterday 22:54
Forum: Wish List / Product Feedback
Starter: RGV250
Views: 0
Replies: 6
+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: 3.6.0.3 and HIGHLOW_TRIS_REVERSE ??7 days old

  1. #1
    Member spyder0069's Avatar
    Join Date
    May 2002
    Posts
    123
    Thumbs Up
    Received: 1
    Given: 0
    Total Downloaded
    91.79 MB

    0 Not allowed!

    Default 3.6.0.3 and HIGHLOW_TRIS_REVERSE ??

    I recently upgraded to 3.6.0.3 and when I compile my project it gives me an error that it no longer recognizes my Declare HIGHLOW_TRIS_REVERSE = On line. I commented it out but then my project no longer works so apparently at some point I decided I needed that function.

    Is this a depreciated function? Any idea how to re-implement it? I was on 3.5 something previous with no issues but just built a new system so thought I would get everything upgraded.

  2. #2
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    1,358
    Thumbs Up
    Received: 49
    Given: 123
    Total Downloaded
    2.37 GB

    0 Not allowed!

    Default Re: 3.6.0.3 and HIGHLOW_TRIS_REVERSE ??

    FWIW it is a reserved word (appears in manual index).

    The only other reference I can find is in the What's New for 3.2.5.4 12th Feb 2007


    Added Declare to swap the position of the TRIS register manipulation with the HIGH and LOW commands: -

    Declare HighLow_Tris_Reverse = On or Off, 1 or 0, True or False

    When the HIGH or LOW command is issued, the PICmicro's TRIS (direction) register is altered Then the PORT is altered,
    however, some users have stipulated that the reverse of this operation is required. i.e. the PORT altered Then the TRIS.

    This Declare can be used throughout the program altering the TRIS position at will.

    The default If the Declare is not used If the TRIS manipulated Then the PORT.
    The string does appear in both compiler executables.
    George

  3. #3
    Member spyder0069's Avatar
    Join Date
    May 2002
    Posts
    123
    Thumbs Up
    Received: 1
    Given: 0
    Total Downloaded
    91.79 MB

    0 Not allowed!

    Default Re: 3.6.0.3 and HIGHLOW_TRIS_REVERSE ??

    It looks like HighLow_Tris_Reverse works up to 3.5.9.0 (3.5.8.6 with new defs and 3.5.9.0 app applied). However, 3.5.9.1 bounces the declare.

  4. #4
    Member spyder0069's Avatar
    Join Date
    May 2002
    Posts
    123
    Thumbs Up
    Received: 1
    Given: 0
    Total Downloaded
    91.79 MB

    0 Not allowed!

    Default Re: 3.6.0.3 and HIGHLOW_TRIS_REVERSE ??

    Is there a way to edit the HIGH and LOW commands in the compiler so that they default to setting the port and then the tris? Then I could upgrade and not need the declare.

  5. #5
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    1,358
    Thumbs Up
    Received: 49
    Given: 123
    Total Downloaded
    2.37 GB

    0 Not allowed!

    Default Re: 3.6.0.3 and HIGHLOW_TRIS_REVERSE ??

    I doubt you'll get anywhere trying to hack the compiler.

    I wonder if you could do something with macros.

    You can certainly disable commands and provide alternate code, in your case High and Low. There are several examples in the Wiki of this technique.

    Failing all above, you could edit the ASM file and manually Link it (most definatley not recommended)

    I suspect that other changes to the compiler have caused your project to "no longer work". After all the difference is tiny, how could you even detect it externally?
    Last edited by towlerg; 5th December 2017 at 20:07.
    George

  6. #6
    Member spyder0069's Avatar
    Join Date
    May 2002
    Posts
    123
    Thumbs Up
    Received: 1
    Given: 0
    Total Downloaded
    91.79 MB

    0 Not allowed!

    Default Re: 3.6.0.3 and HIGHLOW_TRIS_REVERSE ??

    I looked through the wiki and I am apparently not looking for the right terminology as I can't seem to find an example. Can you point me to one?

    It is the cause of it not working. If I remove that statement my code doesn't work. I just alot of high and low commands in some communication routines with a dallas one wire device as well as another sensor. Those commands switch over the port from input to output during this operation and I think the stock way of switching the tris first causes it to switch over but the bit is in the wrong state and it messes up the communication. Thats my theory anyway but regardless if that is correct my code works (and has worked in many projects for several years) with the declare statement in and fails when it is removed causing invalid sensor data.

    I appreciate you help and insight! :^)

  7. #7
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    1,358
    Thumbs Up
    Received: 49
    Given: 123
    Total Downloaded
    2.37 GB

    0 Not allowed!

    Default Re: 3.6.0.3 and HIGHLOW_TRIS_REVERSE ??

    I think the stock way of switching the tris first causes it to switch over but the bit is in the wrong state and it messes up the communication
    Now I come to think of it TRIS first will output whatever is in the port latches, so yes it makes sense. I guess that doesn't affect most Dallas code is because it uses uses OREAD, OWRITE etc.

    BTW you are quite unlucky cause this one of the few occasions when you change TRIS on the fly. Other examples are software I2C and charlieplexing.

    Try here for an example of command replacement, in this case the Print command. Although I bet you 5c that Les has it fixed before you get it working.
    Last edited by towlerg; 5th December 2017 at 22:55.
    George

  8. #8
    Administrator John Drew's Avatar
    Join Date
    Feb 2002
    Posts
    2,924
    Thumbs Up
    Received: 80
    Given: 25
    Total Downloaded
    1.37 GB

    0 Not allowed!

    Default Re: 3.6.0.3 and HIGHLOW_TRIS_REVERSE ??

    I'm probably wrong but I thought the tris was automatically changed when you either input or output to a port. I may have not understood the original issue.
    John

  9. #9
    Member spyder0069's Avatar
    Join Date
    May 2002
    Posts
    123
    Thumbs Up
    Received: 1
    Given: 0
    Total Downloaded
    91.79 MB

    0 Not allowed!

    Default Re: 3.6.0.3 and HIGHLOW_TRIS_REVERSE ??

    Yeah thats the thing. My code is very timing dependent as its happening in between zero crossings of the mains so some of my commands and such have to be broken up in order to not cause problems with my interrupt. The high low commands were used after inputs knowing that they would automatically make the port an output. So modifying the code would require going in doing the manual adjustments and I am not sure if I would eat up more code space or such. And again its not just with a dallas routine I am using another sensor which I have routines written for using the high / Low. I will take a look at that info and see if I could figure out how to change the command. If Les could put that back in I would be forever grateful. :^)

  10. #10
    Member spyder0069's Avatar
    Join Date
    May 2002
    Posts
    123
    Thumbs Up
    Received: 1
    Given: 0
    Total Downloaded
    91.79 MB

    0 Not allowed!

    Default Re: 3.6.0.3 and HIGHLOW_TRIS_REVERSE ??

    Quote Originally Posted by John Drew View Post
    I'm probably wrong but I thought the tris was automatically changed when you either input or output to a port. I may have not understood the original issue.
    John
    The issue is whether the state is placed on the port first before the port is switched to a output or if the port is switched first to a output and then the state is set/cleared. That order of operations is what is causing the problem. The normal way gives it the opportunity to be switched to a output with wrong state initially before it corrects it. This is specific to using the High or Low commands.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Members who have read this thread : 37

Actions :  (Set Date)

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

Tags for this Thread

Posting Permissions

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