A (possibly) odd way to access a port


Results 1 to 4 of 4

Threaded View

  1. #1
    Join Date
    Jan 2012
    Location
    Grid EN19MV
    Posts
    159

    Default A (possibly) odd way to access a port

    I'm using the lower 6 bits of PORTC (16F886) as select lines for other chips. These bits would be set as outputs.

    Can I use the following to access individual bits of PORTC? (I suspect not - but I've searched the manual and the forum and can't seem to find the answer)

    Code:
    COUNTER VAR BYTE
    
    FOR COUNTER = 0 TO 5
            PORTC.COUNTER = 0 'SET THE PORTC PIN LOW
    NEXT COUNTER
    My other idea was to use an array.

    Code:
    EN_ARRAY VAR BYTE[6]
    COUNTER VAR BYTE
    
    EN_ARRAY[0] VAR PORTC.0
    EN_ARRAY[1] VAR PORTC.1
    EN_ARRAY[2] VAR PORTC.2
    EN_ARRAY[3] VAR PORTC.3
    EN_ARRAY[4] VAR PORTC.4
    EN_ARRAY[5] VAR PORTC.5
    
    FOR COUNTER = 0 TO 5
          EN_ARRAY[COUNTER] = 0  'SET PORTC PIN TO 0
    NEXT COUNTER
    If neither of these would work, any other ideas - it would simplify this project a lot if I can use an index of some sort to access those pins.

    Thanks,

    Andy
    Last edited by andywpg; - 14th November 2012 at 02:16.

Similar Threads

  1. Is it possibly a Windows XP Pro Problem?
    By Ramius in forum Serial
    Replies: 10
    Last Post: - 2nd May 2011, 18:26
  2. Access array in PBP and .asm
    By JEC in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 6th September 2008, 00:35
  3. Second serial port access ( Hserin2 )
    By MegaADY in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 9th October 2007, 18:01
  4. Access and VBasic
    By Ioannis in forum Off Topic
    Replies: 3
    Last Post: - 24th November 2006, 15:05
  5. Keypad unlock (as in garage door possibly)
    By Fred in forum Code Examples
    Replies: 5
    Last Post: - 2nd April 2006, 04:26

Members who have read this thread : 1

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