AN1905 ST Microelectronics, Inc., AN1905 Datasheet - Page 47
![no-image](/images/no-image-200.jpg)
AN1905
Manufacturer Part Number
AN1905
Description
St7mc Three-phase BLDC Motor Control Software Library
Manufacturer
ST Microelectronics, Inc.
Datasheet
1.AN1905.pdf
(77 pages)
- Current page: 47 of 77
- Download datasheet (2Mb)
ST7MC THREE-PHASE BLDC MOTOR CONTROL SOFTWARE LIBRARY
4.3.4 ports.c
The purpose of the ports.c module is to centralize all information regarding the I/O ports (in-
cluding the alternate functions) within the same file.
It is intended to clarify the sharing of I/Os between the peripherals and the functions requiring
standard input/outputs, such as LEDs and push button reading.
I/Os are initialized at the beginning of the main program, using the ‘void PORTS_Init(void)’
function. Two functions are handled by this module, needed when running the software library
with the ST7MC starter kit hardware.
4.3.4.1 Push button reading
The function ‘BOOL key_scan(void)’ returns a boolean, TRUE if the push button (connected
to PC0) has been pushed during a minimum duration. This duration can be programmed in
ms, to debounce the button reading. This timing is verified using ‘it_ST7MC.c’ module re-
sources, in ‘void TIMB_Interrupt(void)’ interrupt routine.
The location of the push button (port and bit location) must be specified at the beginning of the
ports.c file. The push button must be connected between ground and a pull-up resistor to get
a low level on the input pin when it is pushed (refer to ST7MC starter kit schematics for de-
tails).
4.3.4.2 LEDs
A set of functions can be called to switch ON, OFF or toggle the two LEDs present on the
starter kit: PORTS_RedLedOn, PORTS_RedLedOff, PORTS_RedLedToggle, etc. It must
be remembered that these two LEDs are powered using a single I/O (see schematics for de-
tails). Consequently:
– they cannot be turned ON simultaneously
– the I/O port state can be configured either as an output or as a floating input to switch OFF
the LEDs.
4.3.5 spi.c
This module contains the code related to the SPI peripheral. The initialization of this peripheral
is made within the ‘void SPI_Init(void)’ function. Care should be taken when configuring the
SPI interface in accordance with the system (particularly operating frequency and polarity).
Communication with a serial EEPROM can be done using the ‘Send_EEPROM(u8 address,
u8 data)’ and ‘Read_EEPROM(u8 address)’ routines.
47/77
Related parts for AN1905
Image
Part Number
Description
Manufacturer
Datasheet
Request
R
![AN177](/images/no-image3.png)
Part Number:
Description:
An Overview og the Phase Locked Loop
Manufacturer:
Philips
Datasheet:
![AN1268](/images/manufacturer_photos/0/6/637/stmicroelectronics_tmb.jpg)
Part Number:
Description:
AN OVERVIEW OF THE LPC FLASH INTERFACE
Manufacturer:
STMicroelectronics
![AN1315](/images/no-image3.png)
Part Number:
Description:
An Evaluation System Interfacing the MPX2000 Series Pressure Sensors to a Microprocessor
Manufacturer:
Motorola / Freescale Semiconductor
![AN1998](/images/no-image3.png)
Part Number:
Description:
An FM-IF system for DECT and other high speed GFSK applications
Manufacturer:
Philips Semiconductors / NXP Semiconductors
![AN2124](/images/no-image3.png)
Part Number:
Description:
An 8 x 8 Discrete Cosine Transform on the StarCore SC140/SC1400 Cores
Manufacturer:
Freescale Semiconductor / Motorola
![AN2428](/images/no-image3.png)
Part Number:
Description:
An Overview of the HCS12 ATD Module
Manufacturer:
Freescale Semiconductor / Motorola
![AN2708](/images/no-image3.png)
Part Number:
Description:
An Introduction to the External Bus Interface on the HCS12X
Manufacturer:
Freescale Semiconductor / Motorola
![AN2783](/images/no-image3.png)
Part Number:
Description:
An RF Data Link Using Tango3 and Romeo2 RF Modules
Manufacturer:
Freescale Semiconductor / Motorola
![STP22NE10L](/images/no-image3.png)
Part Number:
Description:
N-channel 55V - 0.07 Ohm - 22A StripFET Power MOSFET
Manufacturer:
ST Microelectronics, Inc.
Datasheet:
![STP32N06L](/images/no-image3.png)
Part Number:
Description:
Old PRODUCT: Not Suitable For Design-in
Manufacturer:
ST Microelectronics, Inc.
Datasheet:
![2N4014](/images/no-image3.png)
Part Number:
Description:
High-voltage, High Current Switch
Manufacturer:
ST Microelectronics, Inc.
Datasheet:
![L6000](/images/no-image3.png)
Part Number:
Description:
Single Chip Read & Write Channel
Manufacturer:
ST Microelectronics, Inc.
Datasheet:
![BTA10-400GP](/images/no-image3.png)
Part Number:
Description:
10A Triacs
Manufacturer:
ST Microelectronics, Inc.
Datasheet:
![BTA20-600BW](/images/no-image3.png)
Part Number:
Description:
20A Triacs
Manufacturer:
ST Microelectronics, Inc.
Datasheet:
![BTA41-700B](/images/no-image3.png)
Part Number:
Description:
-
Manufacturer:
ST Microelectronics, Inc.
Datasheet: