serial coms - again


Results 1 to 40 of 58

Threaded View

  1. #34
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Update,

    I'm stumped as to why this is happening when the 27th byte is sent. To check if it was the sending of data that was the problem, I simply made the code jump to the TX part of the program and send the data, then pause a little while before returning to the main program loop. When I ran this the PIC ran fine, sending data over and over again.

    So this would suggest that the trigger is something to do with the receiving side. But what ?

    The code simply jumps to either the sub-routine that receives data and updates variables or the subroutine that sends data, depending if Q or S is received. What is significant about the 27th byte !

    FIXED !!!!!

    I have no idea if this is just murphy's law or it was something to do with the mix of gosubs / goto's but I've re-coded as follows and it seems to work (well it's sent over 35 bytes to the PIC and it hasn't yet restarted)

    Code:
    ;----[check for data on com port] 
    
        FOR TempWD = 0 TO 10000
            IF RCIF THEN GOTO coms
            PauseUs 100
        NEXT TempWD
    ;--------------------------------
    I then have the checking for Q or S

    Code:
    coms:
    HSERIN [nTest]
        SELECT CASE nTest
        CASE "Q"                    ; if Q then send data to PC
        Goto Term_TX 
        CASE "S"
        goto Term_RX
    return
    Then the TX and RX simply jump back to the start of the main loop after sending or receiving data

    Why placing the test for Q or S inside the RX bit caused the problem, when segregating it as a separate sub routine I have no idea... and I seem to recall I tried this the other week.... but guess I got lucky this time round
    Last edited by malc-c; - 26th September 2010 at 14:01. Reason: seemed to fix the problem

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