Help Needed with arrays


Closed Thread
Results 1 to 3 of 3

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Re: Help Needed with arrays

    Hi Chris,
    Have you read Melanies excellent primer on the subject?

    Basically like you have it but IF arraydat.0(C) = 1 then....

    /Henrik.

  2. #2
    Join Date
    Oct 2004
    Posts
    440


    Did you find this post helpful? Yes | No

    Default Re: Help Needed with arrays

    Chris

    The following compiles OK

    Norm
    Code:
      '4520
      @ __CONFIG _CONFIG1H, _OSC_XT_1H
      @ __CONFIG _CONFIG2L, _BOREN_ON_2L
      @ __CONFIG _CONFIG2H, _WDT_ON_2H
      @ __CONFIG _CONFIG3H, _MCLRE_ON_3H & _PBADEN_OFF_3H
      @ __CONFIG _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
    
      DEFINE OSC 4
    
      CLEAR
      sSEROUT_PIN VAR PORTC.1
      sBAUD CON 19697  '3313 = INVERTED 300   USE 19697 = 300   16416 = 19200 BAUD
    
      arraydat VAR BIT(26)
      C VAR BYTE
      '***********************************************
      GOTO START
    
      ONE:
      SEROUT2 sSEROUT_PIN,sBAUD,["sub ONE",13]
      RETURN
    
      ZERO:
      SEROUT2 sSEROUT_PIN,sBAUD,["sub ZERO",13]
      RETURN
    
      START:
      PAUSE 1000
    
      SerOut2 sSEROUT_PIN,sBAUD,["START",13]
      PAUSE 100
    
      MAIN:
    '  arrayadat = %01010101011111111000000001
      arraydat[0] = 1
      arraydat[1] = 0
      arraydat[2] = 0
      arraydat[3] = 0
      arraydat[4] = 0
      arraydat[5] = 0
      arraydat[6] = 0
      arraydat[7] = 0
      arraydat[8] = 0
      arraydat[9] = 1
      arraydat[10] = 1
      arraydat[11] = 1
      arraydat[12] = 1
      arraydat[13] = 1
      arraydat[14] = 1
      arraydat[15] = 1
      arraydat[16] = 1
      arraydat[17] = 0
      arraydat[18] = 1
      arraydat[19] = 0
      arraydat[20] = 1
      arraydat[21] = 0
      arraydat[22] = 1
      arraydat[23] = 0
      arraydat[24] = 1
      arraydat[25] = 0
    
      FOR C = 0 TO 25
        IF arraydat[C] = 1 THEN
          Gosub ONE
        Else
          Gosub Zero
        EndIf
      NEXT C
    
    '  goto main
      SEROUT2 sSEROUT_PIN,sBAUD,["END",13]
      END

Similar Threads

  1. Arrays calling Arrays
    By MOUNTAIN747 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 26th January 2011, 07:15
  2. Two dimensional arrays?
    By ralfmayr in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 26th March 2010, 18:41
  3. How are arrays used?
    By NO2K in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 1st June 2007, 16:33
  4. pins in arrays?
    By scorpion in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 17th September 2005, 09:18
  5. storing arrays and reading arrays
    By Yue in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 5th March 2004, 23:03

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