problem with toggle command


Closed Thread
Results 1 to 7 of 7

Hybrid View

  1. #1
    Join Date
    Feb 2011
    Posts
    60


    Did you find this post helpful? Yes | No

    Default Re: problem with toggle command

    Something I ran into also. Has something to do with reading state of pin for toggle, a problem if pin is set to analog, I think. Anyway, a simple reliable method to toggle a pin is to add 1 to the pin value -- portA.1=portA.1 + 1

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: problem with toggle command

    There must be hundreds of posts about this across the forum by now.
    Turn off any analog functions (comparator, ADC) that's on the pin(s) you're going to use as digital.

    When an analog pin is read, as in myBit=PortA.1 it will always return the same value no matter what the logic state actually is. Toggle then flips the bit and writes it back to the pin. What happens next time TOGGLE executes?

    On devices whit LAT registers you're better off using them instead of PORT but I don't Think Toggle works with them.

    /Henrik.

Similar Threads

  1. Toggle command question
    By AvionicsMaster1 in forum General
    Replies: 3
    Last Post: - 31st January 2012, 15:34
  2. Toggle command
    By mr.sneezy in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 16th December 2011, 02:07
  3. problem with I2CWRITE command
    By hatzukitzuki in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 14th October 2010, 22:35
  4. toggle command w/ multiple switches
    By earltyso in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 15th February 2007, 17:47
  5. PIC16F88 problem with TOGGLE command?
    By russman613 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 17th September 2006, 23:31

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