Array error in Hserin


Closed Thread
Results 1 to 22 of 22

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,795

    Default Array error in Hserin

    It seems that Hserin cannot accept a word array in this expression:

    Code:
    hserin 100,noreceived,[wait("#"),str word_array\2]
    Gives this error:
    PICBASIC PRO(TM) Compiler 3.1.2.4, (c) 1997, 2019 ME Labs, Inc.
    All Rights Reserved.
    ERROR: Macro HSERINSTR?WL not found in macro file.

    If array is byte size then is just fine. Is that correct? I could not find something in the manual.

    Ioannis

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,795


    Did you find this post helpful? Yes | No

    Default Re: Array error in Hserin

    Got it. It is bytes and it is referenced, somewhat cryptic, on page 47, 3rd line from the bottom in the parenthesis.

    Ioannis

  3. #3
    Join Date
    May 2013
    Location
    australia
    Posts
    2,383


    Did you find this post helpful? Yes | No

    Default Re: Array error in Hserin

    ext modifier to the rescue

    Code:
    word_array var word[2]
    word_array_asbyte var byte ext
    
    
    @word_array_asbyte=word_array 
    
    
    
    
    
    
    
    
    
    
    
    
    hserin 100,noreceived,[wait("#"),str word_array_asbyte\4]
    Warning I'm not a teacher

  4. #4
    Join Date
    Sep 2009
    Posts
    737


    Did you find this post helpful? Yes | No

    Default Re: Array error in Hserin

    You need _ before PBP name, when used in ASM.

  5. #5
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,795


    Did you find this post helpful? Yes | No

    Default Re: Array error in Hserin

    Aha! Thanks Richard.

    pedja089, you mean instead of

    @word_array_asbyte=word_array

    be:

    @ _word_array_asbyte= _word_array

    right?

    Ioannis

  6. #6
    Join Date
    May 2013
    Location
    australia
    Posts
    2,383


    Did you find this post helpful? Yes | No

    Default Re: Array error in Hserin

    @ word_array_asbyte= _word_array
    Warning I'm not a teacher

  7. #7
    Join Date
    May 2013
    Location
    australia
    Posts
    2,383


    Did you find this post helpful? Yes | No

    Default Re: Array error in Hserin

    this way makes ext method 18 words less

    Code:
    array var word[2]
    array_asbyte var byte ext
    @array_asbyte=_array
    inx var byte
    i    var byte
    ADRESLO VAR BYTE
    ADRESHi VAR BYTE
    
    
    i=0
    for  inx=0 to 3
    'array[inx]=(adreshi<<8)| adreslo
    array_asbyte[i]=ADRESLO
    i=1+1
    array_asbyte[i]=ADRESHi
    i=1+1
    
    
    next
    
    
    stop
    Warning I'm not a teacher

  8. #8
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,795


    Did you find this post helpful? Yes | No

    Default Re: Array error in Hserin

    Did you tested on 18F or 16F?

    I did on 16F887. Maybe this is why I get more memory usage?

    Ioannis

  9. #9
    Join Date
    May 2013
    Location
    australia
    Posts
    2,383


    Did you find this post helpful? Yes | No

    Default Re: Array error in Hserin

    Did you tested on 18F or 16F?
    makes no difference , did you notice that i had removed the math from the array indexing for the better method ?
    Warning I'm not a teacher

  10. #10
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,795


    Did you find this post helpful? Yes | No

    Default Re: Array error in Hserin

    Yes I noticed that. Still no such reduction.

    Most compact code was obtained with the crude

    word_temp.byte0=adresl
    word_temp.byte1=adresh
    array[i]=word_temp

    Now that I think about it, it is just two transfer. So makes sense, doesn't it?

    Ioannis
    Last edited by Ioannis; - 29th January 2020 at 09:09.

  11. #11
    Join Date
    May 2013
    Location
    australia
    Posts
    2,383


    Did you find this post helpful? Yes | No

    Default Re: Array error in Hserin

    not much on today so i tried a few options with pic16f877 and 16f1825 with no other complications code wise
    resultant code sizes are commented


    Code:
    array var word[2]
    ADRESLO VAR BYTE
    inx var byte
    ADRESHi VAR BYTE
    
    
    ;METHOD 0
    word_temp  var word   
    
    
    ;METHODS 2 AND 3
    array_asbyte var byte ext
    @array_asbyte=_array
    
    
    
    
    ;ALL METHODS EXCEPT 0 , 1
    i    var byte
    i=0
    ;METHOD 4
    @ MOVE?CW _array , FSR0L    ;  PIC16 ENH CORE
    ;METHOD 5
    '@ MOVE?CW _array , FSR     ;  PIC16 SHITTY OLD CHIP
    
    
    for  inx=0 to 3       ;1 FOR METHOD 0        ;                        36  WORDS
    '    word_temp.byte0=adreslo         ;METHOD 0
    '    word_temp.byte1=adreshi
    '    array[inx]=word_temp   
    
    
     
    '    array[inx]=(adreshi<<8)| adreslo    ;METHOD 1  ;                52   WORDS
    
    
    '    if !i&1 then                       ;METHOD 2    ;               60   WORDS
    '        array_asbyte[i]=ADRESLO
    '    else
    '        array_asbyte[i]=ADRESHi
    '    endif
    '    i=1+1
    
    
        
    '    array_asbyte[i]=ADRESLO          ;METHOD 3   ;                  34   WORDS
    '    i=1+1
    '    array_asbyte[i]=ADRESHi
    '    i=1+1
        
    
    
    
    
    asm                                   ;METHOD 4 PIC16 ENH CORE;      23   WORDS
      MOVE?BA _ADRESLO
      MOVWI FSR0++
      MOVE?BA _ADRESHi
      MOVWI FSR0++
    ENDASM
     
    'asm                               ;METHOD 5 PIC16 SHITTY OLD CHIP;  29   WORDS
    '  MOVE?BA _ADRESLO
    '  MOVWF INDF
    '  INCF FSR,F
    '  MOVE?BA _ADRESHi  
    '  MOVWF INDF
    '  INCF FSR,F
    'ENDASM
     
    
    
     
    next
    
    
    stop
    Warning I'm not a teacher

Similar Threads

  1. Hserin with Array
    By JKaiser in forum Serial
    Replies: 4
    Last Post: - 11th December 2014, 20:13
  2. Hserin Array Question
    By Hylan in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 9th May 2012, 03:39
  3. Error - Fatal Out Of Memory ( With Array)
    By stormdacta in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 26th August 2007, 15:36
  4. Bit/Byte array for Hserin/Hserout
    By mrx23 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 2nd September 2006, 00:07
  5. HSERIN Error
    By eoasap in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 13th January 2006, 04:30

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