Hart Protocol, Profibus, Modbus, Embedded Systems Design at Borst Automation

Home Products Downloads Services Links Imprint

Hart PC Software
Hart Slave
Profibus Slave
PC Simulation
TCP/IP Embedded

Hart Slave 1.0 (Free C-Source, Hart Revision 5)

The Hart Slave 1.0 is a HART communication protocol driver for embedded systems with 8 or 16 bit microcontrollers such as 8031 or M16C family. The driver is implementing the HART protocol communication layer 2, thus hiding the bit and byte details of the protocol from the programmer. The software is featuring the following.

Hart Transmitter

  • The implementation is compatible to the HART Protocol Revision 6 and 7 which allows to implement HART Protocol Revision 6 and 7 features in the marshaling command interpreter.

  • Two masters are supported automatically by the driver. The cold start flag and the data changed flag are handled individually for each master.

  • A busy signal is automatically sent to the requesting master if the application is not providing the data within a certain time limit. The driver is saving the command number and responding automatically with the right data if the command is repeated.

  • The driver needs only a very view resources.

  • As an example an additional PC simulation of the HART protocol slave is included in the package!

  • The driver is not supporting burst mode. Please ask for a separate quote if this is required: info@hart-profibus.com.

You may get the source of the Version 1.0 for free.
Download HartSlave 1.0.

Example Source Code

The following shows the global get character function which is called by the receiver interrupt each time when a character is received by the UART.

    /*****************/

void g_HartLoL_getChar()
    /*****************/
{ /* Any time a character is received */
  /* the gap time out is tarted anew. */

  startTimeOut(HRT_TO_GAP, HRT_TO_STATE_GAP);
  m_ucInChar = M_HRT_GET_RCV_CHAR;
  m_ucInErr = M_HRT_GET_RCV_ERROR;
  switch(strHrtComSM.ucState)
  { case HRT_IO_IDLE:
      /* Clear character count in idle state */
      strHrtComSM.ucCount = 0;
      if(m_ucInChar == HRT_PREAMBLE)
      { /* Preamble received, wait for next */
        strHrtComSM.ucState = HRT_WAIT_NEXT_PREAMBLE;
      }
      break
;
    case HRT_WAIT_NEXT_PREAMBLE:
      if(m_ucInChar == HRT_PREAMBLE)
      { /* Two preambles received, wait for delimiter */ 
        strHrtComSM.ucState = HRT_RCV_WAIT_DEL;
      }
      else

      { strHrtComSM.ucState = HRT_IO_IDLE;
      }
      break
;
    case HRT_RCV_WAIT_DEL:
      if (isValidDel())
      { getFirstChar();
        strHrtComSM.ucState = HRT_RCV_READING;
      }
      else
      { /* Waiting for the delimiter only preambles are allowed */
        if(m_ucInChar != HRT_PREAMBLE)
        { /* Clear state to idle */
          strHrtComSM.ucState = HRT_IO_IDLE;
        }
      }
      break;
    case HRT_RCV_READING:
      /* Ignore character if any error is flagged */
      if(!(m_ucInErr & 0x20))
      { getNextChar();
      }
      break;
    case HRT_IO_LOCKED:
      break;
  }
}

The source code of this driver is free of charge. You may download the HartTools at our main page. The free slave software is part of it.

If you like to get more information about the software interface please have a look into the interface description.

Diese Dokumentation ist auch in Deutsch erhältlich.

Note:
  HART is a registered trademark of the HART Communication Foundation.
 

Last updated: 12.04.2009