Shop OBEX P1 Docs P2 Docs Learn Events
PropBASIC - High speed comm's almost working — Parallax Forums

PropBASIC - High speed comm's almost working

simonlsimonl Posts: 866
edited 2010-04-18 01:26 in Propeller 1
I've been working on getting Beau Schwabe's 8.42MBaud comm's working with PropBASIC, and it's almost there - I think!

I've got it so I'm able to send/receive a packet of data, but my code for testing if the received data is correct doesn't seem to be working - and now I think I'm just missing something obvious! Would anyone care to take a look at the attached and let me know where I'm going wrong, please?

I think I'm going wrong here:
        RX DataIn                                   ' Read & wait for data packet.

        SENDCRSR 18, 8                              ' Show received packet on screen.
        SENDSTR DataIn

        Flag = 0                                    ' Reset the error flag.

        FOR i = 0 TO PacketSizeMinusOne             ' Check Data and update display only if there is a difference.

            RDLONG DataIn( i ), thisData            ' Get received LONG for test.
            RDLONG DataTest( i ), expectedData      ' Get corresponding test LONG for test.
                        
            IF thisData <> expectedData THEN        ' Did they match?
                Flag = 1                            ' No, so set the error flag.
            ENDIF

        NEXT


        IF Flag = 0 THEN
            INC Match                               ' Flag stayed 0, so we have a match.
        ELSE
            INC Error                               ' Flag changed, so we have a mismatch.
        ENDIF


▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheers,
Simon

www.norfolkhelicopterclub.com

Announcement: To cut costs in the current economic climate, we have switched-off the light at the end of the tunnel.

Comments

  • BeanBean Posts: 8,129
    edited 2010-04-18 00:36
    Hmmm, I'm not seeing anything wrong ???

    Are you using the latest version of PropBasic ? May be a bug that has been fixed.

    Bean

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Use BASIC on the Propeller with the speed of assembly language.
    PropBASIC thread http://forums.parallax.com/showthread.php?p=867134

    March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    There are two rules in life:
    · 1) Never divulge all information
  • kuronekokuroneko Posts: 3,623
    edited 2010-04-18 00:40
    In case it goes wrong what are you actually receiving? Also, when do those transmission errors happen, e.g. in the middle of the block or rather randomly distributed?
  • simonlsimonl Posts: 866
    edited 2010-04-18 00:40
    Hi Bean,

    I'm using 00.00.92 - I think that's the latest, right?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheers,
    Simon

    www.norfolkhelicopterclub.com

    Announcement: To cut costs in the current economic climate, we have switched-off the light at the end of the tunnel.
  • simonlsimonl Posts: 866
    edited 2010-04-18 00:43
    @kuroneko: The "Matched packets" count never appears; all packets are apparently "Error packets", even though the Received Data being displayed is correct!

    I'm pretty sure my error checking code is at fault, but I just can't see the problem.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheers,
    Simon

    www.norfolkhelicopterclub.com

    Announcement: To cut costs in the current economic climate, we have switched-off the light at the end of the tunnel.
  • kuronekokuroneko Posts: 3,623
    edited 2010-04-18 01:04
    simonl said...
    I'm pretty sure my error checking code is at fault, but I just can't see the problem.
    Your datatest array is not currently 4n aligned (4n+1 from what I can see). As your comparison code assumes a long array, the compiled code uses rdlong which isn't going to work too well [noparse]:)[/noparse] I'd suggest moving datatest right after readyflag, before the 9 byte ascii array which is causing the misalignment.
  • simonlsimonl Posts: 866
    edited 2010-04-18 01:26
    @kuroneko: You're brilliant! That fixed it smile.gif Thank you.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheers,
    Simon

    www.norfolkhelicopterclub.com

    Announcement: To cut costs in the current economic climate, we have switched-off the light at the end of the tunnel.
Sign In or Register to comment.