Today 13:42
Forum: Windows Application Development
Starter: towlerg
Views: 0
Replies: 1
Today 12:07
Forum: The Lounge
Starter: normnet
Views: 0
Replies: 4
Today 11:47
Forum: Website / Forum Issues
Starter: johngb
Views: 0
Replies: 3
Go to last post By: xldaedalus
Today 08:33
Forum: Proton 24
Starter: johngb
Views: 0
Replies: 7
Today 00:52
Forum: Proton Plus Compiler v3
Starter: johngb
Views: 0
Replies: 25
Yesterday 17:20
Forum: Proton Plus Compiler v3
Starter: joesaliba
Views: 0
Replies: 12
Yesterday 16:47
Forum: Analog-to-Digital Converter Module
Starter: CharlieBrown
Views: 0
Replies: 1
+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Trouble with arrays, lookup33 days old

  1. #1
    Join Date
    Sep 2010
    Posts
    1,062
    Thumbs Up
    Received: 38
    Given: 34
    Total Downloaded
    1.72 GB

    Default Trouble with arrays, lookup

    I'm going nuts. Will somebody please tell me what I'm doing wrong here:

    Dim ASCII[32] As Byte = "0", "1", "2", "3", "4", "5"
    Dim Telec[32] As Byte = 16, 1, 2, 19, 4, 21
    Dim indx As Word

    For indx = 0 To 5
    HRSOut Dec indx, " ", Dec ASCII[indx], " ", Dec Telec[indx], "\r\n"
    Next
    Stop

    It prints:
    0 0 0
    1 0 0
    2 0 0
    3 0 0
    4 0 0
    5 0 0

    Chip is 24HJ128GP502 compiler 1.0.2.1

    I've tried LOOKUP and get similar results. Perhaps I have just passed the age of "being able to write code"

    Charlie

  2. #2
    Join Date
    Feb 2002
    Posts
    2,919
    Thumbs Up
    Received: 80
    Given: 25
    Total Downloaded
    1.37 GB

    Default Re: Trouble with arrays, lookup

    G'day Charlie
    Just as a diagnostic have you tried reducing the size of your array to 6?
    Alternatively, completely filling the array during the declaration.
    I'm guessing it might be to do with the declaration side of things.
    John

  3. #3
    Join Date
    Sep 2010
    Posts
    1,062
    Thumbs Up
    Received: 38
    Given: 34
    Total Downloaded
    1.72 GB

    Default Re: Trouble with arrays, lookup

    G'day John

    Good idea, I'll try it. Thanks.

    Charlie

  4. #4
    Join Date
    Feb 2002
    Posts
    3,234
    Thumbs Up
    Received: 229
    Given: 83
    Total Downloaded
    1.50 GB

    Default Re: Trouble with arrays, lookup

    I've just tried the above code and I get the correct values displayed in the serial terminal Charlie.

    0 48 16
    1 49 1
    2 50 2
    3 51 19
    4 52 4
    5 53 21

    Version 1.0.2.1 of the Proton24 compiler is quite old Charlie. Update to the latest version.
    For more example programs for Proton and Proton24 or updates, please visit: Proton WIKI or Proton Files

  5. #5
    Join Date
    Sep 2010
    Posts
    1,062
    Thumbs Up
    Received: 38
    Given: 34
    Total Downloaded
    1.72 GB

    Default Re: Trouble with arrays, lookup

    Les

    I downloaded the "latest" version: 3.6.0.2 but once installed, if I click on "About" it says 3.6.0. 2 1.0.2.1
    Yet the file in Downloads is called: Proton Compiler Setup 3.6.0.2_1.0.4.4

    It appears that I have updated the ordinary Proton, but not P24? Sorry but I am a bit lost now?

    Correction: the version reported in "About" is wrong. If I look in the assembler listing then it says 1.0.4.4,
    so this is the version that failed for me.

    Was your test on the simulator?

    Charlie
    Last edited by charliecoultas; 23rd October 2017 at 19:54.

  6. #6
    Join Date
    Sep 2010
    Posts
    1,062
    Thumbs Up
    Received: 38
    Given: 34
    Total Downloaded
    1.72 GB

    Default Re: Trouble with arrays, lookup

    Well that's mighty odd! I just tried it again and it works. I'll investigate further, somehow?

    Charlie

    Thanks for looking at this Les, sorry if it's a red herring.

  7. #7
    Join Date
    Sep 2010
    Posts
    1,062
    Thumbs Up
    Received: 38
    Given: 34
    Total Downloaded
    1.72 GB

    Default Re: Trouble with arrays, lookup

    A slight case of red-face here. If I define an array, an fill it with data as part of the Dim structure, then issue a Clear instruction, I image that it will clear the array?

    Doh! Perhaps i should turn my hand to kitchen fitting instead?

    By the way, my Elliott 803 emulator is now working pretty well. I have a few issues with floating point but I'm getting there (your 64 bit IEEE code works a treat Les).
    The BlueTooth link to an external tablet means that there are virtually no wires to the emulator board apart from +9V ground and two loudspeaker wires.

    Charlie

    Last edited by charliecoultas; 23rd October 2017 at 20:18.

  8. #8
    Join Date
    Feb 2002
    Posts
    2,919
    Thumbs Up
    Received: 80
    Given: 25
    Total Downloaded
    1.37 GB

    Default Re: Trouble with arrays, lookup

    Good work Charlie, You wouldn't be alone in making mistakes. Under water knitting is another option if you ever give up programming, although the sharks down here make it more hazardous.
    John

  9. #9
    Join Date
    Feb 2002
    Posts
    3,234
    Thumbs Up
    Received: 229
    Given: 83
    Total Downloaded
    1.50 GB

    Default Re: Trouble with arrays, lookup

    I'll check out the code version and make sure it complies. It is in several places within the compiler, and also the C++ compiler that generates the compiler. I always go by the asm listing for the version, as this is always bang up to date.

    Yes. The Clear command will clear all RAM, and when an array is filled when it is created, the data is still held in RAM.
    For more example programs for Proton and Proton24 or updates, please visit: Proton WIKI or Proton Files

  10. #10
    Join Date
    Sep 2010
    Posts
    1,062
    Thumbs Up
    Received: 38
    Given: 34
    Total Downloaded
    1.72 GB

    Default Re: Trouble with arrays, lookup

    Cheers Les. This is my emulator:

    Spot the mistake....

    Capture.JPG

Thread Information

Users Browsing this Thread

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

     

Similar Threads

  1. Array v Lookup
    By roger in forum Proton Plus Compiler v3
    Replies: 5
    Last Post: 16th December 2008, 23:59
  2. Question about Lookup
    By C_Moore in forum Proton Plus Compiler v3
    Replies: 20
    Last Post: 17th July 2008, 01:16
  3. Trouble with arrays
    By RGV250 in forum Proton Plus Compiler v3
    Replies: 1
    Last Post: 11th July 2007, 08:48
  4. lookup question
    By BenBarber in forum Proton Plus Compiler v3
    Replies: 1
    Last Post: 9th August 2005, 00:07
  5. fast init of arrays--constant arrays?
    By cgriffin in forum Proton Plus Compiler v3
    Replies: 2
    Last Post: 7th March 2005, 22:50

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