Problem: SERIN2 and long arrays...


Closed Thread
Results 1 to 17 of 17

Hybrid View

  1. #1
    Join Date
    Sep 2009
    Posts
    755

    Default Problem: SERIN2 and long arrays...

    Several times I have problem that first few bytes can not has been received in array.
    This problem occurs only if I have a large number of long arrays...
    For example
    Code:
        
    Some vars...
                Mail_User var byte[36]
                Mail_123 var byte[36]
                Mail_Pass var byte[36]
                etc
    And serin2 look like this
    Code:
     serin2 PC_RX,8588,1000,PC_Data_Mail,[wait("Mail:"), str Mail_Alrm\5, str MailServer\20, str Mail_port\6, str Mail_User\35, str Mail_Pass\35,_
            str Mail_Adr\30, str Mail_Subj\20, str Mail_Msg\50, str Mail_FileName\20, Mail_Name_Tip,_
            str Mail_RCPT1\35, str Mail_RCPT2\35, str Mail_RCPT3\35 ]
    And in this case first 5 charter of str Mail_Pass\35 is zero if i didn't add Mail_123 var byte[36] .
    But if I add Mail_123 var byte[36], or any array longer than number of bytes that didn't received everything work fine...
    This is compiled with PBP2.60C, I didn't try to compile with PBP3...
    I assume that first few byte and rest of array isn't in same bank or something like that...

  2. #2
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: Problem: SERIN2 and long arrays...

    Same thing with PBP 3...
    I'm not sure what difference it make if I add another array, or change order when defining variables...

  3. #3
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: Problem: SERIN2 and long arrays...

    What MCU are you using? Maybe you are running low on memory?
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: Problem: SERIN2 and long arrays...

    PIC18F255, this issue i also had on PIC18LF1xK50.
    It's not low on memory, because if I add some dummy var everything works fine.
    Now I'm testing and if I tray this
    Code:
    Some vars...
    Mail_Pass var byte[36]
    Mail_User var byte[36]
    etc
    And problem move to Mail_User.
    Now I'll try to put serin2...[mail_pass[0],mail_pass[1],...mail_pass[34]], instant of str mail_pass...

  5. #5
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: Problem: SERIN2 and long arrays...

    Now I try this
    Code:
    ...
    Mail_User var byte[36]
    Mail_Pass var byte[36]
    ....
    serin2 PC_RX,8588,1000,PC_Data_Mail,[wait("Mail:"), str dat\5, str MailServer\20, str Mail_port\6, str Mail_User\35,_
    Mail_Pass[0],Mail_Pass[1],Mail_Pass[2],Mail_Pass[3],Mail_Pass[4],Mail_Pass[5],_
    Mail_Pass[6],Mail_Pass[7],Mail_Pass[8],Mail_Pass[9],Mail_Pass[10],Mail_Pass[11],_
    Mail_Pass[12],Mail_Pass[13],Mail_Pass[14],Mail_Pass[15],Mail_Pass[16],Mail_Pass[17],_
    Mail_Pass[18],Mail_Pass[19],Mail_Pass[20],Mail_Pass[21],Mail_Pass[22],Mail_Pass[23],_
            Mail_Pass[24],Mail_Pass[25],Mail_Pass[26],Mail_Pass[27],Mail_Pass[28],Mail_Pass[29],_
            Mail_Pass[30],Mail_Pass[31],Mail_Pass[32],Mail_Pass[33],Mail_Pass[34],_   
            str Mail_Adr\30, str Mail_Subj\20, str Mail_Msg\50, str Mail_FileName\20, Mail_Name_Tip,_
            str Mail_RCPT1\35, str Mail_RCPT2\35, str Mail_RCPT3\35 ]
    And this also won't work... I'm shure that problem is in serin2 because i try If mail_pass[0]=0 then HSEROUT["empty",13,10] and without adding additional array I always got empty.
    But If i try to put something in array eg mail_pass[0]="a", it;s ok.
    For now I can add just some arrays, but I want to know what causing this problem...
    And it's not first time to bump into this...

  6. #6
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Problem: SERIN2 and long arrays...

    Hi,
    It sounds to me like one array is "spilling over" into the next. PBP doesn't have perform boundry checking on arrays so you can easily write outside it of its "space". When you add your dummy array the data from operation A spills over into the dummy array instead of into the "real" array where you see the zeros.

    That'a a theory....

    /Henrik.

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