Problem receiving string


+ Reply to Thread
Results 1 to 11 of 11

Thread: Problem receiving string38 days old

  1. #1
    Prolific Poster RGV250's Avatar
    Join Date
    Aug 2005
    Posts
    2,350
    Thumbs Up
    Received: 29
    Given: 7
    Total Downloaded
    1.09 GB

    0 Not allowed!

    Default Problem receiving string

    Hi,
    I have an idea for a simple debugger where I can put the name of several variables into a PC app and the app will show the state of the variables as a snapshot or continuously. This would mean that I do not have to keep putting lots of print statements and recompiling.
    I have fallen at the first hurdle though, I have tried the example in the manual but cannot get it to work.

    This is basically what I have.
    Code:
            Dim SampleString[10] As Byte
    
            HSerIn 1,Timeout,[Str SampleString]      'Check for input, allow 1ms, if nothing received continue (goto Timeout)        
            Timeout:     
    
            HSerOut [Str SampleString,13]   'Send sample number to PC application.
    I have tried several variations but all I get is the second character of the string.
    If I send CANCON I can see this in the VSM so I know the PC app is sending it but all I get back is A on the serial output. If I change the PC data to CXNCON I then get X.

    I have tried Len on the string and it shows as 1 so it appears it is not receiving it correctly.

    Any ideas what I could be doing wrong.

    Regards,
    Bob
    Last edited by RGV250; 18th January 2020 at 21:53.

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.

  • #2
    Fanatical Contributor top204's Avatar
    Join Date
    Feb 2002
    Posts
    3,483
    Thumbs Up
    Received: 315
    Given: 147
    Total Downloaded
    1.99 GB

    0 Not allowed!

    Default Re: Problem receiving string

    What device are you using Bob?

    Each device family (18F, standard 14-bit, enhanced 14-bit, PIC24, dsPIC33) has different asm routines for array and string handling, and also diffferent compiler handling of them because of the differences.

  • 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
    Prolific Poster RGV250's Avatar
    Join Date
    Aug 2005
    Posts
    2,350
    Thumbs Up
    Received: 29
    Given: 7
    Total Downloaded
    1.09 GB

    0 Not allowed!

    Default Re: Problem receiving string

    Hi Les,
    It is 18F4680

    Bob

  • 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.

  • #4
    Fanatical Contributor top204's Avatar
    Join Date
    Feb 2002
    Posts
    3,483
    Thumbs Up
    Received: 315
    Given: 147
    Total Downloaded
    1.99 GB

    0 Not allowed!

    Default Re: Problem receiving string

    I've just checked the code on an 18F device and it is working as expected. However, the 1ms timeout in the Hserin command is a bit tight and will probaly miss characters and timeout far too early.

    I moved up the timeout to 100 and received the characters from the serial terminal.

  • 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
    Prolific Poster RGV250's Avatar
    Join Date
    Aug 2005
    Posts
    2,350
    Thumbs Up
    Received: 29
    Given: 7
    Total Downloaded
    1.09 GB

    0 Not allowed!

    Default Re: Problem receiving string

    Hi Les,
    Thanks for looking, I have tried at 100 and it still only appears to get the second character. It is fine if I sent single "1","2","3","4" or "C",S","R" etc and use Dim IN_CHR as byte.
    At the moment I am only using 9600 so it may be that, I am not sure why I picked that speed so I will try faster tomorrow.
    Also it is all simulated which may be the issue but I doubt it. I am using VSPE (Virtual serial port emulator) to link Labcenter VSM to the PC app Xojo.

    Regards,
    Bob

  • 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.

  • #6
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,284
    Thumbs Up
    Received: 78
    Given: 182
    Total Downloaded
    5.30 GB

    0 Not allowed!

    Default Re: Problem receiving string

    I am using VSPE (Virtual serial port emulator) to link Labcenter VSM to the PC app Xojo.
    I suspect with all those levels of "stuff" real time is not (to say the least) doable.
    George.

  • 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
    Prolific Poster RGV250's Avatar
    Join Date
    Aug 2005
    Posts
    2,350
    Thumbs Up
    Received: 29
    Given: 7
    Total Downloaded
    1.09 GB

    0 Not allowed!

    Default Re: Problem receiving string

    Hi George,
    I have tried twice to reply from my phone but all sorts of problems and kept getting told I was not logged in. Anyway, on the desktop now so should be OK.

    If I send text the PC app gets it OK, I haven't tried with a string variable though.
    I have a few ideas,
    I am going to try Putty to take the PC app out of the equasion.
    Change the baud to 115200.
    Change the single data in (which works) to a string to see if that stops working.

    Bob

  • 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.

  • #8
    Prolific Poster RGV250's Avatar
    Join Date
    Aug 2005
    Posts
    2,350
    Thumbs Up
    Received: 29
    Given: 7
    Total Downloaded
    1.09 GB

    0 Not allowed!

    Default Re: Problem receiving string

    Hi,
    I am getting there, I had to move the data to another variable and clear the input buffer, it works now but it is not 100% reliable particularly with the first message. I think it will be better with an interrupt but some of it could be due to simulating everything. It does save a lot of time though doing it that way.

    This is what I added.
    Code:
            HSerIn 100,Timeout,[Str InString]      'Check for input, allow 100ms, if nothing received continue (goto Timeout)        
            Timeout:        
    
    'Store the data from the input buffer and clear for next incoming message.
            If Len [InString] > 0 Then 
            SampleString = InString 
            Clear InString
            EndIf
    Bob

  • 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
    Prolific Poster John Drew's Avatar
    Join Date
    Feb 2002
    Posts
    2,844
    Thumbs Up
    Received: 90
    Given: 34
    Total Downloaded
    4.60 GB

    0 Not allowed!

    Default Re: Problem receiving string

    G'day Bob,
    I would have thought that lower baud rates would be less error prone than 119k.
    John

  • 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.

  • #10
    Prolific Poster RGV250's Avatar
    Join Date
    Aug 2005
    Posts
    2,350
    Thumbs Up
    Received: 29
    Given: 7
    Total Downloaded
    1.09 GB

    0 Not allowed!

    Default Re: Problem receiving string

    Hi John,
    My only thought was if it was too slow it may miss data, I have resolved that issue now I think. I found a serial sample which had interrupts, I modified it quite a bit and now it all seems to work as expected.

    The only issue now is that what seemed like a simple idea with a few notes on a beer coaster is looking like it will be quite a challenge.

    Regards,
    Bob

  • 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
    Prolific Poster John Drew's Avatar
    Join Date
    Feb 2002
    Posts
    2,844
    Thumbs Up
    Received: 90
    Given: 34
    Total Downloaded
    4.60 GB

    0 Not allowed!

    Default Re: Problem receiving string

    Hi Bob,
    I much prefer using hardware so I can detect an interrupt and with the 1 byte buffer it is very unlikely to miss a character.
    Best wishes
    John

  • 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. Advice on receiving data string
      By joesaliba in forum Proton Plus Compiler v3
      Replies: 60
      Last Post: 26th November 2016, 01:28
    2. [SOLVED !] problem with string
      By resistor in forum Proton Plus Compiler v3
      Replies: 18
      Last Post: 17th February 2014, 21:28
    3. String Problem
      By Barry in forum Proton Plus Compiler v3
      Replies: 2
      Last Post: 3rd November 2009, 00:49
    4. problem with string and array
      By DanielV in forum Proton Plus Compiler v3
      Replies: 0
      Last Post: 27th December 2005, 13:14

    Posting Permissions

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