Variable not getting value from array...?


Closed Thread
Results 1 to 15 of 15
  1. #1
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,796

    Default Variable not getting value from array...?

    OK, I feel a bit stupid here.

    if all variables are word and word arrays why temp does not get the value of valid[0]?

    mem_index takes values from 1 to 15

    Code:
    temp    var word
    valid    var word[4]
    mem_index    var byte
    
    temp=valid[0]
    write mem_index,temp
    write 0,mem_index
    read mem_index,temp
    hserout ["get ",#mem_index,"  ",#temp,"  ",#valid[0],13,10]
    after I run this code, temp has different value of valid[0]

    and thats drives me crazy...

    Ioannis

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,517


    Did you find this post helpful? Yes | No

    Default Re: Variable not getting value from array...?

    I think it's because WRITE defaults to BYTE variables. Sine you're using WORDs you need to tell it to write WORDs. Same thing with READ.

    /Henrik.

  3. #3
    Join Date
    Jan 2013
    Location
    Texas USA
    Posts
    229


    Did you find this post helpful? Yes | No

    Default Re: Variable not getting value from array...?

    That's correct Henrik.


    WRITE Address,{WORD}{LONG}Value

    WRITE mem_index, WORD temp
    Regards,
    TABSoft

  4. #4
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,796


    Did you find this post helpful? Yes | No

    Default Re: Variable not getting value from array...?

    Hmm, OK, it was in front of me... Reading again and again...

    I was sure that my var's were WORD sized so I felt OK.

    Have not tried it yet, but seems obvious now.
    Thanks a lot.

    Ioannis

  5. #5
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: Variable not getting value from array...?

    Well I for one don't see where mem_index is being set. Also the commands

    write mem_index,temp
    write 0,mem_index

    would by default be writing over the contents of memory location 0 if mem_index is not set.
    Dave Purola,
    N8NTA
    EN82fn

  6. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,796


    Did you find this post helpful? Yes | No

    Default Re: Variable not getting value from array...?

    Dave thanks for the reply. It is been set previously, I just did not paste that part too.

    Ioannis

  7. #7
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838


    Did you find this post helpful? Yes | No

    Default Re: Variable not getting value from array...?

    i was not aware of the write command to do words, its not in the online help file for the instruction , that i can see

  8. #8
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,517


    Did you find this post helpful? Yes | No

    Default Re: Variable not getting value from array...?

    The help file in MicroCodeStudio was generated years ago and has, as far as I can see, not (ever?) been updated. You really should refer to the .pdf manual instead.

    /Henrik.

  9. #9
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838


    Did you find this post helpful? Yes | No

    Default Re: Variable not getting value from array...?

    yep your right hedrik , you think by now they would have done an update on the online ver though

  10. #10
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,588


    Did you find this post helpful? Yes | No

    Default Re: Variable not getting value from array...?

    I would have expected an updated online help file when I paid for MCSP v5 along with PBP v3.

    Robert

    Name:  WRITE statement.png
Views: 541
Size:  157.3 KB

  11. #11
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,517


    Did you find this post helpful? Yes | No

    Default Re: Variable not getting value from array...?

    Yeah, that would be nice (and shouldn't be hard to do) but I'd rather have them look into the issue with the damn thing (mcsp) crashing randomly. But, nope, not happening...
    Problem, as I see it, (but I'm speculating and can obviously be wrong) is that the IDE is written by a third party (Mecanique) so Melabs has no "control" over it and would have to contract Mecanique to do work on it. Finding and fixing the crashing issue is hard because it apparently only happens to people outside of MeLabs and Mecanique. Well, it happened to Darrel too but that's not going to help us now :-(

    /Henrik.

  12. #12
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838


    Did you find this post helpful? Yes | No

    Default Re: Variable not getting value from array...?

    yes i have noticed a higher amount of crashes since i updated to win 10 , and it be nice if it were sorted

    but the online manual updating is purely something they have not attempted to address

    it would not be hard task to update the online manual , even if it was outsourced ,

  13. #13
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,796


    Did you find this post helpful? Yes | No

    Default Re: Variable not getting value from array...?

    The general feeling is that the product is left to its own fate...

    Although in a short discussion with Charles (in Melabs forum http://support.melabs.com/threads/11...f-PBP-Compiler), he insists that he is still full supporting the compiler.

    I see a decay and that makes me sad... I love that compiler, I'd hate see it die.

    Ioannis
    Last edited by Ioannis; - 3rd May 2016 at 17:06.

  14. #14
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,517


    Did you find this post helpful? Yes | No

    Default Re: Variable not getting value from array...?

    Yeah, but the compiler is one thing, the IDE is another.
    With the apparently limitied resources they (MeLabs) have they need to (IMO of course) focus on the compiler, obviously and then EITHER on the MCSP or MPLAB(X). At this point neither really does the job properly. MCSP is easy and straight forward (and it's been what I've been using since it was made available) but it lacks hardware level debugging and some nice to have editor features and it's crashing all the time which really sucks. MPASMX is vastly a more complicated beast and although PBP is supposed to work with it it's a bitch to setup and it's not fully integrated with the IDE (syntax highlighting). But it does support hardware level debugging but that too is not 100% there since MPLAB apparently doesn't know about PBP's 16 and 32 bit variables - or so I've understood.

    Anyway, yes, updating the online help in MCSP would seem like an easy thing to do or get done but really, it's not like current documentation isn't available - it's all in the manual after all.

    /Henrik.

  15. #15
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838


    Did you find this post helpful? Yes | No

    Default Re: Variable not getting value from array...?

    yes i read that thread on melabs site , and Ioannis/ richard brought up some valid points about the proposed approach to get a new compiler for f24 , $1000usd seems a high bench mark for limited support for such chips and not even 32bit

Similar Threads

  1. How to use array variable for shiftout command
    By longpole001 in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 11th June 2012, 11:01
  2. Variable in array
    By Gusse in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 22nd February 2009, 20:46
  3. SOUND command and variable array
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 27th March 2007, 12:56
  4. Array to simple Variable converting
    By mrx23 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 2nd September 2006, 17:44
  5. Maximum variable array ?
    By Keith55555 in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 7th May 2004, 15:29

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