How to load an array Proc?


+ Reply to Thread
Results 1 to 7 of 7

Thread: How to load an array Proc?1990 days old

  1. #1
    Prolific Poster normnet's Avatar
    Join Date
    Jul 2004
    Posts
    2,423
    Thumbs Up
    Received: 81
    Given: 48
    Total Downloaded
    1.40 GB

    0 Not allowed!

    Default How to load an array Proc?

    How to load a call to MyProc which includes an array?

    Code:
    Proc MyProc(pMyArray[10] As Word)
        yTEMP = 0
        Repeat
          HSerOut[pMyArray[yTEMP],13]
          Inc yTEMP
        Until yTEMP = 10
      EndProc
    
    MyProc(0,1,2,3,4,5,6,7,8,9) 'Error  *** 0 is an unsupported variable type/value at this position! ***

    Norm

  2. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  3. #2
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,374
    Thumbs Up
    Received: 87
    Given: 183
    Total Downloaded
    5.30 GB

    0 Not allowed!

    Default Re: How to load an array Proc?

    just a guess, but maybe a pointer

    george
    George.

  4. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  5. #3
    Senior Member SimonJA's Avatar
    Join Date
    Mar 2006
    Posts
    844
    Thumbs Up
    Received: 14
    Given: 16
    Total Downloaded
    1.03 GB

    0 Not allowed!

    Default Re: How to load an array Proc?

    I think you need to load your array with the values you want first and then use the procedure.

    Code:
    'load myArray with values
    MyProc(myArray)

  6. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  7. #4
    Prolific Poster normnet's Avatar
    Join Date
    Jul 2004
    Posts
    2,423
    Thumbs Up
    Received: 81
    Given: 48
    Total Downloaded
    1.40 GB

    0 Not allowed!

    Default Re: How to load an array Proc?

    Quote Originally Posted by SimonJA View Post
    I think you need to load your array with the values you want first and then use the procedure.

    Code:
    'load myArray with values
    MyProc(myArray)
    Tried however the following error:
    Error at Line [1515] *** Item ' PMYARRAY ' not found! ***


    Norm

  8. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  9. #5
    Senior Member SimonJA's Avatar
    Join Date
    Mar 2006
    Posts
    844
    Thumbs Up
    Received: 14
    Given: 16
    Total Downloaded
    1.03 GB

    1 Not allowed!

    Default Re: How to load an array Proc?

    Hi Norm

    I just tested this and it seems to do what you want:

    Code:
    Dim YTemp As Byte
    Dim myArray[10] As Word
    Dim count1 As Byte
    
    For count1 = 0 To 9                  'load array with values
    myArray[count1] = count1 * count1
    Next
    
    
    main:
    
    MyProc(myArray) 
    
    
    DelayMS 1000
    Toggle LED1
    GoTo main
    
    '*********************************************** Procedures ****************************************************
    Proc MyProc(pMyArray[10] As Word)
        YTemp = 0
        Repeat
          HRSOut Dec6 pMyArray[YTemp], "   "
          Inc YTemp
        Until YTemp = 10
        HRSOut 13
      EndProc

  10. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  11. #6
    Prolific Poster johngb's Avatar
    Join Date
    Oct 2003
    Posts
    2,235
    Thumbs Up
    Received: 104
    Given: 1
    Total Downloaded
    3.15 GB

    0 Not allowed!

    Default Re: How to load an array Proc?

    The variable you are trying to pass is not an array.

    It's not clear to me what you want ultimately to do but it looks to me like you are trying to pass 10 word variables which you want the procedure to replay to the serial port. There is nowhere in your code which is actually populating the array.
    JohnB

  12. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  13. #7
    Prolific Poster normnet's Avatar
    Join Date
    Jul 2004
    Posts
    2,423
    Thumbs Up
    Received: 81
    Given: 48
    Total Downloaded
    1.40 GB

    0 Not allowed!

    Default Re: How to load an array Proc?

    Quote Originally Posted by SimonJA View Post
    Hi Norm

    I just tested this and it seems to do what you want:

    Code:
    Dim YTemp As Byte
    Dim myArray[10] As Word
    Dim count1 As Byte
    
    For count1 = 0 To 9                  'load array with values
    myArray[count1] = count1 * count1
    Next
    
    
    main:
    
    MyProc(myArray) 
    
    
    DelayMS 1000
    Toggle LED1
    GoTo main
    
    '*********************************************** Procedures ****************************************************
    Proc MyProc(pMyArray[10] As Word)
        YTemp = 0
        Repeat
          HRSOut Dec6 pMyArray[YTemp], "   "
          Inc YTemp
        Until YTemp = 10
        HRSOut 13
      EndProc
    SimonJA

    Code works good!
    Thanks

    Norm

  14. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Replies: 11
    Last Post: 29th September 2019, 16:31
  2. Bug in PROC that begin with T
    By GAMBOA in forum Proton Studio
    Replies: 1
    Last Post: 28th December 2018, 17:41
  3. Replies: 6
    Last Post: 9th May 2017, 16:46
  4. Isr#s and Proc's
    By johngb in forum Proton 24
    Replies: 10
    Last Post: 25th February 2017, 09:41

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts