serial coms - again


Closed Thread
Results 1 to 40 of 58

Hybrid View

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

    Default serial coms - again

    Can someone point me in the right direction. An acquaintance is working with me on my thermostat project (he is writing the PC application) and I've stumbled upon a problem that I can't seem to resolve.

    The following code outputs data via the port to the application
    Code:
    Hserout [dec Temperatures[0],dec Temperatures[1],dec Temperatures[2],dec Temperatures[3]]
    HSEROUT [dec normtemp[0],dec normtemp[1],dec normtemp[2],dec normtemp[3]]
    HSEROUT [dec alarmlow[0],dec alarmlow[1],dec alarmlow[2],dec alarmlow[3]]
    HSEROUT [dec alarmhigh[0],dec alarmhigh[1],dec alarmhigh[2],dec alarmhigh[3]]
    HSEROUT [dec lightoffHR[0],dec lightoffMN[0],dec lightoffHR[1],dec lightoffMN[1]]       
    HSEROUT [dec lightsetHR[0],dec lightsetMN[0],dec lightsetHR[1],dec lightsetMN[1]]
    HSEROUT [dec Droptemp[0],dec Droptemp[1],dec Droptemp[2],dec Droptemp[3]]
    HSEROUT [dec StopHour[0],dec StopMin[0],dec StopHour[1],dec StopMin[1],dec StopHour[2],dec StopMin[2],dec StopHour[3],dec StopMin[3]]
    It compiles and the PIC runs as it should and data is sent to the PC, and displayed withing the interface.

    However as soon as I enter a HSERIN line as

    Code:
    Hserin [dec Temperatures[0],dec Temperatures[1],dec Temperatures[2],dec Temperatures[3]]
    HSERin [dec normtemp[0],dec normtemp[1],dec normtemp[2],dec normtemp[3]]
    HSERin [dec alarmlow[0],dec alarmlow[1],dec alarmlow[2],dec alarmlow[3]]
    HSERin [dec alarmhigh[0],dec alarmhigh[1],dec alarmhigh[2],dec alarmhigh[3]]
    HSERin [dec lightoffHR[0],dec lightoffMN[0],dec lightoffHR[1],dec lightoffMN[1]]       
    HSERin [dec lightsetHR[0],dec lightsetMN[0],dec lightsetHR[1],dec lightsetMN[1]]
    HSERin [dec Droptemp[0],dec Droptemp[1],dec Droptemp[2],dec Droptemp[3]]
    HSERin [dec StopHour[0],dec StopMin[0],dec StopHour[1],dec StopMin[1],dec StopHour[2],dec StopMin[2],dec StopHour[3],dec StopMin[3]]
    
    Hserout [dec Temperatures[0],dec Temperatures[1],dec Temperatures[2],dec Temperatures[3]]
    HSEROUT [dec normtemp[0],dec normtemp[1],dec normtemp[2],dec normtemp[3]]
    HSEROUT [dec alarmlow[0],dec alarmlow[1],dec alarmlow[2],dec alarmlow[3]]
    HSEROUT [dec alarmhigh[0],dec alarmhigh[1],dec alarmhigh[2],dec alarmhigh[3]]
    HSEROUT [dec lightoffHR[0],dec lightoffMN[0],dec lightoffHR[1],dec lightoffMN[1]]       
    HSEROUT [dec lightsetHR[0],dec lightsetMN[0],dec lightsetHR[1],dec lightsetMN[1]]
    HSEROUT [dec Droptemp[0],dec Droptemp[1],dec Droptemp[2],dec Droptemp[3]]
    HSEROUT [dec StopHour[0],dec StopMin[0],dec StopHour[1],dec StopMin[1],dec StopHour[2],dec StopMin[2],dec StopHour[3],dec StopMin[3]]
    The compiled code causes the PIC to hang. - Remove the HSERIN section and it runs ! (this is regardless if the serial cable is connected to the PC or not, or if the application is runnig or not )

  2. #2
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Try it without the DEC modifiers on your HSERIN lines.

    And it's going to hang until all bytes it's expecting arrive unless you use a timeout/label option.
    Last edited by Bruce; - 20th August 2010 at 17:42.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  3. #3
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Bruce, thanks for the prompt reply.

    I've tried commenting out all but the first vairiable so it is only expecting only one value, but that still caused the thing to run really really slowly ... as does removing the DEC modifier could you provide me with a quick example of how to to a time out to try?

  4. #4
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Hi Malc,

    There's an example in the manual, but it works like this;

    HSERIN 100,Timesup,[B0]

    Timesup:
    do something here is data not received

    If no character is received in B0 within 100mS it jumps to Timesup.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  5. #5
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    cheers Bruce...

    Sorry, heat of the moment, quicker to ask than dig out the manual !

  6. #6
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Bruce,

    One other thing that has come to light is that I need clear the buffer after
    Code:
    HSEROUT [dec StopHour[0],dec StopMin[0],dec StopHour[1],dec StopMin[1],dec StopHour[2],dec StopMin[2],dec StopHour[3],dec StopMin[3]
    I gather this is required so that it places the correct variable in the right location in the application.

    Any ideas

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