Shop OBEX P1 Docs P2 Docs Learn Events
API No ack recieved. — Parallax Forums

API No ack recieved.

si8si8 Posts: 20
edited 2012-03-22 06:24 in Accessories
hi,
i am using a program based on sending part of API_Base.bs2. I was wondering what would be a good way ot the the BS2 to resend the data if no ack is received (ie the receiver is temporarily off).
I currently have:

GetFrame:


IF XBdata(0) = $7E THEN ' Check for start delimiter
GOSUB ParseData
ELSEIF XBdata(0) <> $7E THEN
GOSUB package 'go to resend data
ENDIF
RETURN

But that just messes things up.

Any ideas or hints are appreciated

Si

Edit: It works without the IF and when the receiver is on

Comments

  • si8si8 Posts: 20
    edited 2012-03-22 05:25
    I have now made this, but it still doesnt work :(
    package:
      tmo:
      GOSUB clearXBdata
      XBdata(0)= XBDelim
      XBdata(1)= 0
      XBdata(2)= 11
      XBdata(3)= XBTx16
      XBdata(4)= XBFrame
      XBdata(5)= 0
      XBdata(6)= 1
      XBdata(7)= 0
      XBdata(8)= ( tC2 DIG 0) + "0"
      XBdata(9)= ( tC2 DIG 1) + "0"
      XBdata(10)= ( tC2 DIG 2) + "0"
      XBdata(11)= ( rhTrue DIG 0) + "0"
      XBdata(12)= ( rhTrue DIG 1) + "0"
      XBdata(13)= ( rhTrue DIG 2) + "0"
      XBdata(14) = $FF            ' Checksum start value
        FOR idx = 3 TO 13            ' Calculate checksum
             XBdata(14) = XBdata(14) - XBdata(idx)
        NEXT
        FOR idx = 0 TO 14            ' Show data frame
          DEBUG HEX2 XBdata(Idx), " "
        NEXT
        DEBUG CR
    
    
      FOR idx = 0 TO 14            ' Send data frame
             SEROUT Tx,Baud,[XBData(Idx)]
           NEXT
      GOSUB clearXBdata
    
    
      SERIN Rx\RTS,Baud,500,tmo,[WAIT (XBdelim), STR XBdata\14]
      
       FOR idx = 0 TO 14            ' Show data frame
             DEBUG HEX2 XBdata(Idx), " "
           NEXT
        DEBUG CR
        GOSUB getframe
    RETURN
    
  • si8si8 Posts: 20
    edited 2012-03-22 06:24
    I manage to get it to work by using

    DO
    ...
    SERIN...
    IF XBDATA(3) = $89 THEN EXIT
    ...
    LOOP
Sign In or Register to comment.