Library to handle the X-NUCLEO-PLC01A1 Programmable Logic Controller Expansion Board based on the VNI8200XP (solid state relay) and CLT01-38SQ7 (octal digital termination array) components.

Dependents:   HelloWorld_PLC01A1

Programmable Logic Controller Library

Library to handle the X-NUCLEO-PLC01A1 Programmable Logic Controller Expansion Board based on the VNI8200XP (solid state relay) and CLT01-38SQ7 (octal digital termination array) components.

Information

For further details on VNI8200XP (Octal high side smart power solid state relay with serial/parallel selectable interface on chip) please refer to ST's web site.

For further details on CLT01-38SQ7 (High speed digital input current limiter) please refer to ST's web site.

SPI configuration

Pin D3 and D13 providing the SPI serial clock are short-circuited in the X-NUCLEO-PLC01A1 Expansion Board.

Please be aware that you may not drive the base board LED if it is connected to pin D13 (as it happens on STM32 Nucleo boards) or D3, otherwise you will get a conflict.

Platform compatibility

  • STM32 NUCLEO boards have been tested with the default configuration provided by the HelloWorld_PLC01A1 example.

return DSPI_HAL_ReadData(spi_address[obj->instance]);

X-NUCLEO-PLC01A1 board powering and startup

The following steps must be followed to run the X-NUCLEO-PLC01A1:

  1. Plug the X-NUCLEO-PLC01A1 onto a base board
  2. Connect the base board to a PC via a standard Type A / mini (or micro) B USB cable
  3. Download the firmware on the MCU hosted on the base board
  4. Supply 24 V to the X-NUCLEO-PLC01A1 board through the J8 connector
  5. The HelloWorld_PLC01A1 demonstration firmware is ready to run: connect any of the 8 inputs on the J8 connector to see the corresponding output on the J10 connector capable of driving a load (i.e. short-circuit input “x” with the 24 V and connect the corresponding output “x” to a load).

Components/Common/plc.h

Committer:
apalmieri
Date:
2016-02-19
Revision:
0:b66a560b6618
Child:
2:1ec0dea195f8

File content as of revision 0:b66a560b6618:

/**
 ******************************************************************************
 * @file    plc.h
 * @author  System Lab Noida
 * @version V1.0.0
 * @date    08-July-2015
 * @brief   This header file contains the functions prototypes for the
 *          plc driver.
 ******************************************************************************
 * @attention
 *
 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
 *
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 *   1. Redistributions of source code must retain the above copyright notice,
 *      this list of conditions and the following disclaimer.
 *   2. Redistributions in binary form must reproduce the above copyright notice,
 *      this list of conditions and the following disclaimer in the documentation
 *      and/or other materials provided with the distribution.
 *   3. Neither the name of STMicroelectronics nor the names of its contributors
 *      may be used to endorse or promote products derived from this software
 *      without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 ******************************************************************************
 */


/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __PLC_H
#define __PLC_H

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include <stdint.h>

/** @addtogroup BSP
  * @{
  */

/** @addtogroup Components
  * @{
  */

/** @addtogroup PLC
  * @{
  */

/** @defgroup PLC_Exported_Constants
  * @{
  */
#define MAX_NUMBER_OF_PLC_INPUT_COMPONENTS 1
#define MAX_NUMBER_OF_PLC_OUTPUT_COMPONENTS 1

#define NB_BYTES 2
#define BUFFERSIZE 1

/** @defgroup PLC_Exported_Types
  * @{
  */

/** @defgroup PLC_Exported_variables     plc Exported variables
  * @{
  * @brief Exported variables 
  */

/**
 * @brief  Component's Status enumerator definition.
 */
typedef enum
{
    COMPONENT_OK = 0,
    COMPONENT_ERROR,
    COMPONENT_TIMEOUT,
    COMPONENT_NOT_IMPLEMENTED
} DrvStatusTypeDef;

/**
 * @brief  SSRELAY driver structure definition
 */
typedef struct
{
  void (*SetChannels) (uint8_t Out_array);
  uint8_t (*ManageFault)(void);
  uint8_t (*CheckDCDCStatus)(void);
  uint8_t (*TemperatureWarning)(void);
  uint8_t (*CheckParity)(void);
  uint8_t (*CheckPowerGood)(void);
  uint8_t (*CheckCommError)(void);
  void (*Ssrelay_SetOutput)(uint8_t *TxBuff, uint8_t *RxBuff);
} SSRELAY_DrvTypeDef;


/**
 * @brief  DIGITALINPUTARRAY driver structure definition
 */
typedef struct
{
  uint8_t (*GetReadStatus)(void);
  void (*SetReadStatus)(uint8_t status);
  uint8_t (*GetInputData)(void);
  uint8_t (*OverTempAlarm)(void);
  uint8_t (*CheckParity)(void);
  uint8_t (*UnderVoltAlarm)(void);
  void (*DigInpArray_GetInput)(uint8_t *TxBuff, uint8_t *RxBuff);       
} DIGITALINPUTARRAY_DrvTypeDef;
    

/**
 * @}
 */

/**
 * @}
 */

/**
 * @}
 */

/**
 * @}
 */

#ifdef   __cplusplus
}
#endif

#endif /* __PLC_H */
/**
  * @} // end   plc Exported Function
  */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/