ST7FLITE35F2M6 STMicroelectronics, ST7FLITE35F2M6 Datasheet

IC MCU 8BIT 8K FLASH 20SOIC

ST7FLITE35F2M6

Manufacturer Part Number
ST7FLITE35F2M6
Description
IC MCU 8BIT 8K FLASH 20SOIC
Manufacturer
STMicroelectronics
Series
ST7r
Datasheets

Specifications of ST7FLITE35F2M6

Core Processor
ST7
Core Size
8-Bit
Speed
8MHz
Connectivity
LINSCI, SPI
Peripherals
LVD, POR, PWM, WDT
Number Of I /o
15
Program Memory Size
8KB (8K x 8)
Program Memory Type
FLASH
Ram Size
384 x 8
Voltage - Supply (vcc/vdd)
2.7 V ~ 5.5 V
Data Converters
A/D 7x10b
Oscillator Type
Internal
Operating Temperature
-40°C ~ 85°C
Package / Case
20-SOIC (7.5mm Width)
Processor Series
ST7FLITE3x
Core
ST7
Data Bus Width
8 bit
Data Ram Size
384 B
Interface Type
LINSCI, SPI
Maximum Clock Frequency
8 MHz
Number Of Programmable I/os
15
Number Of Timers
4
Operating Supply Voltage
2.7 V to 5.5 V
Maximum Operating Temperature
+ 125 C
Mounting Style
SMD/SMT
Development Tools By Supplier
ST7FLITE-SK/RAIS, ST7MDT10-DVP3, ST7MDT10-EMU3, STX-RLINK
Minimum Operating Temperature
- 40 C
On-chip Adc
10 bit, 7 Channel
For Use With
497-5858 - EVAL BOARD PLAYBACK ST7FLITE497-5085 - EVAL BOARD UNIV MOTOR CONTROL497-5049 - KIT STARTER RAISONANCE ST7FLITE
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
Eeprom Size
-
Lead Free Status / Rohs Status
 Details

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
ST7FLITE35F2M6
Manufacturer:
ST
0
Part Number:
ST7FLITE35F2M6TR
Manufacturer:
ST
0
Part Number:
ST7FLITE35F2M6TR
Manufacturer:
ST
Quantity:
20 000
ST7 SOFTWARE LIBRARY
USER MANUAL
November 2005
Ref: DOC-ST7SOFT-LIB

Related parts for ST7FLITE35F2M6

ST7FLITE35F2M6 Summary of contents

Page 1

ST7 SOFTWARE LIBRARY USER MANUAL Ref: DOC-ST7SOFT-LIB November 2005 ...

Page 2

... USE IN LIFE SUPPORT DEVICES OR SYSTEMS MUST BE EXPRESSLY AUTHORIZED. STMicroelectronics PRODUCTS ARE NOT AUTHORIZED FOR USE AS CRITICAL COMPONENTS IN LIFE SUPPORT DEVICES OR SYSTEMS WITHOUT THE EXPRESS WRITTEN APPROVAL OF STMi- croelectronics. As used herein: 1.Life support devices or systems are those which (a) are intended for surgical implant into the body, ...

Page 3

INTRODUCTION This document describes the features, the files structure, examples, module drivers and guidelines for using the ST7 software library package. 1.1 ABBREVIATIONS USED • SCI • ADC • SPI • I2C • CAN • WDG • EEPROM • ...

Page 4

INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...

Page 5

STVD7_3x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...

Page 6

TIMER (TIMER ...

Page 7

OVERVIEW 2.1 FUNCTIONAL SCOPE ST7 library is a software package consisting of device drivers for all standard ST7 peripherals. Each device driver has a set of functions covering the functionality of the peripheral. The source code, developed in ‘C’ ...

Page 8

Getting Started with Tools 3 GETTING STARTED WITH TOOLS 3.1 SOFTWARE TOOLS The library functions have been debugged with the ST7 software toolset. The ST7 software toolset can be found on the MCU CD-ROM or can be downloaded from the ...

Page 9

HOW TO INSTALL THE LIBRARY The library is supplied in a zip package. Extraction of this zip file will give the setup file ST7LibxSetup.exe, where x represents the latest numeric version of the library. Click on the setup file ...

Page 10

Library Structure 4 LIBRARY STRUCTURE 4.1 ST7_LIBX Location: \Root directory Description: The ST7_libx (where x represents the latest numeric version of the library) is in- stalled by default in the root directory comprised of five main components: the ...

Page 11

St7lib_config.h is divided into two major sections: 4.2.1 User part of the ST7lib_config.h – You can customize this portion to your application requirement – You can define your own labels and macros here – You can change the CPU clock ...

Page 12

Library Structure Description: Each subdirectory contains a ‘C’ sub folder which contains peripheral library files. 4.3.2.1 C directory Location: ST7_libx\Peripherals\Periph\sources\C Description: Each subdirectory contains the source files, header files and an example folder showing the usage of the functions. Files: ...

Page 13

Table 1. Supported devices Main device ST72F62 ST72F63B ST72F65 ST72F521 ST72325 ST7232A ST7FLITE0 ST7FLITE1 ST7FLITE2 ST7FLITE3 ST72F264 ST72F561 ST7SUPERLITE 4.5 DOCUMENTATION Location: ST7_LIBx\Documentation Description: This directory contains the global user manual describing each peripheral library and its use in detail. ...

Page 14

Example 5 EXAMPLE Location: ST7_LIBx\Peripherals\Periph\sources\C\Example Description: Contains the example application code for each peripheral individually. The code has been developed using the peripheral library functions exercises the functionality of that peripheral. The configuration and workspace has been provided for users ...

Page 15

WORKSPACE This folder contains configuration and workspace files for both STVD7 ver2.x and 3.x as per the directory structure shown in figure 2. Note: 1. For ST72F561 demo and CAN peripheral, winIDEA workspace is also available. 2. For ST72325 ...

Page 16

How to use the library 6 HOW TO USE THE LIBRARY The next section gives the standard procedure to be followed for all the peripherals. Some specific instructions are given in the section 7.2 which have to be followed if ...

Page 17

Write the application program using the library functions given in the user manual for each peripheral and compile. Caution: Only the ST7lib_config.h and the files contained in the configuration subdirectory of the examples folder are user-modifiable, the rest of ...

Page 18

How to use the library 6.2.2 SPI SPI: This part of the user manual contains the detailed description of all the functions for the SPI. An example C program has been given at the end. The SPI can be used ...

Page 19

Transmission or Reception is performed in Polling Mode and the other in Interrupt Driven Mode. So, you can use any one of the following combinations in full duplex mode. SPI_POLLING_TX SPI_ITDRV_WITHOUTBUF_RX (or) SPI_ITDRV_WITHOUTBUF_TX SPI_POLLING_RX 6.2.3 I2C This part of the ...

Page 20

How to use the library For Example, if ‘N’ Bytes to be received, When N-2’ byte ‘ is received When ‘N-1’ byte is received When ‘N’th byte is received In I2C_GetBuffer, the ACK and STOP bits are automatically managed inside ...

Page 21

Figure 3. Flow-Chart for single byte reception in Master mode 6.2.4 CAN This Section gives an overview of the user guidelines for the CAN Library. The library provides the software routines to use the CAN peripheral for ST72F561 device. The ...

Page 22

How to use the library 6.2.4.1 DESCRIPTION Files Can.c - This file contains the CAN driver source code. Can.h - This file contains the data structure, data type definitions and function prototypes for the driver functions. Can_hr.h - This file ...

Page 23

DATA TYPES The following are the data types used by the driver- canuint8 8-bit unsigned integer canuint16 16-bit unsigned integer There are some data types referenced while calling driver function - CanInitHandle 8-bit unsigned integer (application-specific, depends on the ...

Page 24

How to use the library 4. TX_MSGx_STDID - The standard id part for the MSGx to be transmitted, where x = transmit message number. 5. TX_MSGx_EXTID - The extended id part for the MSGx to be transmitted, where x = ...

Page 25

This declares the memory for storing the standard id part of the message ...

Page 26

How to use the library data into the transmit buffer, application must call CanInterruptDisable( ) and CanInterruptRestore( ) services to avoid an interrupt. 6.3 OTHER PERIPHERALS 6.3.1 TIMER TIMERA and TIMERB can both be used simultaneously, depending on the TIMER ...

Page 27

PRESENTATION OF LIBRARY FUNCTIONS 7.1 LIBRARY REFERENCES Functions are described in the format given below: Function name Function prototype Behaviour Description Input Parameters Output Parameters Required preconditions Functions called Post conditions See also Note Caution Code example Presentation of ...

Page 28

Release Information 8 RELEASE INFORMATION This release supports the following peripherals and devices. 8.1 PERIPHERALS – ADC (8-bit and 10bit): The on-chip Analog to Digital Converter (ADC) peripheral is a 10-bit, successive approximation converter with internal sample and hold circuitry. ...

Page 29

DEVICES – ST72F62 – ST72F63B – ST72F65 – ST72F521 – ST7FLITE0 – ST7FLITE1 – ST7FLITE2 – ST7FLITE3 – ST72F264 – ST72F561 – ST7SUPERLITE – ST72325 – ST7232A Release Information 29/235 ...

Page 30

Function Descriptions 9 FUNCTION DESCRIPTIONS 9.1 GENERAL PURPOSE PERIPHERALS 9.1.1 ADC This software library consists of the following functions for 8-bit and 10-bit ADC. Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See ...

Page 31

Table 2. ADC_Select_Channel Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also Table 3. ADC_Enable Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also ...

Page 32

Function Descriptions Table 4. ADC_Test_Conversn_Complete Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also Table 5. ADC_Conversn_Read Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions ...

Page 33

Table 6. ADC_Disable Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also Example: The following C program shows the use of the ADC functions. Program description: This program converts the analog value ...

Page 34

Function Descriptions 9.1.2 SCI This Library supports 2 SCI of ST72F561 device and 1 SCI on all other devices. For devices with only one SCI no suffix “x” is used in the function names. For 2nd SCI of ST72F561 you ...

Page 35

Table 7. SCIx_Compute_Baudrate Function Name Function Prototype Behaviour Description Input Parameter 1 Input Parameter 2 Output Parameter Required Preconditions Functions called Postconditions Note: – This function takes a large ROM area as calculations for TR, RR and PR are done ...

Page 36

Function Descriptions Table 8. SCIx_Select_Baudrate Function Name Function Prototype Behaviour Description Input Parameters Output Parameter Required Preconditions Functions called Postconditions SCI_PR_X SCI_TR_Y SCI_PR_13 SCI_TR_1 SCI_PR_13 SCI_TR_2 SCI_PR_13 SCI_TR_4 SCI_PR_13 SCI_TR_8 SCI_PR_13 SCI_TR_16 SCI_PR_13 SCI_TR_32 Note: This function saves the ROM ...

Page 37

Table 9. SCIx_Extend_Baudrate Function Name Function Prototype Behaviour Description Input Parameter 1 Input Parameter 2 Input Parameter 3 Output Parameter Required Preconditions Functions called Postconditions SCI_PR_X TR_Y SCI_T SCI_RR SCI_PR_13 R_1 SCI_T SCI_RR SCI_PR_13 R_2 SCI_T SCI_RR SCI_PR_13 R_4 SCI_T ...

Page 38

Function Descriptions Table 10. SCIx_IT_Enable Function Name Function Prototype Behaviour Description Input Parameters Output Parameter Required Preconditions Functions called Postconditions See also 38/235 SCIx_IT_Enable Void SCIx_IT_Enable (SCI_IT_Type SCI_IT_Param) Selects SCI interrupts SCI_IDLE_LINE Enable interrupt due to idle frame reception. SCI_RECEIVE_OVERRUN ...

Page 39

Table 11. SCIx_IT_Disable Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions. Functions called Postconditions See also Table 12. SCIx_Mode Function Name Function Prototype Behaviour Description Input Parameter Output Parameter Required Preconditions Functions called Postconditions See also ...

Page 40

Function Descriptions Table 13. SCIx_PutByte Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also Notes: – You can use some timeout protection while using this function. – This function is for Polling ...

Page 41

Table 15. SCIx_PutBuffer Function Name Function Prototype Behaviour Description Input Parameter 1 Input Parameter 2 Output Parameter Required Preconditions Functions called Postconditions See also Note: This function is for Polling or Interrupt driven mode. Caution: – The application can lose ...

Page 42

Function Descriptions Table 16. SCIx_PutString Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also Note: This function is for Polling or Interrupt driven mode. Caution: – The application can lose control if ...

Page 43

Table 18. SCIx_9thBit_TxRx Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also Notes: – In transmission, the return value of the function is ignored. In reception, the input parameter is not significant. ...

Page 44

Function Descriptions Table 19. SCIx_GetByte Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also Notes: – You can use some timeout protection while using this function. – This function can be used ...

Page 45

Table 20. SCIx_GetBuffer Function Name Function Prototype Behaviour Description Input Parameter 1 Input Parameter 2 Output Parameters Required Preconditions Functions called See also Note: This function is only for Polling mode Caution: The application can lose control if the SCI ...

Page 46

Function Descriptions Table 21. SCIx_GetString Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also Note: This function is only for Polling mode Caution: The application can lose control if the SCI is ...

Page 47

Table 22. SCIx_GetBuffer Function Name Function Prototype Behaviour Description Input Parameter 1 Input Parameter 2 Output Parameters Required Preconditions Functions called Postconditions See also Note: This function is only for Interrupt driven mode. Caution: – Take care not to access ...

Page 48

Function Descriptions Table 23. SCIx_GetString Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also Note: This function is only for Interrupt driven mode. Caution: – Take care not to access the user ...

Page 49

Table 24. SCIx_IsReceptionCompleted Function Name Function Prototype Behaviour Description Input Parameter Output Parameters Required Preconditions Functions called Postconditions 1) These Parameters are returned in Interrupt driven mode only. 2) This Parameter is returned in case of single byte reception only, ...

Page 50

Function Descriptions – reception request for a set of data is over, this function will return the error status of that request only once. If this function is called again (before making next reception request), then the function ...

Page 51

Table 27. SCI2_Clkout_Enable Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions. Functions called Postconditions See also SCI2_Clkout_Enable Void SCI2_Clkout_Enable (void) This function enables the ClockOutput of SCI2 of ST72F561 device. None None None None SCI clock ...

Page 52

Function Descriptions Table 28. SCI2_ClkConfigure Function Name Function Prototype Behaviour Description Input Parameter 1 Input Parameter 2 Output Parameters Required Preconditions. Functions called Postconditions See also 52/235 SCI2_ClkConfigure Void SCI2_ClkConfigure(SCI_PO_PH_t SCI_PO_PH_Param, SCI_LBCL_t SCI_LBCL_Param) Configures the Polarity, Phase and numbers of ...

Page 53

EXAMPLE: The following C program shows how the SCI functions are used. This program runs the following sequence for an SCI without extended baudrate prescaler for polling or interrupt driven mode: – transmits a single byte passed by the user ...

Page 54

Function Descriptions /* Program start */ #include "ST7lib_Config.h" #include "main.h" #define Buf_Size ((unsigned char)20) void main(void); static unsigned int Timeoutcount; unsigned char Buff_Rcv[20]= {" void main (void) { unsigned char Rx_Data = 0; unsigned char NbOfBytes = 20; unsigned char ...

Page 55

SCI_RX_DATA_EMPTY) ); if(User_Timeout_Function()) { if(Err == SCI_RECEIVE_OK) { Rx_Data = SCI_GetByte(); Nop } else { if((unsigned char)Err & SCI_NOISE_ERR if((unsigned char)Err & SCI_OVERRUN_ERR if((unsigned char)Err & SCI_FRAMING_ERR if((unsigned ...

Page 56

Function Descriptions Userfunction (); } if((unsigned char)Err & SCI_PARITY_ERR) { Userfunction (); } } #endif /*----------------------------------------------------------------------------- Transmission through Interrupt Driven without Buffer mode -----------------------------------------------------------------------------*/ #ifdef SCI_ITDRV_WITHOUTBUF_TX SCI_Mode(SCI_TX_ENABLE); if(SCI_IsTransmitCompleted()) { SCI_PutByte((unsigned char)55); while (!(SCI_IsTransmitCompleted())); SCI_PutString(Buff); /* Here,user can perform other tasks ...

Page 57

SCI_FRAMING_ERR if((unsigned char)Err & SCI_PARITY_ERR Rx_Data = SCI_GetByte(); } } else { while(1); } /*------------------------------Buffer Reception-----------------------------*/ SCI_GetBuffer(Buff_Rcv,(unsigned char)19); /* Any data received before calling this function is ignored*/ /* Here, user can ...

Page 58

Function Descriptions #endif Nop } /****************************************************************************** Interrupt Subroutine ******************************************************************************/ #ifdef _HIWARE_ #pragma TRAP_PROC SAVE_REGS #else #ifdef _COSMIC_ @interrupt #else #error"Unsupported Compiler!" #endif #endif void sci_rt (void) { SCI_IT_Function(); } /*******************************End OF ISR************************************/ /*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**/ void Userfunction(void) { SCI_Forced_Clear_Flag(); } BOOL User_Timeout_Function(void) ...

Page 59

SPI Following are the functions related to SPI: Function Name Function Prototype Behaviour Description Input Parameter 1 SPI_Init Void SPI_Init ( SPI_Init_Parameter1 Init_Value1, SPI_Init_Parameter2 Init_Value2) Initialization of the SPI. By default the SPI is put in slave mode (hardware ...

Page 60

Function Descriptions Input Parameter 2 Output Parameters Required Preconditions Functions called Postconditions See also Note: If you want to select the Interrupt driven communication mode, you must enable inter- rupts during initialization. Table 29. SPI_Output_Disable Function Name Function Prototype Behaviour ...

Page 61

Table 30. SPI_PutByte Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also Notes: – The above function is only for SPI Polling or SPI Interrupt driven modes. – recommended to ...

Page 62

Function Descriptions Table 31. SPI_PutString Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also Notes: – The above function is only for SPI Polling mode. – For transmission in software slave mode, ...

Page 63

Table 32. SPI_PutBuffer Function Name Function Prototype Behaviour Description Input Parameter 1 Input Parameter 2 Output Parameters Required Preconditions Functions called See also Notes: – The above function is only for SPI Polling mode. – For transmission in software slave ...

Page 64

Function Descriptions Table 33. SPI_PutString Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also Notes: – The above function is only for SPI Interrupt driven mode. – For software slave mode transmission, ...

Page 65

Table 34. SPI_PutBuffer Function Name Function Prototype Behaviour Description Input Parameter 1 Input Parameter 2 Output Parameters Required Preconditions Postconditions See also Notes: – The above function is only for SPI Interrupt driven mode. – For transmission in software slave ...

Page 66

Function Descriptions Table 35. SPI_IsTransmitCompleted Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also 1) These Parameters are returned in SPI Interrupt driven mode only. Notes: – The above function is for ...

Page 67

Table 36. SPI_GetByte Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also Notes: – The above function is for SPI Polling or SPI Interrupt driven mode. – recommended to add ...

Page 68

Function Descriptions Table 37. SPI_GetString Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also Note: The above function is only for SPI Polling mode. Caution: The application can lose control if the ...

Page 69

Table 38. SPI_GetBuffer Function Name Function Prototype Behaviour Description Input Parameter 1 Input Parameter 2 Output Parameters Required Preconditions Functions called See also Note: The above function is only for SPI Polling mode. Caution: The application can lose control if ...

Page 70

Function Descriptions Table 39. SPI_GetString Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also Note: The above function is only for SPI Interrupt driven mode. Caution: – Take care not to access ...

Page 71

Table 40. SPI_GetBuffer Function Name Function Prototype Behaviour Description Input Parameter 1 Input Parameter 2 Output Parameters Required Preconditions Functions called Postconditions See also Note: The above function is only for SPI Interrupt driven mode. Caution: – Take care not ...

Page 72

Function Descriptions Table 41. SPI_IsReceptionCompleted Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also 1) These Parameters are returned in SPI Interrupt driven mode only. 2) This Parameter is returned in case ...

Page 73

Table 42. SPI_IT_Function Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also Note: You must use this function only in the Interrupt service routine. Caution: Special care must be taken, while you ...

Page 74

Function Descriptions EXAMPLE: The following C program shows the use of SPI functions. Program Description: This program runs the following sequence for the SPI for SPI Polling and SPI Interrupt driven modes: 1. Transmits a single byte passed by the ...

Page 75

Program Start */ #include "ST7lib_config.h" #include "main.h" /* Declaration of prototypes of user defined functions used in main.c */ void main(void); void main(void) { unsigned char NbOfBytes_get = 10; unsigned char NbOfBytes_put = 10; unsigned char Rx_Data; unsigned char ...

Page 76

Function Descriptions case (SPI_TX_MODF): case (SPI_TX_WCOL): User_Function(); break; case SPI_TRANSMIT_OK: break; default: User_Function(); break; } #endif /*========================================================================= Reception through ‘Polling’ mode =========================================================================*/ #ifdef SPI_POLLING_RX Temp2 = SPI_IsReceptionCompleted() ; while ((User_Timeout_Function()) && (Temp2 == SPI_RX_DATA_EMPTY)) { Temp2 = SPI_IsReceptionCompleted ...

Page 77

User_Function(); break; } #endif /*========================================================================= Transmission through 'Interrupt Driven wihtout Buffer Mode' =========================================================================*/ #ifdef SPI_ITDRV_WITHOUTBUF_TX SPI_PutByte (My_Data Here, user can perform other tasks or operations except transmission till the time transmission is complete, after which user can ...

Page 78

Function Descriptions case SPI_TRANSMIT_OK: default else { while ( #endif /*========================================================================= Reception through 'Interrupt Driven wihtout Buffer Mode' =========================================================================*/ #ifdef SPI_ITDRV_WITHOUTBUF_RX Temp2 = SPI_IsReceptionCompleted() ; while ((User_Timeout_Function())&&(Temp2 == SPI_RX_DATA_EMPTY)) { Temp2 = SPI_IsReceptionCompleted ...

Page 79

Here, user can perform other tasks or operations except reception till the time re-ception is complete, after which user can perform reception again */ Temp2 = SPI_IsReceptionCompleted(); while ((User_Timeout_Function()) && (Temp2 == SPI_RX_BUFFER_ONGOING)) { Temp2 = SPI_IsReceptionCompleted(); } /* ...

Page 80

Function Descriptions #endif void SPI_User_IT_Routine (void) { SPI_IT_Function () ; } /*----------------------------------------------------------------------------- USER FUNCTIONS -----------------------------------------------------------------------------*/ BOOL User_Timeout_Function(void) { while(Timeoutcount < 50000) { Timeoutcount++ ; return (TRUE); } return (FALSE void User_Function(void) { SPI_Clear_Flags (); } 80/235 /* SPI ...

Page 81

I2C MASTER Following are the functions related to both Single master and multi master I2C. Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also Note: If you select I2C Interrupt driven ...

Page 82

Function Descriptions Table 44. I2C_MultiMaster_Config Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also *This is only valid for ST72F521/ ST72F63B/ ST72325 devices. **The input parameter, which was available in earlier versions ...

Page 83

Table 45. I2C_Select_Speed Function Name Function Prototype Behaviour Description Input Parameter 1 Input Parameter 2 Output Parameters Required Preconditions Functions called Postconditions See also Note: I2C speed is strongly dependant on the R and C wired on the lines, F ...

Page 84

Function Descriptions Table 46. I2C_Generate_Start Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also Notes: – A start condition is not generated unless I2C_Init or I2C_Generate_Stop is called before this function. – ...

Page 85

Table 47. I2C_Load_Address Function Name Function Prototype Behaviour Description Input Parameter 1 Input Parameter 2 Output Parameters Required Preconditions Functions called Postconditions See also I2C_Load_Address Void I2C_Load_Address (unsigned char Addr_Byte, I2C_Mode_Param Mode_Value) In master mode, transmits the address byte to ...

Page 86

Function Descriptions Table 48. I2C_PutByte Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also Notes: – The above function is for I2C Polling or I2C Interrupt driven mode. – recommended ...

Page 87

Table 49. I2C_PutString Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also * This is applicable only in multimaster I2C. Note: The above function is only for I2C Polling mode. Caution: The ...

Page 88

Function Descriptions Table 50. I2C_PutBuffer Function Name Function Prototype Behaviour Description Input Parameter 1 Input Parameter 2 Output Parameters Required Preconditions Functions called Postconditions See also * This is applicable only in multimaster I2C. Note: The above function is only ...

Page 89

Table 51. I2C_PutString Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also Note: The above function is only for I2C Interrupt driven mode. Caution: – Take care not to access the string ...

Page 90

Function Descriptions Table 52. I2C_PutBuffer Function Name Function Prototype Behaviour Description Input Parameter 1 Input Parameter 2 Output Parameters Required Preconditions Functions called Postconditions See also Note: The above function is only for I2C Interrupt driven mode. Caution: – Take ...

Page 91

Table 53. I2C_IsTransmitCompleted Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also 1) This is applicable only in multimaster I2C device. 2) These Parameters are returned in I2C interrupt driven mode only. ...

Page 92

Function Descriptions Table 54. I2C_GetByte Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also Notes: – The above function is for I2C Polling or I2C Interrupt driven mode. – recommended ...

Page 93

Table 55. I2C_GetBuffer Function Name Function Prototype Behaviour Description Input Parameter 1 Input Parameter 2 Output Parameters Required Preconditions Functions called Postconditions See also * This is applicable only in multimaster I2C. Notes: – The above function is only for ...

Page 94

Function Descriptions Table 56. I2C_GetBuffer Function Name Function Prototype Behaviour Description Input Parameter 1 Input Parameter 2 Output Parameters Required Preconditions Functions called Postconditions See also Notes: – The above function is only for I2C Interrupt driven mode. – ACK ...

Page 95

Table 57. I2C_IsReceptionCompleted Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also 1) This is applicable only in multimaster I2C devices. 2) These Parameters are returned in I2C Interrupt driven mode only. ...

Page 96

Function Descriptions returns the reception status afterwards reception request is over, this function will return the error status of that request only once. If this function is called again (before making next reception request), then the function will ...

Page 97

Table 60. I2C_ACK Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also Table 61. I2C_Peripheral_Disable Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also ...

Page 98

Function Descriptions Table 62. I2C_Generate_Stop Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also Note: In master mode, you must call this function to end data transfer. Caution: In order to generate ...

Page 99

EXAMPLE: The following C program shows the uses of the I2C functions. Program Description: This program runs the following sequence for multimaster I2C (ST72F521 device) for I2C Polling and I2C Interrupt driven communication modes: 1. Transmits a single byte passed ...

Page 100

Function Descriptions BOOL User_Timeout_Function(void) ; void User_Function(void); #define size_buff ((unsigned char) 0x0A) #define My_Data ((unsigned char) 0x55) #define Addr_Byte_Tx ((unsigned char) 0xA0) #define Sub_Byte_Tx ((unsigned char) 0x50) static unsigned int Timeoutcount; #endif /*============================================================*/ /* Program Start */ #include "ST7lib_config.h" #include ...

Page 101

I2C_PutByte (My_Data); Timeoutcount = 0 ; Temp1 = I2C_IsTransmitCompleted() ; while ((User_Timeout_Function()) && (Temp1 != I2C_DATA_TX_OK )) { Temp1 = I2C_IsTransmitCompleted switch (Temp1) { case I2C_TX_AF: case I2C_TX_ARLO: case I2C_TX_BERR: User_Function(); break; default: User_Function(); break Transmission ...

Page 102

Function Descriptions break; default: break; } Timeoutcount = 0 ; Temp2 = I2C_IsReceptionCompleted() ; while ((User_Timeout_Function()) && (Temp2 == I2C_RX_DATA_EMPTY)) { Temp2 = I2C_IsReceptionCompleted (User_Timeout_Function()) { switch (Temp2) { case I2C_RX_ARLO: case I2C_RX_BERR: case I2C_DATA_RX_OK: default: } ...

Page 103

I2C_Generate_Start (); while(!((I2C_IsTransmitCompleted())== I2C_START_OK)); I2C_Load_Address (Addr_Byte_Tx, I2C_TX_MODE); Timeoutcount = 0 ; Temp1 = I2C_IsTransmitCompleted() ; while ((User_Timeout_Function()) && ( Temp1 != I2C_ADD_TX_OK)) { Temp1 = I2C_IsTransmitCompleted switch (Temp1) { case I2C_TX_AF: User_Function(); break; default: break; } I2C_PutByte ...

Page 104

Function Descriptions } } I2C_Generate_Stop (); while (!(I2C_IsStopGen ())) ; } #endif /*========================================================== Reception through ‘Interrupt driven without buffer’ mode ==========================================================*/ /* Communication mode defined as ITDRV_WITHOUTBUF_RX in ST7lib_config Single byte reception */ #ifdef I2C_ITDRV_WITHOUTBUF_RX I2C_Generate_Start (); while(!((I2C_IsTransmitCompleted())== ...

Page 105

Reception of set of data in the user buffer */ I2C_GetBuffer (Buff_Test,(unsigned char) 10); /* Here, user can perform other tasks or operations except reception till the time reception is complete, after which user can perform ...

Page 106

Function Descriptions #else #error"Unsupported Compiler!" #endif #endif void I2C_User_IT_Routine (void) { I2C_IT_Function () ; } /*----------------------------------------------------------------------------- USER FUNCTIONS -----------------------------------------------------------------------------*/ BOOL User_Timeout_Function(void) { while(Timeoutcount < 50000) { Timeoutcount++ ; return (TRUE); } return (FALSE void User_Function(void) { I2C_Error_Clear () ...

Page 107

I2C SLAVE This section contains the description of all the functions for I2C slave. You can select either of the Transmission/Reception modes of I2C implemented inside the library by using the cor- responding #define statement. Figure 4. General Flow ...

Page 108

Function Descriptions Table 64. I2C Slave Functions: Function Name Function Prototype Behaviour Description Input Parameter 1 Input Parameter 2 Input Parameter 3 Output Parameters Required Preconditions Functions called Postconditions See also Notes: – For ST72F63B device there is only one ...

Page 109

Table 65. I2Cs_GetCommMode Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also Notes I2Cs_DEFAULT mode, you should use I2Cs_IsReceptionCompleted to detect the start condition default the slave is ...

Page 110

Function Descriptions Table 66. I2Cs_PutBuffer Function Name Function Prototype Behaviour Description Input Parameter 1 Input Parameter 2 Output Parameters Required Preconditions Functions called Postconditions See also * The maximum size of the buffer is under user control. Notes: – This ...

Page 111

Table 67. I2Cs_PutBuffer Function Name Function Prototype Behaviour Description Input Parameter 1 Input Parameter 2 Output Parameters Required Preconditions Functions called Postconditions See also * The maximum size of the buffer is under user control. Note: The above function is ...

Page 112

Function Descriptions Table 69. I2Cs_IsTransmitCompleted Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also Notes: – The above function is for both polling and Interrupt driven mode. But in I2C_POLLING_TX mode, this ...

Page 113

SCL and SDA lines are released in this function in case of Acknowledge failure and commu- nication proceeds according to the I2C protocol. This function should be called again to de- tect the next event (START / STOP). Table ...

Page 114

Function Descriptions Table 71. I2Cs_GetBuffer Function Name Function Prototype Behaviour Description Input Parameter 1 Input Parameter 2 Output Parameters Required Preconditions Functions called Postconditions See also Note: The above function is only for I2C_ITDRV_WITHOUTBUF_RX mode. Table 72. I2Cs_GetByte Function Name ...

Page 115

Table 73. I2Cs_IsReceptionCompleted Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also Notes: – The above function is for both Polling and Interrupt driven Mode. But in I2C_POLLING_RX it is used only ...

Page 116

Function Descriptions – If this function is called before any reception request is made then it will return I2C_EMPTY until the first data byte is received, and returns the reception status thereafter reception request is over, this function ...

Page 117

Table 76. I2Cs_ITFunction Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also Note: You must use this function only inside the Interrupt service routine. Caution: Special care must be taken when you ...

Page 118

Function Descriptions /*============================================================*/ The following variables are declared in main.h file. main.h: #ifndef MAIN #define MAIN void I2Cs_User_IT_Routine(void); void main(void); BOOL Time_Out(void) ; void User_Function(void); unsigned int count=0; #endif /*============================================================*/ /* Program Start */ /* This example code explains the ...

Page 119

Error_Status=I2Cs_IsReceptionCompleted(); while((!Time_Out()) && (Error_Status != I2Cs_ADDRESS_DETECTED)) /* Time_out() is bring before to remove side-efffect error */ { Error_Status=I2Cs_IsReceptionCompleted(); } Comm_Mode=I2Cs_GetCommMode(); while(Comm_Mode == I2Cs_DEFAULT) { Comm_Mode=I2Cs_GetCommMode(); } /***************** Polling Mode Transmission ****************************/ if(Comm_Mode == I2Cs_TX_MODE SINGLE BYTE TRANSMISSION */ ...

Page 120

Function Descriptions } #endif /******* end of polling mode ******************************/ /******** INTERRUPT DRIVEN MODE *************************************/ #ifdef I2C_ITDRV_WITHOUTBUF_TX I2Cs_PutBuffer(Buff_Out,maxsize); Error_Status=I2Cs_IsTransmitCompleted(); while((!(Time_Out())) && ((Error_Status != I2Cs_TX_DATA_OK) && (Error_Status != I2Cs_OVERFLOW_TX))) { Error_Status=I2Cs_IsTransmitCompleted(); } switch( Error_Status) { case I2Cs_BUFF_TX_ONGOING: I2Cs_OVERFLOW_TX)) case I2Cs_TX_DATA_OK: case ...

Page 121

Comm_Mode=I2Cs_GetCommMode(); while((Comm_Mode == I2Cs_DEFAULT)) { Comm_Mode=I2Cs_GetCommMode(); } if(Comm_Mode == I2Cs_RX_MODE) { Error_Status=I2Cs_IsReceptionCompleted(); /* ONE BYTE RECEPTION */ while((!(Time_Out())) && (Error_Status != I2Cs_RX_DATA_OK)) { Error_Status=I2Cs_IsReceptionCompleted(); } switch(Error_Status) { case I2Cs_RX_DATA_OK: case I2Cs_STOP_DETECTED: case I2Cs_BERR: case I2Cs_GENERAL_CALL: case I2Cs_ADDRESS_DETECTED: case I2Cs_EMPTY: ...

Page 122

Function Descriptions #ifdef I2C_ITDRV_WITHOUTBUF_RX Error_Status=I2Cs_IsReceptionCompleted(); while((!(Time_Out())) && (Error_Status != I2Cs_RX_DATA_OK )) { Error_Status=I2Cs_IsReceptionCompleted(); } switch(Error_Status) { case I2Cs_BUFF_RX_ONGOING: case I2Cs_OVERFLOW_RX: case I2Cs_BERR: case I2Cs_EMPTY: case I2Cs_ADDRESS_DETECTED: case I2Cs_GENERAL_CALL: case I2Cs_RX_DATA_OK: default: } I2Cs_GetBuffer(Buff_In,maxsize); Error_Status=I2Cs_IsReceptionCompleted(); while((!(Time_Out())) && (Error_Status != I2Cs_RX_DATA_OK )) ...

Page 123

COMPARE THE TRANSMITTED AND RECEIVED BYTES ******/ while (single_byte != first_byte); for (i=0;i<maxsize;i++) { //add braces while(Buff_Out[i] != Buff_In[i]); } /****************************************************************/ while(1 End of the main */ /*------------------------------------------------------------------------------ ROUTINE NAME : User_IT_Routine INPUT : None OUTPUT ...

Page 124

Function Descriptions 9.1.6 16-bit TIMER (TIMER) This software library for the 16-bit TIMER can be used for both Timer A and Timer B. To use any of the timers you have to replace Function Name ...

Page 125

Table 77. TIMERx_IT_Enable Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also 1) Not available in ST72F65. Note: Timer B available in ST72F521, ST72F264, ST72325 and ST7232A. Table 78. TIMERx_IT_Disable Function Name ...

Page 126

Function Descriptions Table 79. TIMERx_OCMP_Mode Function Name Function Prototype Behaviour Description Input Parameter 1 Input Parameter 2 Input Parameter 3 Output Parameters Required Preconditions Functions called Postconditions See also Note: If you select Forced compare mode, the input parameter 2 ...

Page 127

Table 80. TIMERx_ICAP_Mode Function Name Function Prototype Behaviour Description Input Parameter 1 Input Parameter 2 Output Parameter Required Preconditions Functions called Postconditions See also 1) Function not available in ST72F65. 1) TIMERx_ICAP_Mode Void TIMERx_ICAP_Mode(Timer_Icap ICAP_I, Timer_Edge EDGE_SELECT_Y) Configures the timer ...

Page 128

Function Descriptions Table 81. TIMERx_PWM_Mode Function Name Function Prototype Behaviour Description Input Parameter 1 Input Parameter 2 Input Parameter 3 Input Parameter 4 Output Parameters Required Preconditions Functions called Postconditions See also 1) Function not available in ST72F65. Notes: – ...

Page 129

The flag due to capture1 is set by hardware when counter reaches the output compare 2 register value and can produce the timer interrupt if the input capture interrupt is enabled and the instruction ‘rim’ is used to clear ...

Page 130

Function Descriptions Table 82. TIMERx_OPM_Mode Function Name Function Prototype Behaviour Description Input Parameter 1 Input Parameter 2 Input Parameter 3 Input Parameter 4 Output Parameter Required Preconditions Functions called. Postconditions See also 1) Function not available in ST72F65. Notes: – ...

Page 131

To perform the input capture only the ICAP2 pin can be used, not the ICAP1 pin. Take care that the counter is reset each time a valid edge occurs on ICAP1 pin and that the capture 1 flag can ...

Page 132

Function Descriptions Table 84. TIMERx_Status_Flag Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also 1) Function not available in ST72F65. 132/235 TIMERx_Status_Flag Bool TIMERx_Status_Flag(Timer_Flag FLAG_F) Checks the status of any one of ...

Page 133

Table 85. TIMERx_Mode_Disable Function Name Function Prototype Behaviour Description Input Parameter Output Parameters Required Preconditions Functions called Postconditions See also 1) Function not available in ST72F65. TIMERx_Mode_Disable Void TIMERx_Mode_Disable(Timer_Mode MODE_M) Disables the timer mode depending upon Input parameter passed. This ...

Page 134

Function Descriptions Table 86. TIMERx_Clear_Flag Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also 1) Function not available in ST72F65. 134/235 TIMERx_Clear_Flag. Void TIMERx_Clear_Flag(Timer_Flag FLAG_F) Clears the status flag depending upon the ...

Page 135

EXAMPLE: The following C program shows the use of the TIMERx functions. Here, x=A as TIMERA is used. You must define TIMERA in ST7lib_config.h. Program description: It compares the output compare2 register value with the free running counter, checks the ...

Page 136

Function Descriptions DESCRIPTION : Interrupt service routine COMMENTS : This gets automatically executed when any of the timer interrupt is enabled. If the same functions are called in the main Tree and the interrupt Tree, the function Re-entrant error occurs ...

Page 137

TIMER (TIMER8) The software library for the 8-bit Timer supports the following function. Note: Currently Timer8 is only available for ST72F561. Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also ...

Page 138

Function Descriptions Table 87. TIMER8_IT_Enable Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also Table 88. TIMER8_IT_Disable Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions ...

Page 139

Table 89. TIMER8_OCMP_Mode Function Name Function Prototype Behaviour Description Input Parameter 1 Input Parameter 2 Input Parameter 3 Output Parameters Required Preconditions Functions called Postconditions See also Note: When the Forced compare mode is selected, the input parameter 2 will ...

Page 140

Function Descriptions Table 90. TIMER8_ICAP_Mode Function Name Function Prototype Behaviour Description Input Parameter 1 Input Parameter 2 Output Parameter Required Preconditions Functions called Postconditions See also 140/235 TIMER8_ICAP_Mode Void TIMER8_ICAP_Mode(Timer8_Icap ICAP_I, Timer8_Edge EDGE_SELECT_Y) Configures the timer8 to Input capture mode. ...

Page 141

Table 91. TIMER8_PWM_Mode Function Name Function Prototype Behaviour Description Input Parameter 1 Input Parameter 2 Input Parameter 3 Input Parameter 4 Output Parameters Required Preconditions Functions called Postconditions See also Notes: – Flags for compare1 & compare2 can not be ...

Page 142

Function Descriptions – The flag due to capture1 is set by hardware when the counter reaches the output compare2 register value and can produce the timer interrupt if the interrupt for input capture is enabled and the instruction ‘rim’ is ...

Page 143

Table 92. TIMER8_OPM_Mode Function Name Function Prototype Behaviour Description Input Parameter 1 Input Parameter 2 Input Parameter 3 Input Parameter 4 Output Parameter Required Preconditions Functions called. Postconditions See also 1) Function not available in ST72F65. Notes: – Flag due ...

Page 144

Function Descriptions – Only the ICAP2 pin can be used to perform input capture, not the ICAP1 pin. Take care that the counter is reset each time a valid edge occurs on the ICAP1 pin and capture 1 flag can ...

Page 145

Table 94. TIMER8_Status_Flag Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also TIMER8_Status_Flag Bool TIMER8_Status_Flag(Timer8_Flag FLAG_F) Checks the status of any one of the timer flags depending upon the input parameter. The ...

Page 146

Function Descriptions Table 95. TIMER8_Mode_Disable Function Name Function Prototype Behaviour Description Input Parameter Output Parameters Required Preconditions Functions called Postconditions See also 146/235 TIMER8_Mode_Disable Void TIMER8_Mode_Disable(Timer8_Mode MODE_M) Disables the timer8 mode depending upon the Input pa- rameter passed. This function ...

Page 147

Table 96. TIMER8_Clear_Flag Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also TIMER8_Clear_Flag. Void TIMER8_Clear_Flag(Timer8_Flag FLAG_F) Clears the status flag depending upon the input parameter passed. This function can be called more ...

Page 148

Function Descriptions EXAMPLE: The following C program shows the use of the TIMER8 functions. Program description: It compares the output compare2 register value with the free running counter, checks the oc- currence of (event) leading edge at ICAP2 pin. It ...

Page 149

ROUTINE NAME : TIMER8_IT_Routine INPUT : None OUTPUT : None DESCRIPTION : Interrupt service routine COMMENTS : This gets automatically executed when any of the timer8 interrupt is enabled. If the same functions are called in the main ...

Page 150

Function Descriptions 9.1.8 LITE TIMER (LT) This software library consists of the following functions for LT. Function Name Function Prototype Behaviour Description Input Parameter Output Parameters Required Preconditions Functions called Postconditions See also 1) Present in ST7FLITE0 and ST7SUPERLITE. 2) ...

Page 151

Table 98. LT_TB Function Name Function Prototype Behaviour Description Input Parameter 1 Output Parameters Required Preconditions Functions called Postconditions See also Table 99. LT_ARR_WriteValue Function Name Function Prototype Behaviour Description Input Parameter Output Parameters Required Preconditions Functions called Postconditions See ...

Page 152

Function Descriptions Table 100. LT_ARR_ReadValue Function Name Function Prototype Behaviour Description Input Parameter Output Parameters Required Preconditions Functions called Postconditions See also 1) This function is present only in ST7FLite 1/2/3 and ST7FDALI. Table 101. LT_CNTR_ReadValue Function Name Function Prototype ...

Page 153

Table 102. LT_Disable Function Name Function Prototype Behaviour Description Input Parameter Output Parameters Required Preconditions Functions called Postconditions See also 1) Present in ST7FLITE0 and ST7SUPERLITE. 2) Present in ST7FLITE1/2/3 and ST7FDALI. LT_Disable Void LT_Disable(Lt_Disable_Param DValue) Disables input capture interrupt ...

Page 154

Function Descriptions Table 103. LT_WDG_Reset Function Name Function Prototype Behaviour Description Input Parameter Output Parameters Required Preconditions Functions called Postconditions See also 2ms @ 8 MHz fosc, therefore You have to use this option at regular intervals ...

Page 155

Table 105. LT_Status_Flag Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also 1) Defined for ST7FLITE0 and ST7SUPERLITE. 2) Defined for ST7FLITE1/2/3 and ST7FDALI. Note: After calling this function for a particular ...

Page 156

Function Descriptions Table 106. LT_Clear_Flag Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also 1) Defined for ST7FLITE0 and ST7SUPERLITE. 2) Defined for ST7FLITE1/2/3 and ST7FDALI. 3) Defined for ST7FLITE0 and ST7SUPERLITE. ...

Page 157

PB3 and PB1 as pushpull output */ IO_Output(IO_PUSH_PULL,IO_PORT_B,((unsigned char)IO_PIN_3 | /*Set Time base to 1ms,Input capture and Timebase interrupts enabled */ LT_Init(((unsigned char)LT_ICAP_IT_ENABLE|(unsigned char)LT_TB_IT_ENABLE)); /* Clear I bit in ...

Page 158

Function Descriptions } IO_Write (IO_PORT_B,IO_PIN_1,IO_DATA_LOW); } /****************************************************************************** Use of TimebaseInterrupt service routine - User has to write this function and map the interrupt vector in .prm file in case of HIWARE or in vector_xxx.c in case of COSMIC ...

Page 159

PWMART This software library for PWMART consists of the following functions: Function Name Function Prototype Behaviour Description Input Parameter Output Parameters Required Preconditions Functions called Postconditions See also PWMART_Init Void PWMART_Init(Typ_Pwmart_InitParameter InitVal- ue) Initialization of the PWMART, by default ...

Page 160

Function Descriptions Table 107. PWMART_Counter_Enable Function Name Function Prototype Behaviour Description Input Parameter 1 Input Parameter 2 Input Parameter 3 Output Parameters Required Preconditions Functions called Postconditions See also Notes: To use PWMART as a timebase, use the following procedure: ...

Page 161

Table 108. PWMART_OCMP_Mode Function Name Function Prototype Behaviour Description Input Parameter 1 Input Parameter 2 Input Parameter 3 Output Parameters Required Preconditions Functions called Postconditions See also PWMART_OCMP_Mode Void PWMART_OCMP_Mode(Pwmart_Compare OC- MP,Pwmart_Output POLARITY,unsigned char Compare_Data) Configures the timer in Output ...

Page 162

Function Descriptions Table 109. PWMART_OCMP_Timebase Function Name Function Prototype Behaviour Description Input Parameter 1 Input Parameter 2 Input Parameter 3 Output Parameters Required Preconditions Functions called Postconditions See also Notes: Here are some time base ranges corresponding to the various ...

Page 163

Table 110. PWMART_PWM_Mode Function Name Function Prototype Behaviour Description Input Parameter 1 Input Parameter 2 Input Parameter 3 Output Parameters ...

Page 164

Function Descriptions frequency and resolution (0x00 to 0xFFh) ARR value Resolution 0 8-bit 0 -127 > 7-bit 128 -191 > 6-bit 192 - 223 > 5-bit 224 - 239 > 4-bit Table 111. PWMART_ICAP_Mode Function Name Function Prototype Behaviour Description ...

Page 165

Table 112. PWMART_ICAP_Getvalue Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also PWMART_ICAP_Getvalue Unsigned char PWMART_ICAP_Getvalue(Pwmart_Icap ICAP_I) Returns the input capture1 or input capture 2 register val- ue depending upon the input ...

Page 166

Function Descriptions Table 113. PWMART_Status_Flag Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also 166/235 PWMART_Status_Flag BOOL PWMART_Status_Flag(Pwmart_Flag FLAG_F) Checks the status of any one of the PWMART flags de- pending upon ...

Page 167

Table 114. PWMART_Clear_Flag Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also PWMART_Clear_Flag Void PWMART_Clear_Flag(Pwmart_Flag FLAG_F) Clears the status flag depending upon the input parameter passed. This function can be called more ...

Page 168

Function Descriptions Table 115. PWMART_Mode_Disable Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also 168/235 PWMART_Mode_Disable Void PWMART_Mode_Disable(Pwmart_Dparam MODE) Disables the PWMART mode depending upon Input pa- rameter passed. This function should ...

Page 169

EXAMPLE: The following C program shows the use of the PWMART functions. Program description: This program detects the event (rising edge) at ARTIC1 pin and generates the PWM signal of frequency 50KHz with duty cycle 33% on the PWM1 pin ...

Page 170

Function Descriptions main Tree and the interrupt Tree, the function Re-entrant error occurs in case COSMIC compiler is used with models other than stack models. -----------------------------------------------------------------------------*/ #ifdef _HIWARE_ #pragma TRAP_PROC SAVE_REGS #else #ifdef _COSMIC_ @interrupt #else #error "Unsupported Compiler!" #endif ...

Page 171

LITE AUTO-RELOAD TIMER (LART) This software library consists of the following functions for LART. Function Name Function Prototype Behaviour Description Input Parameter Output Parameters Required Preconditions Functions called Postconditions See also LART_Init Void LART_Init(Lart_InitParameter InitValue) Initialization of the LART, ...

Page 172

Function Descriptions Table 116. LART_Disable Function Name Function Prototype Behaviour Description Input Parameter Output Parameters Required Preconditions Functions called Postconditions See also 1) Feature available only for ST7FLite1, ST7FLite2, ST7FLite3 and ST7DALI devices. 2) Feature available only on ST7FLite3 device. ...

Page 173

Table 117. LART_PWM_Mode Function Name Function Prototype Behaviour Description Input Parameter 1 Input Parameter 2 Input Parameter 3 Output Parameters Required Preconditions Functions called Postconditions See also Notes: – This function can be used only with ST7FLite0 devices. – This ...

Page 174

Function Descriptions Table 118. LART_ConfigurePWM Function Name Function Prototype Behaviour Description Input Parameter 1 Input Parameter 2 Input Parameter 3 Input Parameter 4 Output Parameters Required Preconditions Functions called 174/235 LART_ConfigurePWM Void LART_ConfigurePWM (Lart_PWMChannel PWM- Channel, unsigned int Autoreload_Value, Lart_Output ...

Page 175

Postconditions See also 1) Feature available only for ST7FLite1, ST7FLite2, ST7FLite3 and ST7DALI devices. Note: This function configures only one PWM channel at one time configure multiple PWM Channels this function should be called multiple times. Table 119. ...

Page 176

Function Descriptions Table 120. LART_ConfigureOCMP Function Name Function Prototype Behaviour Description Input Parameter 1 Input Parameter 2 Output Parameters Required Preconditions Functions called Postconditions See also 1) Feature available only for ST7FLite1, ST7FLite2, ST7FLite3 and ST7DALI devices Note: Take care ...

Page 177

Table 121. LART_Status_Flag Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also 1) Feature available only for ST7FLite1, ST7FLite2, ST7FLite3 and ST7DALI devices. 2) Feature available only on ST7FLite3 device. Note: All ...

Page 178

Function Descriptions Table 122. LART_Clear_Flag Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also 1) Feature available only for ST7FLite1, ST7FLite2, ST7FLite3 and ST7DALI devices. 2) Feature available only on ST7FLite3 device. ...

Page 179

Table 123. LART_ICAPMode Function Name Function Prototype Behaviour Description Input Parameter Output Parameters Required Preconditions Functions called Postconditions See also Note: This function is available only for ST7FLite1, ST7FLite2, ST7FLite3 and ST7DALI de- vices. Table 124. LART_ICAPGetValue Function Name Function ...

Page 180

Function Descriptions Table 125. LART_ConfigureBREAK Function Name Function Prototype Behaviour Description Input Parameter Output Parameters Required Preconditions Functions called Postconditions See also Note: This function is available only for ST7FLite1, ST7FLite2, ST7FLite3 and ST7DALI de- vices. 180/235 LART_ConfigureBREAK Void LART_ConfigureBREAK ...

Page 181

Table 126. LART_ActivateBREAK Function Name Function Prototype Behaviour Description Input Parameter Output Parameters Required Preconditions Functions called Postconditions See also Note: This function is available only for ST7FLite1, ST7FLite2, ST7FLite3 and ST7DALI de- vices. Table 127. LART_DeactivateBREAK Function Name Function ...

Page 182

Function Descriptions Table 128. LART_Counter2Init Function Name Function Prototype Behaviour Description Input Parameter Output Parameters Required Preconditions Functions called Postconditions See also Note: This function is available only for the ST7FLite3 device. Table 129. LART_ReloadATR Function Name Function Prototype Behaviour ...

Page 183

Table 130. LART_LongICAPMode Function Name Function Prototype Behaviour Description Input Parameter Output Parameters Required Preconditions Functions called Postconditions See also Notes: – This function is available only for the ST7FLite3 device. – This function may affect other functions as it ...

Page 184

Function Descriptions Table 131. LART_LongICAPGetValue Function Name Function Prototype Behaviour Description Input Parameter Output Parameters Required Preconditions Functions called Postconditions See also Note: This function is available only for the ST7FLite3 device. Table 132. LART_GenerateDeadTime Function Name Function Prototype Behaviour ...

Page 185

EXAMPLE:The following C program shows the use of the LART functions. Program description: This program generates a PWM signal with a 10KHz frequency and with a 30% Duty cycle and toggles an LED every second (Fcpu=8MHz ). /* Program start ...

Page 186

Function Descriptions void LART_OVF_IT_Routine(void) { unsigned char Temp; LART_Clear_Flag(LART_FLAG_OVF); count++; if(count == 10000) { Temp = IO_Read (IO_PORT_B ); if (Temp & 0x08) { IO_Write (IO_PORT_B,IO_PIN_3,IO_DATA_LOW); } else { IO_Write (IO_PORT_B,IO_PIN_3,IO_DATA_HIGH); } count = 186/235 /* Call ...

Page 187

TBU This software library consists of the following functions for TBU. Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also Table 133. TBU_SetPrescCount8 Function Name Function Prototype Behaviour Description Input Parameter ...

Page 188

Function Descriptions Table 134. TBU_SetPrescCount16 Function Name Function Prototype Behaviour Description Input Parameters Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also Notes: – The actual delay obtained using this function will be approximately equal to the calculated ...

Page 189

Table 135. TBU_Enable Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also Table 136. TBU_ReadCounter Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also ...

Page 190

Function Descriptions Table 138. TBU_ClearOverflow Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also Table 139. TBU_Disable Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions ...

Page 191

TBU_IT_Routine(void); void main(void); void main (void) { unsigned char Counter_Value8 = 224; unsigned int Counter_Value16 = 10330; unsigned char counter; EnableInterrupts /*---------------------------------------------------------------------------- For Stand alone mode -----------------------------------------------------------------------------*/ #ifdef TBU_Standalone TBU_Init (TBU_DEFAULT+TBU_IT_ENABLE); TBU_SetPrescCount8(TBU_Prescvalue_256,Counter_Value8); counter = TBU_ReadCounter(); /*------------------------------------------------------------------------------ For Cascade Mode ...

Page 192

Function Descriptions 9.1.12 WDG Table 140. WDG_Refresh Function Name Function Prototype Behaviour Description Input Parameter Output Parameter Required Preconditions Functions called Postconditions 1) This condition is valid only for Window Watchdog Notes: – This function takes less ROM area but ...

Page 193

Table 141. Watchdog Timeout for some Counter_Data values at fosc2 = 8MHz for ST72F521 device Counter_Data 0x3f to 0x00 0x40 0x50 0x60 0x70 0x7f Table 142. WDG_ComputeTimeout Function Name Function Prototype Behaviour Description Input Parameter Output Parameter Required Preconditions Functions ...

Page 194

Function Descriptions Table 143. WDG_ReadCounter Function Name Function Prototype Behaviour Description Input Parameter Output Parameter Required Preconditions Functions called Postconditions Table 144. WDG_ReadWindow Function Name Function Prototype Behaviour Description Input Parameter Output Parameter Required Preconditions Functions called Postconditions Caution: This ...

Page 195

EXAMPLE: The following C program shows the use of the WDG library functions. Program description: This program generates the watchdog reset for ST72F521 device. The reset timeout period is configured as 34ms with fosc2 = 8MHz, through function WDG_Refresh with ...

Page 196

Function Descriptions 9.1.13 ITC Table 146. ITC_Init Function Name Function Prototype Behaviour Description Input Parameters Output Parameters Required Preconditions Functions called Postconditions See also Table 147. ITC_SetPriority Function Name Function Prototype Behaviour Description Input Parameter 1 196/235 ITC_Init Void ITC_Init ...

Page 197

Input Parameter 1 1) Input Parameter 2 Output Parameter Required Preconditions Functions called Postconditions See also 1) IT_LEVEL_0 can not be written. 2) These Interrupts do not have an Exit from HALT mode capability. Notes: – This function is for ...

Page 198

Function Descriptions – For selecting different priorities for different interrupts you must call the function more than once required to set two or more interrupts to same priority level, then you can pass them together by logically ...

Page 199

Table 149. ITC_GetPriority Function Name Function Prototype Behaviour Description Input Parameter 1 ITC_GetPriority ITC_LEVEL ITC_GetPriority (ITC_IT IT) Returns the software priority level of the selected interrupt. IT_MCC Returns the software priority of MCC interrupt IT_EI0 Returns the software priority of ...

Page 200

Function Descriptions Input Parameter 1 Output Parameter Required Preconditions Functions called Postconditions See also Notes: – This function is for ST72F521,ST72F561,ST72F65,ST72F62,ST72F264, ST72325 and ST7232A devices. – This function is for Nested Interrupts only. Caution: If you select an interrupt which ...

Related keywords