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.
- FRDM-K64F board has been tested with the following patch:
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:
- Plug the X-NUCLEO-PLC01A1 onto a base board
- Connect the base board to a PC via a standard Type A / mini (or micro) B USB cable
- Download the firmware on the MCU hosted on the base board
- Supply 24 V to the X-NUCLEO-PLC01A1 board through the J8 connector
- 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@0:b66a560b6618, 2016-02-19 (annotated)
- Committer:
- apalmieri
- Date:
- Fri Feb 19 10:56:30 2016 +0000
- Revision:
- 0:b66a560b6618
- Child:
- 2:1ec0dea195f8
Library to handle the X-NUCLEO-PLC01A1 Programmable Logic Controller Expansion Board.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
apalmieri | 0:b66a560b6618 | 1 | /** |
apalmieri | 0:b66a560b6618 | 2 | ****************************************************************************** |
apalmieri | 0:b66a560b6618 | 3 | * @file plc.h |
apalmieri | 0:b66a560b6618 | 4 | * @author System Lab Noida |
apalmieri | 0:b66a560b6618 | 5 | * @version V1.0.0 |
apalmieri | 0:b66a560b6618 | 6 | * @date 08-July-2015 |
apalmieri | 0:b66a560b6618 | 7 | * @brief This header file contains the functions prototypes for the |
apalmieri | 0:b66a560b6618 | 8 | * plc driver. |
apalmieri | 0:b66a560b6618 | 9 | ****************************************************************************** |
apalmieri | 0:b66a560b6618 | 10 | * @attention |
apalmieri | 0:b66a560b6618 | 11 | * |
apalmieri | 0:b66a560b6618 | 12 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
apalmieri | 0:b66a560b6618 | 13 | * |
apalmieri | 0:b66a560b6618 | 14 | * Redistribution and use in source and binary forms, with or without modification, |
apalmieri | 0:b66a560b6618 | 15 | * are permitted provided that the following conditions are met: |
apalmieri | 0:b66a560b6618 | 16 | * 1. Redistributions of source code must retain the above copyright notice, |
apalmieri | 0:b66a560b6618 | 17 | * this list of conditions and the following disclaimer. |
apalmieri | 0:b66a560b6618 | 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
apalmieri | 0:b66a560b6618 | 19 | * this list of conditions and the following disclaimer in the documentation |
apalmieri | 0:b66a560b6618 | 20 | * and/or other materials provided with the distribution. |
apalmieri | 0:b66a560b6618 | 21 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
apalmieri | 0:b66a560b6618 | 22 | * may be used to endorse or promote products derived from this software |
apalmieri | 0:b66a560b6618 | 23 | * without specific prior written permission. |
apalmieri | 0:b66a560b6618 | 24 | * |
apalmieri | 0:b66a560b6618 | 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
apalmieri | 0:b66a560b6618 | 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
apalmieri | 0:b66a560b6618 | 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
apalmieri | 0:b66a560b6618 | 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
apalmieri | 0:b66a560b6618 | 29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
apalmieri | 0:b66a560b6618 | 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
apalmieri | 0:b66a560b6618 | 31 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
apalmieri | 0:b66a560b6618 | 32 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
apalmieri | 0:b66a560b6618 | 33 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
apalmieri | 0:b66a560b6618 | 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
apalmieri | 0:b66a560b6618 | 35 | * |
apalmieri | 0:b66a560b6618 | 36 | ****************************************************************************** |
apalmieri | 0:b66a560b6618 | 37 | */ |
apalmieri | 0:b66a560b6618 | 38 | |
apalmieri | 0:b66a560b6618 | 39 | |
apalmieri | 0:b66a560b6618 | 40 | /* Define to prevent recursive inclusion -------------------------------------*/ |
apalmieri | 0:b66a560b6618 | 41 | #ifndef __PLC_H |
apalmieri | 0:b66a560b6618 | 42 | #define __PLC_H |
apalmieri | 0:b66a560b6618 | 43 | |
apalmieri | 0:b66a560b6618 | 44 | #ifdef __cplusplus |
apalmieri | 0:b66a560b6618 | 45 | extern "C" { |
apalmieri | 0:b66a560b6618 | 46 | #endif |
apalmieri | 0:b66a560b6618 | 47 | |
apalmieri | 0:b66a560b6618 | 48 | /* Includes ------------------------------------------------------------------*/ |
apalmieri | 0:b66a560b6618 | 49 | #include <stdint.h> |
apalmieri | 0:b66a560b6618 | 50 | |
apalmieri | 0:b66a560b6618 | 51 | /** @addtogroup BSP |
apalmieri | 0:b66a560b6618 | 52 | * @{ |
apalmieri | 0:b66a560b6618 | 53 | */ |
apalmieri | 0:b66a560b6618 | 54 | |
apalmieri | 0:b66a560b6618 | 55 | /** @addtogroup Components |
apalmieri | 0:b66a560b6618 | 56 | * @{ |
apalmieri | 0:b66a560b6618 | 57 | */ |
apalmieri | 0:b66a560b6618 | 58 | |
apalmieri | 0:b66a560b6618 | 59 | /** @addtogroup PLC |
apalmieri | 0:b66a560b6618 | 60 | * @{ |
apalmieri | 0:b66a560b6618 | 61 | */ |
apalmieri | 0:b66a560b6618 | 62 | |
apalmieri | 0:b66a560b6618 | 63 | /** @defgroup PLC_Exported_Constants |
apalmieri | 0:b66a560b6618 | 64 | * @{ |
apalmieri | 0:b66a560b6618 | 65 | */ |
apalmieri | 0:b66a560b6618 | 66 | #define MAX_NUMBER_OF_PLC_INPUT_COMPONENTS 1 |
apalmieri | 0:b66a560b6618 | 67 | #define MAX_NUMBER_OF_PLC_OUTPUT_COMPONENTS 1 |
apalmieri | 0:b66a560b6618 | 68 | |
apalmieri | 0:b66a560b6618 | 69 | #define NB_BYTES 2 |
apalmieri | 0:b66a560b6618 | 70 | #define BUFFERSIZE 1 |
apalmieri | 0:b66a560b6618 | 71 | |
apalmieri | 0:b66a560b6618 | 72 | /** @defgroup PLC_Exported_Types |
apalmieri | 0:b66a560b6618 | 73 | * @{ |
apalmieri | 0:b66a560b6618 | 74 | */ |
apalmieri | 0:b66a560b6618 | 75 | |
apalmieri | 0:b66a560b6618 | 76 | /** @defgroup PLC_Exported_variables plc Exported variables |
apalmieri | 0:b66a560b6618 | 77 | * @{ |
apalmieri | 0:b66a560b6618 | 78 | * @brief Exported variables |
apalmieri | 0:b66a560b6618 | 79 | */ |
apalmieri | 0:b66a560b6618 | 80 | |
apalmieri | 0:b66a560b6618 | 81 | /** |
apalmieri | 0:b66a560b6618 | 82 | * @brief Component's Status enumerator definition. |
apalmieri | 0:b66a560b6618 | 83 | */ |
apalmieri | 0:b66a560b6618 | 84 | typedef enum |
apalmieri | 0:b66a560b6618 | 85 | { |
apalmieri | 0:b66a560b6618 | 86 | COMPONENT_OK = 0, |
apalmieri | 0:b66a560b6618 | 87 | COMPONENT_ERROR, |
apalmieri | 0:b66a560b6618 | 88 | COMPONENT_TIMEOUT, |
apalmieri | 0:b66a560b6618 | 89 | COMPONENT_NOT_IMPLEMENTED |
apalmieri | 0:b66a560b6618 | 90 | } DrvStatusTypeDef; |
apalmieri | 0:b66a560b6618 | 91 | |
apalmieri | 0:b66a560b6618 | 92 | /** |
apalmieri | 0:b66a560b6618 | 93 | * @brief SSRELAY driver structure definition |
apalmieri | 0:b66a560b6618 | 94 | */ |
apalmieri | 0:b66a560b6618 | 95 | typedef struct |
apalmieri | 0:b66a560b6618 | 96 | { |
apalmieri | 0:b66a560b6618 | 97 | void (*SetChannels) (uint8_t Out_array); |
apalmieri | 0:b66a560b6618 | 98 | uint8_t (*ManageFault)(void); |
apalmieri | 0:b66a560b6618 | 99 | uint8_t (*CheckDCDCStatus)(void); |
apalmieri | 0:b66a560b6618 | 100 | uint8_t (*TemperatureWarning)(void); |
apalmieri | 0:b66a560b6618 | 101 | uint8_t (*CheckParity)(void); |
apalmieri | 0:b66a560b6618 | 102 | uint8_t (*CheckPowerGood)(void); |
apalmieri | 0:b66a560b6618 | 103 | uint8_t (*CheckCommError)(void); |
apalmieri | 0:b66a560b6618 | 104 | void (*Ssrelay_SetOutput)(uint8_t *TxBuff, uint8_t *RxBuff); |
apalmieri | 0:b66a560b6618 | 105 | } SSRELAY_DrvTypeDef; |
apalmieri | 0:b66a560b6618 | 106 | |
apalmieri | 0:b66a560b6618 | 107 | |
apalmieri | 0:b66a560b6618 | 108 | /** |
apalmieri | 0:b66a560b6618 | 109 | * @brief DIGITALINPUTARRAY driver structure definition |
apalmieri | 0:b66a560b6618 | 110 | */ |
apalmieri | 0:b66a560b6618 | 111 | typedef struct |
apalmieri | 0:b66a560b6618 | 112 | { |
apalmieri | 0:b66a560b6618 | 113 | uint8_t (*GetReadStatus)(void); |
apalmieri | 0:b66a560b6618 | 114 | void (*SetReadStatus)(uint8_t status); |
apalmieri | 0:b66a560b6618 | 115 | uint8_t (*GetInputData)(void); |
apalmieri | 0:b66a560b6618 | 116 | uint8_t (*OverTempAlarm)(void); |
apalmieri | 0:b66a560b6618 | 117 | uint8_t (*CheckParity)(void); |
apalmieri | 0:b66a560b6618 | 118 | uint8_t (*UnderVoltAlarm)(void); |
apalmieri | 0:b66a560b6618 | 119 | void (*DigInpArray_GetInput)(uint8_t *TxBuff, uint8_t *RxBuff); |
apalmieri | 0:b66a560b6618 | 120 | } DIGITALINPUTARRAY_DrvTypeDef; |
apalmieri | 0:b66a560b6618 | 121 | |
apalmieri | 0:b66a560b6618 | 122 | |
apalmieri | 0:b66a560b6618 | 123 | /** |
apalmieri | 0:b66a560b6618 | 124 | * @} |
apalmieri | 0:b66a560b6618 | 125 | */ |
apalmieri | 0:b66a560b6618 | 126 | |
apalmieri | 0:b66a560b6618 | 127 | /** |
apalmieri | 0:b66a560b6618 | 128 | * @} |
apalmieri | 0:b66a560b6618 | 129 | */ |
apalmieri | 0:b66a560b6618 | 130 | |
apalmieri | 0:b66a560b6618 | 131 | /** |
apalmieri | 0:b66a560b6618 | 132 | * @} |
apalmieri | 0:b66a560b6618 | 133 | */ |
apalmieri | 0:b66a560b6618 | 134 | |
apalmieri | 0:b66a560b6618 | 135 | /** |
apalmieri | 0:b66a560b6618 | 136 | * @} |
apalmieri | 0:b66a560b6618 | 137 | */ |
apalmieri | 0:b66a560b6618 | 138 | |
apalmieri | 0:b66a560b6618 | 139 | #ifdef __cplusplus |
apalmieri | 0:b66a560b6618 | 140 | } |
apalmieri | 0:b66a560b6618 | 141 | #endif |
apalmieri | 0:b66a560b6618 | 142 | |
apalmieri | 0:b66a560b6618 | 143 | #endif /* __PLC_H */ |
apalmieri | 0:b66a560b6618 | 144 | /** |
apalmieri | 0:b66a560b6618 | 145 | * @} // end plc Exported Function |
apalmieri | 0:b66a560b6618 | 146 | */ |
apalmieri | 0:b66a560b6618 | 147 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |