pulsin followed by serin2 problem


Results 1 to 8 of 8

Threaded View

  1. #7
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    It's amix of many things. One thing scratch my brain
    Code:
    main: 
        input PORTB.0
        input PORTD.4
        gosub xmit_off
        gosub wait_for_t0
    
    wait_for_t0: 
        if portb.0= 0 then wait_for_t0 ' loop until rssi goes high
    Take care of the Gosub / Return use. It's amazing how fast your program can behave weird when using few nested gosubs...

    the following snip is the source of your headache
    Code:
    wait_for_t0: 
        if portb.0= 0 then wait_for_t0 ' loop until rssi goes high
        
        pulsin portd.4,1,PLENGTH1 ' MEASURE TIME C2 IS HIGH AND STORE
        IF PLENGTH1 > 255 AND PLENGTH1 < 270 THEN COUNTPULSes ' 42 usec error allowed
        gosub get_comnd
            ' made into sub routine get_cmnd 
            'serin2 b2,16780,1000,wait_for_t0,[WAIT ("$$"),cmnd] ' get command wait $$ timeout 1 secs added
            'HSEROUT ["debug command = ",dec2 cmnd,13,10]
        GOTO wait_for_t0 
        '
        '
        '    
    get_comnd: 
        serin2 b2,16780,1000,wait_for_t0,[WAIT ("$$"),cmnd] ' get command wait $$ timeout 1 secs added
        HSEROUT ["debug command = ",dec2 cmnd,13,10]
        return
    easy to overflow the stack with this
    Last edited by mister_e; - 17th September 2005 at 18:57.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Pulsin problem?
    By Skylar in forum mel PIC BASIC
    Replies: 3
    Last Post: - 27th May 2009, 15:40
  2. Serout2 and Serin2 problem
    By MrSafe in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 26th July 2007, 04:33
  3. Pulsin 16F819 problem
    By rekcahlaer in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 11th April 2007, 13:52
  4. a problem RF Signal with PULSIN
    By muskut in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 22nd July 2005, 16:42
  5. Serin2 problem on 16F876
    By jrt4fun in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 29th May 2004, 17:24

Members who have read this thread : 0

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