serial coms - again


Results 1 to 40 of 58

Threaded View

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


    Did you find this post helpful? Yes | No

    Default Serial in

    Guys and Gals, need your help.

    Through an other forum I've had the offer of some assistance from one of it's members. He has written an application (I believe it's in Liberty Basic) and so far we've got it to read the data stream from the PIC and display it in boxes



    We're now trying to get the application to send new values back to the PIC and this is where I need some guidance.

    This is how he is sending data from the application
    This version will send only the target temperatures.
    It should send "S" followed by carriage return
    Then it should send 12 digits (4 sensors * 3 digits) followed by carriage return
    It should then wait 3 seconds to give you time to process stuff, then it will query everything and expect all 108 characters back.
    It will then wait 4 seconds, and display what it received.
    The PBP code contains the following sections

    Code:
    ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -     
        FOR TempWD = 0 TO 1000
            IF RCIF THEN GOSUB Term_RX                
            PAUSE 1
        NEXT TempWD
    ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    I've removed the original code that DT had written which displayed PID info via hyperterminal and replaced it with

    Code:
    Term_RX:
     HSERIN [Char]
        SELECT CASE Char
            CASE "S","s"  
    Hserin [DEC3 normtemp(0)]
    Hserin [DEC3 normtemp(1)]
    Hserin [DEC3 normtemp(2)]
    Hserin [DEC3 normtemp(3)]
        END SELECT
    return
    But when the update button is clicked on the PC app the PIC appears to lock up.

    I would welcome suggestions on what I'm doing wrong, or what's needed to work with the protocol my friend has evolved.

    For reference here is the section that Darrel coded which used to set just one thermostat channel (ie would send just one value ) at a time

    Code:
    Term_RX:
        HSERIN [Char]
        SELECT CASE Char
            CASE "S","s"                            ' Enter Setpoint
                X=1 : Y=22 : GOSUB MoveCursor
                HSEROUT ["Enter SetPoint ... (340=34.0",$F8,"): "]
                HSERIN [DEC SetPoints(EditChannel)]
                GOSUB  TerminalMenu
                SELECT CASE EditChannel
                  CASE 0 : Bvar = EE_SetPoint1
                  CASE 1 : Bvar = EE_SetPoint2
                  CASE 2 : Bvar = EE_SetPoint3
                  CASE 3 : Bvar = EE_SetPoint4
                END SELECT
    
                WRITE Bvar, WORD SetPoints(EditChannel)
    I've got a routine within the code that contains SetPoints(0)=normtemp(0) etc so please don't get confused over the actual variables.
    Attached Images Attached Images  

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