Pin outputs to an array


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2007
    Posts
    11

    Default Pin outputs to an array

    I would like to associate 32 pins of my 18F4525 to an array such as ch_out[32]. I am having trouble getting anything to compile.

    This will not work:
    ch_out VAR BIT[32]
    ch_out[1] VAR PORTA.1

    This will not work:
    ch_out VAR BIT[32]
    SYMBOL ch_out[1] = PORTA.1

    This will not work:
    SYMBOL ch_out[1] = PORTA.1

    This will not work:
    ch1 VAR PORTA.1
    SYMBOL ch_out[1] = ch1

    This will not work:
    ch1 VAR PORTA.1
    ch_out[1] VAR ch1

    I want to process all the pins in one loop by incrementing a loop counter and turning the pin on or off using an IF THEN statement. For example:

    FOR cnt = 1 to 32
    IF ch_data[cnt] >= 1 THEN
    HIGH ch_out[cnt]
    ELSE
    LOW ch_out[cnt]
    ENDIF
    NEXT cnt

    Anyone have a solution?

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    See this ...

    Indexing Port Pins
    http://www.picbasic.co.uk/forum/showthread.php?t=3753
    <br>
    DT

Similar Threads

  1. Is this a K Type sensor?
    By jessey in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 21st November 2009, 13:55
  2. 8 pin DIP w/6 outputs ?
    By Sam in forum General
    Replies: 12
    Last Post: - 14th September 2009, 20:15
  3. DS1820 with 16f688
    By jessey in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 23rd May 2009, 05:07
  4. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  5. Another RTC, DS1287
    By DavidK in forum Code Examples
    Replies: 0
    Last Post: - 12th December 2006, 17:07

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