Addressing multiple PORTs using one Variable


+ Reply to Thread
Results 1 to 32 of 32

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Re: Addressing multiple PORTs using one Variable

    Not sure I understand....
    Are you saying that this code works:
    Code:
    MAIN:
        PORTA.0[23]  = 1   ' OK but useless
        ASM
          nop
          nop
          nop
        ENDASM
        
        PORTC.7 = 0         ' have this syntax for tests only here
            ASM
                nop
            ENDASM
            
        GOTO MAIN
    END
    And this isn't:
    Code:
    X VAR BYTE
    X = 23
    MAIN:
        PORTA.0[X]   = 1   ' No! Makes a blink in the scope and then stays LOW
        ASM
          nop
          nop
          nop
        ENDASM
        
        PORTC.7 = 0         ' have this syntax for tests only here
        ASM
          nop
        ENDASM
            
        GOTO MAIN
    END
    The 16F690 has an ADC and comparators.
    Many of the pins are analog. I don't see you setting them to digital mode. PortC.7 is, however, not one of the analog pins but since you're trying to "index" pins with a variable I suspect PortC.7 isn't the only pin you want to use.

    /Henrik.

  2. #2
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Default Addressing multiple PORTs using one Variable

    Yes Henrik, you might be right.

    Keen to keep the code snippet very (maybe too) short here, I removed all others register settings I have set in the original code.

    I'll give it also a try...when I'm back from office.
    Roger

Similar Threads

  1. Addressing ports via offset using lookup command
    By longpole001 in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 1st November 2013, 03:50
  2. How to drive 7 segment using multiple ports?
    By guess79 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 11th December 2006, 19:43
  3. multiple ports ===> one symbol?
    By PICMAN in forum General
    Replies: 4
    Last Post: - 8th March 2005, 22:24
  4. Problem reading multiple ADC ports
    By jswayze in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 4th November 2004, 16:46
  5. Reading multiple ports
    By Rob Martin in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 20th May 2004, 17:22

Members who have read this thread : 17

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