USBSERVICE + serout2 problem


Results 1 to 40 of 52

Threaded View

  1. #33
    Join Date
    Dec 2007
    Location
    Paris
    Posts
    101

    Default

    Trying to implement a "console like" behavior but cannot get it to work.

    I'm using RX_Ready to read USB and then entering the desired reaction regarding the received command. However it seems that after doing an USBIn command, RX_Ready does not stay = 0 for very long, even if absolutely no data is received.

    Is RX_Ready indicating a capacity to receive data (buffer not full), just like TX_Ready? In that case I cannot use this to trigger an event upon packet receive...

    To better explain it here is some very dirty code.

    Code:
    MainLoop:
    
    ARRAYWRITE USBBuffer, [">"]
    GOSUB DoUSBOut
    
    GOSUB DoUSBIn
    
    SELECT CASE USBBuffer [0]
        CASE "A", "a"
            GOSUB  EchoData
            ARRAYWRITE USBBuffer, ["OK", 10, 13]
            Gosub DoUSBOut
        CASE ELSE
            GosuB EchoData
            ARRAYWRITE USBBuffer, ["Error", 10, 13]
            GOSUB DoUSBOut
    END SELECT
    
    PAUSE 1000
    
    GOTO MainLoop
    
    '*******************************************************
    'Echo sent frame back
    '*******************************************************
    EchoData:
    
    GOSUB DoUSBOut
    ARRAYWRITE USBBuffer, [10, 13]
    GOSUB DoUSBOut
    
    RETURN
    I'm confused yet about very simple things, like how to clear the buffer between requests. Also here it is polled every seconds, because I do not know how to trigger the event upon packet received... Tried to look for helpful examples without any luck.
    Last edited by aberco; - 9th October 2010 at 00:19.

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

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