Shop OBEX P1 Docs P2 Docs Learn Events
BS2-Function Problem with DEBUG — Parallax Forums

BS2-Function Problem with DEBUG

nomadnomad Posts: 276
edited 2008-08-07 15:47 in Propeller 1
Ref: BS2-Function Problem with DEBUG

hi,
i have a problem with a serialConnection with
Debug to Linux-Laptop with a usb-cable

1) from the linuxbox,
i can send a command: as: "4\n" to the
propeller ProtoBoard

myReadDec := BS2.DEBUGIN_Dec
or
myReadChar := BS2.DEBUGIN_Char

at the ReadDatas Function
into Repeat
to break the repeat-loop
if myReadChar == "4" (or if myReadDec > 0)
mySendChar := myReadChar
BS2.Pause(1000) ' 1 second pause

QUIT

its OK the prop goes to SendDatas-Functions
and send "SendData = 1225" back to the linuxBox

Now the problem: i cant send back the input
aka == 4 with myReadChar or mySendChar or myReadDec
to the linuxbox

but with BS2.Debug(RC_Val) its ok

can somebody help me.
excuse my bad english
regards
nomad

myCode:

CON 
  _CLKMODE = XTAL1 + PLL16X     
  _XINFREQ = 5_000_000          

VAR      
 
  LONG ReadStack0[noparse][[/noparse]50]    ' Cog1 Stack Space for ReadDatas from <-  PC
  LONG SendStack1[noparse][[/noparse]50]    ' Cog0 Stack Space for SendDatas to   ->  PC    
  LONG RC_Val
  BYTE myString[noparse][[/noparse]50]
  BYTE myReadChar
  BYTE mySendChar
  LONG myReadDec
  BYTE counter
                             
 
OBJ
  BS2  : "BS2_Functions-2"                    ' Create BS2 Object


PUB main 

        
    RC_Val := 1225
    BS2.start (31,30)                 ' Initialize BS2 Object, Rx and Tx pins for DEBUG

    CogNew(ReadDatas, @ReadStack0)    ' Cog Read Datas from PC as Debug 
    CogNew(SendDatas, @SendStack1)    ' Cog Send Datas to PC as Debug   
                                             

PUB ReadDatas
    Repeat
       'myReadDec := BS2.DEBUGIN_Dec     
       myReadChar := BS2.DEBUGIN_Char
        
       if myReadChar == "4"   'myReadDec > 0
          mySendChar := myReadChar
          outa[noparse][[/noparse]0] := 1
          BS2.Pause(1000)   ' 1 second pause
          outa[noparse][[/noparse]0] := 0
                 
          QUIT

PUB SendDatas 
    Repeat
       BS2.Debug_Str(string(13, "SendDatas = "))  
       ' BS2.Debug_Char(mySendChar)              ' should be == 4    
       ' BS2.Debug_Dec(myReadDec)      
       BS2.Debug_Dec(RC_Val)
               
       counter ++
       if counter == 100
          counter := 0
          QUIT 


Comments

  • Martin HebelMartin Hebel Posts: 1,239
    edited 2008-08-07 06:13
    I see a couple issues, but I still can't resolve the problem:

    - The SendDatas method will meet and exceed 100 times before I may even try to type anything - didn't help.
    - The sendDatas method is on a different cog, meaning I/O may not be correctly set up - fixed, nothing.
    - I don't see the string being printed out 100 times. Nothing from the Cog.
    - The 1st character DEBUG'd is sometimes garbled, before the 1st repeat, send a CR or something to set up for good data.

    Sorry, author of BS2_Functions, but stumped on this one for now...

    -Martin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    SelmaWare Solutions - StampPlot GUI for controllers, XBee and Propeller Application Boards

    Southern Illinois University Carbondale, Electronic Systems Technologies

    Propeller Workshop - Getting started & Using Video - Power Point and Spin Files

  • nomadnomad Posts: 276
    edited 2008-08-07 15:47
    hi martin,
    excuse my late answer, but i working and testing the jumpin.gif code.
    realy its mysterious,
    i must say that on the other side of the prop and usb-cable is a linux-laptiop
    yesterday the code is running .-O
    on the prop reader:
    if myReadDec == 1 or something
    -> the prop breaks the loop and goes to sendDatas
    -> sendDatas is OK on the linuxBox and nothing goes wrong
    -> if you send "1\n" to the prop
    -> on the prop:
    myReadDec := BS2.DEBUGIN_Dec
    if myReadDec == 4
    or
    if myReadDec > 0
    prop makes Quit
    but the prop cant send myReadDec to linux == its 0 zero

    but today bad thing are happened.
    with the same code:
    1) Read Datas dont run.
    2) prop hanging
    2) linux hanging

    first i think its problem with unix and windows
    under widnows CR is Ascii 13
    but under unix its verry different
    if you send Datas to the prop you can do following stuff:
    a) char *sendDatas = "1\r" == this is CarrigeReturn but in this case the prop makes a RESTART
    b) char *sendDatas = "1\n" == this is LF (linefeed) nothing happened.
    c) char *sendDatas ="1\r\n" == CR & LF on the prop

    on the moment at 18.OO GMT i can sendDatas to the LinuxBox

    so i dont what i say.
    if you have some tips for my , thanks
    and thanks for your answer
    and please excuse my bad english
    regards
    nomad
Sign In or Register to comment.