TOGGLE will not go LOW


Closed Thread
Results 1 to 18 of 18

Hybrid View

  1. #1
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Re: TOGGLE will not go LOW

    I have experienced this probably 50% of the time I have attempted to use toggle, High & Low commands and as such do not even attempt to use them.
    Is there a definite cause / effect or relationship to their failure to work and setting TRIS registers? Can anyone point to a paragraph in the manual?
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,644


    Did you find this post helpful? Yes | No

    Default Re: TOGGLE will not go LOW

    from the pbp3 manual for HIGH
    HIGH Pin
    Make the specified Pin high. Pin is automatically made an output. Pin may be a constant, 0-15, or a variable that contains a number 0-15 (e.g. B0) or a pin name (e.g. PORTA.0).
    HIGH 0 ' Make Pin0 an output and set it high (~5 volts)
    HIGH PORTA.0 ' Make PORTA, pin 0 an output and set it high (~5 volts)
    led Var PORTB.0 ' Define LED pin
    HIGH led ' Make LED pin an output and set it high (~5 volts)
    Alternatively, if the pin is already an output, a much quicker and shorter way (from a generated code standpoint) to set it high would be:
    PORTB.0 = 1 ' Set PORTB pin 0 high
    Since this command automatically sets the data-direction of the pin it acts on, the Pin parameter should only be a PORT or GPIO register (or an alias to a PORT or GPIO register). If the command is directed to act upon a LAT output or a bit within a variable or SFR, it will attempt to set a data-direction register that doesn't exist. The result may be unexpected behavior since a bit is changed in a seemingly random memory location. This can be very difficult to debug.
    its also mentioned for other commands
    Last edited by richard; - 9th August 2014 at 05:13. Reason: pbp3

  3. #3
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Re: TOGGLE will not go LOW

    Ok I did some testing and I found:
    1. High & Low worked without Tris or Ports set or analog settings set to digital
    2. Setting port to 1 and zero worked with Tris & Ports set without analog settings set to digital
    3. Toggle would not work without setting the analog stuff to digital, but when properly set it did.
    it otherwise would go high and stay high.

    Test chip 16F690 on Microchip demo board
    Interesting, Since Both posters are using portA in their examples I think some analog register is blocking it working.
    Which is what Mackrackit alluded to in post #3, I found it interesting it did not affect #2 in my test.
    HTH
    JS
    Last edited by Archangel; - 9th August 2014 at 07:40.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  4. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    2,644


    Did you find this post helpful? Yes | No

    Default Re: TOGGLE will not go LOW

    looks like I went off on the wrong path again, but I'd say archangel is 100% correct . if only people would post their complete code (or complete compilable example demonstrating the problem) speculation would be unnecessary,
    dream on

  5. #5
    Join Date
    Feb 2011
    Posts
    60


    Did you find this post helpful? Yes | No

    Default Re: TOGGLE will not go LOW

    According to data sheet 18F4620 making one port analog makes all smaller number ports analog which interferes with TOGGLE. IF AN5 is analog then AN0 thru AN4 are also analog, like a pyramid. TOGGLE is not needed. Adding a bit to an output pin toggles that pin, analog or not.

Similar Threads

  1. Super low cost USB solution
    By Jumper in forum General
    Replies: 2
    Last Post: - 18th January 2013, 11:21
  2. high/low of 14 numbers
    By Christopher4187 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 16th December 2012, 09:43
  3. LCD Low Power
    By kduck63 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th December 2012, 00:05
  4. PCB low volume production
    By sales5 in forum Adverts
    Replies: 0
    Last Post: - 29th November 2012, 03:43
  5. Replies: 3
    Last Post: - 25th November 2012, 20:26

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