Simple demo example of X-NUCLEO-IPS02A1 24V Intelligent Power Switch Library usage.
Dependencies: X_NUCLEO_IPS02A1 mbed
Fork of HelloWorld_IPS02A1 by
HelloWorld_IPS02A1, demo example for IPS02A1 expansion board
Introduction
This example application provides a basic code to show how to use the X-NUCLEO-IPS02A1 Intelligent Power Switch Expansion Board. The example performs current measurements on output Channel 1 (Ch1) and Channel 2 (Ch2), continuously, in the following conditions:
- 1) Ch1 OFF, Ch2 OFF
- 2) Ch1 ON, Ch2 OFF
- 3) Ch1 OFF, Ch2 ON
- 4) Ch1 ON, Ch2 ON
for each configuration the Current for each channel is displayed over an opened console (use Hyperterminal or whatever, set 9600 as bauds, 8-bit data, no parity)
Demo Code
The basic operation done by the demo code, which can be used in the customer application are :
1) In order to use get the singleton instance of the X_NUCLEO_IPS02A1 by calling class method `Instance()`:
// IPS expansion board singleton instance static X_NUCLEO_IPS02A1 *ips_expansion_board = X_NUCLEO_IPS02A1::Instance();
2) Switch-on or Switch-off loads output (Channel 1 or Channel 2) by setting or clearing associated digital input :
ips_expansion_board.vps2535h.In_1 = 1; // switch-on Channel 1
ips_expansion_board.vps2535h.In_2 = 0; // switch-off Channel 2
3) Read Current circulating on Channel 1 or Channel 2 and print on the Terminal
Multisense_Signal= ips_expansion_board.GetCurrent(CHANNEL_1);
printf("Current Ch1 = %2.3fA \n\r", Multisense_Signal);
Multisense_Signal= ips_expansion_board.GetCurrent(CHANNEL_2);
printf("Current Ch2 = %2.3fA \n\r", Multisense_Signal);
Revision 6:32a3eb2a79cd, committed 2016-07-28
- Comitter:
- grussian
- Date:
- Thu Jul 28 16:12:44 2016 +0000
- Parent:
- 5:bc61360d2d79
- Child:
- 7:7a2e3132ce46
- Commit message:
- changed device name into the main from vps235h2 to vps2535h. Imported new version of the X_NUCLEO_IPS02_A1
Changed in this revision
| X_NUCLEO_IPS02A1.lib | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/X_NUCLEO_IPS02A1.lib Mon Jun 13 14:15:09 2016 +0000 +++ b/X_NUCLEO_IPS02A1.lib Thu Jul 28 16:12:44 2016 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/teams/ST-Expansion-SW-Team/code/X_NUCLEO_IPS02A1/#715dcaf74418 +https://developer.mbed.org/teams/ST-Expansion-SW-Team/code/X_NUCLEO_IPS02A1/#b683e69b181c
--- a/main.cpp Mon Jun 13 14:15:09 2016 +0000
+++ b/main.cpp Thu Jul 28 16:12:44 2016 +0000
@@ -1,9 +1,9 @@
/**
******************************************************************************
* @file main.cpp
- * @author APG Mass Market
+ * @author ADG
* @version V1.0.1
- * @date 16-Nov-2015
+ * @date 01-July-2016
* @brief Example application for using the X_NUCLEO_IPS02A1
* Intelligent Power Switch Nucleo expansion board.
******************************************************************************
@@ -163,9 +163,9 @@
case(3):{
printf("Test 2: Ch1=ON, CH2=OFF\n\r");
- ips_expansion_board.vps235h2.In_1 = 1;
- ips_expansion_board.vps235h2.In_2 = 0;
- ips_expansion_board.vps235h2.Fr_Stby = 1;
+ ips_expansion_board.vps2535h.In_1 = 1;
+ ips_expansion_board.vps2535h.In_2 = 0;
+ ips_expansion_board.vps2535h.Fr_Stby = 1;
wait (0.1);
Write_Serial();
Multisense_Signal= ips_expansion_board.GetCurrent(CHANNEL_1);
@@ -180,9 +180,9 @@
case(4):{
printf("Test 3: Ch1=OFF, CH2=ON\n\r");
- ips_expansion_board.vps235h2.In_1 = 0;
- ips_expansion_board.vps235h2.In_2 = 1;
- ips_expansion_board.vps235h2.Fr_Stby = 1;
+ ips_expansion_board.vps2535h.In_1 = 0;
+ ips_expansion_board.vps2535h.In_2 = 1;
+ ips_expansion_board.vps2535h.Fr_Stby = 1;
wait (0.1);
Write_Serial();
Multisense_Signal= ips_expansion_board.GetCurrent(CHANNEL_1);
@@ -197,9 +197,9 @@
case(5):{
printf("Test 4: Ch1=ON, CH2=ON \n\r");
- ips_expansion_board.vps235h2.In_1= 1;
- ips_expansion_board.vps235h2.In_2 = 1;
- ips_expansion_board.vps235h2.Fr_Stby = 1;
+ ips_expansion_board.vps2535h.In_1= 1;
+ ips_expansion_board.vps2535h.In_2 = 1;
+ ips_expansion_board.vps2535h.Fr_Stby = 1;
wait (0.1);
Write_Serial();
Multisense_Signal= ips_expansion_board.GetCurrent(CHANNEL_1);
@@ -246,14 +246,14 @@
void Write_Serial (){
// This code sends messages and data to the serial port.
- printf("Input 1= %d\t", ips_expansion_board.vps235h2.In_1.read());
- printf("Input 2= %d\t", ips_expansion_board.vps235h2.In_2.read());
- printf("Fr_Stby= %d\t\n\r", ips_expansion_board.vps235h2.Fr_Stby.read());
+ printf("Input 1= %d\t", ips_expansion_board.vps2535h.In_1.read());
+ printf("Input 2= %d\t", ips_expansion_board.vps2535h.In_2.read());
+ printf("Fr_Stby= %d\t\n\r", ips_expansion_board.vps2535h.Fr_Stby.read());
}
void Reset_Pins(){
// Reset input pins.
- ips_expansion_board.vps235h2.In_1= 0;
- ips_expansion_board.vps235h2.In_2 = 0;
- ips_expansion_board.vps235h2.Fr_Stby = 0;
+ ips_expansion_board.vps2535h.In_1= 0;
+ ips_expansion_board.vps2535h.In_2 = 0;
+ ips_expansion_board.vps2535h.Fr_Stby = 0;
}
\ No newline at end of file

X-NUCLEO-IPS02A1 - 24V Intelligent power switch expansion board