Shop OBEX P1 Docs P2 Docs Learn Events
ser.rxDec question — Parallax Forums

ser.rxDec question

realolmanrealolman Posts: 65
edited 2009-02-01 18:11 in Propeller 1
· I have these two lines in my propeller code:
InputVariable := ser.rxDec 

WhichVariable := ser.rxDec 


the only variable that receives info from rxDec is the second one... doesn't matter which one it is.
If I reverse the order of the two lines, InputVariable will receive the info.

If I only have one line, it seems that the execution stops until I serially transmit something with a chr(13).

I am sending the two lines from VB express. They are both the same and they both send a chr(13) at the end.

I even inserted a delay between the two transmissions... the only one that gets any info is the second one.
what am I doing wrong?

thanks

Comments

  • DiverBobDiverBob Posts: 1,108
    edited 2009-02-01 16:18
    Can you post the rest of the code, kind of hard to speculate right now. I have been using the rxDec quite a bit and it works pretty good.

    Bob
  • realolmanrealolman Posts: 65
    edited 2009-02-01 17:00
    OBJ 
    
    SER : "Extended_FDSerial" 
    
    VAR 
     
     long WhichVariable 
     long InputVariable 
     word Parameter[noparse][[/noparse]100] 
     long MyVariable 
     long Stack[noparse][[/noparse]40] 
     long CountStack[noparse][[/noparse]40] 
     word InputCounter 
     long OldCount 
    
    CON 
    
     ' spin stamp 
     '_CLKMODE = XTAL1 + PLL4X   ' clock speed too low = 1X=10Mhz 
     '_XINFREQ = 10_000_000 
     ' non-spin stamp 
     _CLKMODE = XTAL1 + PLL8X    ' clock speed too high = 80Mhz 
     _XINFREQ = 5_000_000 
    
    PUB Main 
    
     cognew (Serial, @Stack) 
     cognew(CountInput,@CountStack) 
    
    Pub Serial 
    
    'handle serial transmissions 
    
     dira[noparse][[/noparse]17..21]:=%111111 
    
     ser.start(31,30,0,38400) 
    
    
    'this section accepts serial input and output 
    
    repeat 
    
    
     
      If MyVariable <> OldCount     'if counter has incremented 
        ser.dec(MyVariable)         'serial transmit count 
        OldCount :=MyVariable       ' if count has been transmited, make OldCount 
                                    'variable equal to MyVariable so same count 
                                    'is not transmitteed over and over 
    
      If ser.rxcheck <> -1          'checks to see if serial input. 
                                    'if nothing there, returns -1 
    
      'THESE ARE THE TWO LINES
    
        InputVariable := ser.rxDec 
        WhichVariable := ser.rxDec 
    
    
    
        outa[noparse][[/noparse]17..21] :=InputVariable 'if serially input number 
                                  'light LED's 
    
    
        Parameter[noparse][[/noparse]WhichVariable]:=InputVariable 'load the array element with a value 
    
    
    
    
    
    
    
    
    
    
    
    PUB CountInput 
    
    CTRA := %01010 << 26                  'set counter to positive edge detector 
                                          'shifts the %01010 over to the appropriate position 
    
    
    ctra := ctra + 10                     'sets counter to use pin 10 
    
    frqa:=1                               'must set to non zero so it counts up 
    
    
    'read accumulator value and store in variable 
    
    repeat 
    
     MyVariable:=phsa 
    
     If phsa=>360  
     phsa:=0 
    
    

    When I copy and paste this stuff here I lose the Indentations...

    I was trying to boil it down to what I thought were the important lines:
    InputVariable := ser.rxDec 
    WhichVariable := ser.rxDec 
    


    Whichever one I have last gets the info... the first one just seems to ignore it, yet when I have only one line, doesn't matter which one, ·it seems to stop execution and wait for serial transmission to be received and get a chr(13) ... doesn't the frist line stop and wait until it gets a chr(13)?


    Post Edited (realolman) : 2/1/2009 6:05:38 PM GMT
  • realolmanrealolman Posts: 65
    edited 2009-02-01 18:11
    Please disregard, I believe I've figured it out...

    I was forgetting that the first digit I was sending serially was being "used" by ser.Rxcheck to see if there was anything there or not.

    thanks for looking

    Post Edited (realolman) : 2/1/2009 6:23:42 PM GMT
Sign In or Register to comment.