www.pudn.com > 2-STM.rar > 2-STM.rtf, change:2011-09-09,size:14628b


{\rtf1\ansi\deff0\deftab720{\fonttbl{\f0\fnil MS Sans Serif;}{\f1\fnil\fcharset2 Symbol;}{\f2\fswiss\fprq2 System;}{\f3\fnil Times New Roman;}{\f4\fswiss\fprq2 Arial;}} 
{\colortbl\red0\green0\blue0;\red0\green0\blue128;\red255\green0\blue0;} 
\deflang1031\pard\plain\f4\fs28\cf0 DAvE's Project Documentation 
\par \plain\f4\fs22\cf0 
\par \plain\f4\fs22\cf0 Project: \tab\tab\b 2-STM.dav 
\par  
\par \plain\f4\fs22\cf0 Controller: \tab\tab\b TC1797 
\par \plain\f4\fs22\cf0 Compiler: \tab\tab\b Tasking 3.1 
\par  
\par \plain\f4\fs22\cf0 Date: \tab\tab\tab\b 2011-09-09 13:58:07 
\par  
\par  
\par \plain\f4\fs22\cf2\b Please read this document carefully and note 
\par \plain\f4\fs22\cf2\b the red-colored hints. 
\par  
\par \plain\f4\fs22\cf2\b If you miss a file in the generated files list 
\par \plain\f4\fs22\cf2\b maybe you have forgotten to select the 
\par \plain\f4\fs22\cf2\b initialisation function of the related module. 
\par  
\par \plain\f4\fs22\cf0 Generated Files: 
\plain\f4\fs20\cf0\b 
\par \tab\tab\tab TC1797REGS.H 
\par \tab\tab\tab MAIN.H 
\par \tab\tab\tab MAIN.C 
\par \tab\tab\tab IO.H 
\par \tab\tab\tab IO.C 
\par \tab\tab\tab STM.H 
\par \tab\tab\tab STM.C 
\par  
\par  
\par \plain\f4\fs20\cf0 
\par \plain\f4\fs28\cf0\ul Project Settings 
\par 
\par \plain\f4\fs24\cf0 Macros:\f4\fs20\cf0 
\par 
\par 
\par \plain\f4\fs20\cf0 \tab Macro: 
\par \plain\f4\fs20\cf0\b \tab \tab MAIN_vSetENDINIT()\plain\f4\fs20\cf0 
\par \tab Description: 
\par \plain\f4\fs20\cf0\i 
\tab \tab This macro sets the EndInit bit, which controls access to 
 
\par \tab \tab system critical registers. Setting the EndInit bit locks 
 
\par \tab \tab all EndInit protected registers. 
 
\par \plain\f4\fs20\cf0 \tab Returnvalue: 
\par \tab \tab \plain\f4\fs20\cf0\b None\plain\f4\fs20\cf0 
\par \plain\f4\fs20\cf0 \tab Parameters: 
\par \plain\f4\fs20\cf0\b  
\tab \tab None 
 
\par 
\par 
\par \plain\f4\fs20\cf0 \tab Macro: 
\par \plain\f4\fs20\cf0\b \tab \tab MAIN_vResetENDINIT()\plain\f4\fs20\cf0 
\par \tab Description: 
\par \plain\f4\fs20\cf0\i 
\tab \tab This macro clears the EndInit bit, which controls access to 
 
\par \tab \tab system critical registers. Clearing the EndInit bit unlocks 
 
\par \tab \tab all EndInit protected registers. Modifications of the 
 
\par \tab \tab EndInit bit are monitored by the watchdog timer such that 
 
\par \tab \tab after clearing EndInit, the watchdog timer enters a defined 
 
\par \tab \tab time-out mode; EndInit must be set again before the 
 
\par \tab \tab time-out expires. 
 
\par \plain\f4\fs20\cf0 \tab Returnvalue: 
\par \tab \tab \plain\f4\fs20\cf0\b None\plain\f4\fs20\cf0 
\par \plain\f4\fs20\cf0 \tab Parameters: 
\par \plain\f4\fs20\cf0\b  
\tab \tab None 
 
\par \plain\f4\fs24\cf0 Functions:\f4\fs20\cf0 
\par 
\par \plain\f4\fs20\cf0 \tab Function: 
\par \plain\f4\fs20\cf0\b \tab \tab void MAIN_vInit(void)\plain\f4\fs20\cf0 
\par \tab Description: 
\par \plain\f4\fs20\cf0\i 
\tab \tab This function initializes the microcontroller. 
 
\par \plain\f4\fs20\cf0 \tab Returnvalue: 
\par \tab \tab \plain\f4\fs20\cf0\b None\plain\f4\fs20\cf0 
\par \plain\f4\fs20\cf0 \tab Parameters: 
\par \plain\f4\fs20\cf0\b  
\tab \tab None 
 
\par 
\par \plain\f4\fs20\cf0 \tab Function: 
\par \plain\f4\fs20\cf0\b \tab \tab void MAIN_vWriteWDTCON0(uword uwValue)\plain\f4\fs20\cf0 
\par \tab Description: 
\par \plain\f4\fs20\cf0\i 
\tab \tab This function writes the parameter uwValue to the WDT_CON0 
 
\par \tab \tab register which is password protected. 
 
\par \plain\f4\fs20\cf0 \tab Returnvalue: 
\par \tab \tab \plain\f4\fs20\cf0\b None\plain\f4\fs20\cf0 
\par \plain\f4\fs20\cf0 \tab Parameters: 
\par \plain\f4\fs20\cf0\b  
\tab \tab uwValue: 
 
\par \tab \tab Value for the WDTCON0 register 
 
\par 
\par \plain\f4\fs20\cf0 \tab Function: 
\par \plain\f4\fs20\cf0\b \tab \tab sword main(void)\plain\f4\fs20\cf0 
\par \tab Description: 
\par \plain\f4\fs20\cf0\i 
\tab \tab This is the main function. 
 
\par \plain\f4\fs20\cf0 \tab Returnvalue: 
\par \tab \tab \plain\f4\fs20\cf0\b Returns an sword value\plain\f4\fs20\cf0 
\par \plain\f4\fs20\cf0 \tab Parameters: 
\par \plain\f4\fs20\cf0\b  
\tab \tab None 
 
\par 
\par \plain\f4\fs24\cf0 Initialization: 
\par \plain\f4\fs20\cf0\b 
\par 
\tab \cf2Begin of Important Settings for the Start-Up File\cf0\par  
\tab All following settings must be set in the start-up file. You can use\par  
\tab DAvE's project file (*.dpt) to include this register values into your\par  
\tab compiler EDE.\par  
\par  
\tab System Peripheral Bus Control Unit (SBCU):\par  
\tab SBCU starvation protection is enabled\par  
\tab the debug trace is enabled. Error information is captured in\par  
\tab register SBCU_EADD, SBCU_EDAT and SBCU_ECON\par  
\tab sample period of request for starvation protection: 64\par  
\tab SBCU bus time-out value: 65536 cycles\par  
\par  
\tab \cf2this register must be set in the start-up file\cf0\par  
\tab \cf2SBCU_CON  =  0x4009FFFF;\cf0\par  
\par  
\tab LMB External Bus Unit (EBU):\par  
\tab - enable the EBU module clock\par  
\tab - disable EndInit Protection of the CLC Register\par  
\tab - request EBU to run off input clock divided by 1\par  
\par  
\tab \cf2this register must be set in the start-up file\cf0\par  
\tab \cf2EBU_CLC  =  0x00010000;\cf0\par  
\par  
\tab External Arbitration:\par  
\tab - EBU is disabled\par  
\par  
\tab \cf2this register must be set in the start-up file\cf0\par  
\tab \cf2EBU_MODCON  =  0x00000000;\cf0\par  
\par  
\tab Data Memory Interface (DMI):\par  
\tab - No Data Cache\par  
\tab - 128 Kbyte Data Memory\par  
\par  
\tab \cf2this register must be set in the start-up file\cf0\par  
\tab \cf2DMI_CON  =  0x08000802;\cf0\par  
\par  
\tab Program Memory Interface (PMI):\par  
\tab - No Instruction Cache\par  
\tab - 40 Kbyte Program Memory\par  
\par  
\tab \cf2this register must be set in the start-up file\cf0\par  
\tab \cf2PMI_CON2  =  0x02800284;\cf0\par  
\par  
\tab \cf2End of Important Settings for the Start-Up File\cf0\par  
\par  
\tab Clock System:\par  
\tab - external clock frequency: 20.00 MHz\par  
\tab - input divider (PDIV): 2\par  
\tab - PLL operation (VCOBYP = 0)\par  
\tab - VCO range: 700 MHz - 800 MHz\par  
\tab - feedback divider (NDIV): 72\par  
\tab - the VCO output frequency is: 720.00 MHz\par  
\tab - output divider (KDIV): 4\par  
\tab - CPU clock: 180.00 MHz\par  
\tab - the ratio fcpu /ffpi is  2 / 1\par  
\tab - the ratio fcpu /flmb is  1 / 1\par  
\tab - the ratio fcpu /fpcp is  1 / 1\par  
\tab - system clock: 90.00 MHz\par  
\par  
\tab Interrupt System:\par  
\tab - four arbitration cycles (max. 255 interrupt sources)\par  
\tab - two clocks per arbitration cycle\par  
\par  
\tab Peripheral Control Processor (PCP):\par  
\tab - stop the PCP internal clock when PCP is idle\par  
\par  
\tab - use Full Context save area (R[0] - R[7])\par  
\tab - start progam counter as left by last invocation\par  
\tab - channel watchdog is disabled\par  
\tab - maximum channel number checking is disabled\par  
\par  
\tab - four arbitration cycles (max. 255 PCP channels)\par  
\tab - two clocks per arbitration cycle\par  
\par  
\tab - the PCP warning mechanism is disabled\par  
\par  
\tab - type of service of PCP node 4 is CPU interrupt\par  
\par  
\tab - type of service of PCP node 5 is CPU interrupt\par  
\par  
\tab - type of service of PCP node 6 is CPU interrupt\par  
\par  
\tab - type of service of PCP node 7 is CPU interrupt\par  
\par  
\tab - type of service of PCP node 8 is CPU interrupt\par  
\par  
\tab Configuration of the DMA Module Clock:\par  
\tab - enable the DMA module\par  
\par  
\tab System Start Conditions:\par  
\par  
\tab - the CPU interrupt system is globally enabled\par  
\par  
\tab \cf2- the PCP interrupt system is globally disabled\cf0\par  
\par  
 
\par \plain\f4\fs20\cf0 
\par \plain\f4\fs28\cf0\ul Parallel Ports 
\par 
\par \plain\f4\fs24\cf0 Macros:\f4\fs20\cf0 
\par 
\par 
\par \plain\f4\fs20\cf0 \tab Macro: 
\par \plain\f4\fs20\cf0\b \tab \tab IO_vTogglePin(PinName)\plain\f4\fs20\cf0 
\par \tab Description: 
\par \plain\f4\fs20\cf0\i 
\tab \tab This marco toggles the chosen portpin. 
 
\par \tab \tab Note: 
 
\par \tab \tab See the 'Defines for the parameter PinName' section in this 
 
\par \tab \tab header file for the available definitions for the parameter 
 
\par \tab \tab PinName. 
 
\par \plain\f4\fs20\cf0 \tab Returnvalue: 
\par \tab \tab \plain\f4\fs20\cf0\b None\plain\f4\fs20\cf0 
\par \plain\f4\fs20\cf0 \tab Parameters: 
\par \plain\f4\fs20\cf0\b  
\tab \tab PinName: 
 
\par \tab \tab Pin to be toggled 
 
\par \plain\f4\fs24\cf0 Functions:\f4\fs20\cf0 
\par 
\par \plain\f4\fs20\cf0 \tab Function: 
\par \plain\f4\fs20\cf0\b \tab \tab void IO_vInit(void)\plain\f4\fs20\cf0 
\par \tab Description: 
\par \plain\f4\fs20\cf0\i 
\tab \tab This is the initialization function of the IO function 
 
\par \tab \tab library. It is assumed that the SFRs used by this library 
 
\par \tab \tab are in their reset state. 
 
\par \tab \tab Note: 
 
\par \tab \tab Alternate outputs are set in their own initialization 
 
\par \tab \tab function. 
 
\par \plain\f4\fs20\cf0 \tab Returnvalue: 
\par \tab \tab \plain\f4\fs20\cf0\b None\plain\f4\fs20\cf0 
\par \plain\f4\fs20\cf0 \tab Parameters: 
\par \plain\f4\fs20\cf0\b  
\tab \tab None 
 
\par 
\par \plain\f4\fs24\cf0 Initialization: 
\par \plain\f4\fs20\cf0\b 
\par 
\tab Configuration of Port P0:\par  
\tab - no pin of port P0 is used\par  
\par  
\tab Configuration of Port P1:\par  
\tab - no pin of port P1 is used\par  
\par  
\tab Configuration of Port P2:\par  
\tab - no pin of port P2 is used\par  
\par  
\tab Configuration of Port P3:\par  
\tab P3.0:\par  
\tab - is used as general purpose output\par  
\tab - push/pull output is selected\par  
\tab - the pin status is low level\par  
\tab - output driver characteristic: medium driver\par  
\par  
\tab Configuration of Port P4:\par  
\tab - no pin of port P4 is used\par  
\par  
\tab Configuration of Port P5:\par  
\tab - no pin of port P5 is used\par  
\par  
\tab Configuration of Port P6:\par  
\tab - no pin of port P6 is used\par  
\par  
\tab Configuration of Port P7:\par  
\tab - no pin of port P7 is used\par  
\par  
\tab Configuration of Port P8:\par  
\tab - no pin of port P8 is used\par  
\par  
\tab Configuration of Port P9:\par  
\tab - no pin of port P9 is used\par  
\par  
\tab Configuration of Port P10:\par  
\tab - no pin of port P10 is used\par  
\par  
\tab Configuration of Port P11:\par  
\tab - no pin of port P11 is used\par  
\par  
\tab Configuration of Port P12:\par  
\tab - no pin of port P12 is used\par  
\par  
\tab Configuration of Port P13:\par  
\tab - no pin of port P13 is used\par  
\par  
\tab Configuration of Port P14:\par  
\tab - no pin of port P14 is used\par  
\par  
\tab Configuration of Port P15:\par  
\tab - no pin of port P15 is used\par  
\par  
\tab Configuration of Port P16:\par  
\tab - no pin of port P16 is used\par  
\par  
 
\par \plain\f4\fs20\cf0 
\par \plain\f4\fs28\cf0\ul System Timer (STM) 
\par 
\par \plain\f4\fs24\cf0 Macros:\f4\fs20\cf0 
\par \plain\f4\fs24\cf0 Functions:\f4\fs20\cf0 
\par 
\par \plain\f4\fs20\cf0 \tab Function: 
\par \plain\f4\fs20\cf0\b \tab \tab void STM_vInit(void)\plain\f4\fs20\cf0 
\par \tab Description: 
\par \plain\f4\fs20\cf0\i 
\tab \tab This is the initialization function of the STM function 
 
\par \tab \tab library. It is assumed that the SFRs used by this library 
 
\par \tab \tab are in their reset state. 
 
\par \plain\f4\fs20\cf0 \tab Returnvalue: 
\par \tab \tab \plain\f4\fs20\cf0\b None\plain\f4\fs20\cf0 
\par \plain\f4\fs20\cf0 \tab Parameters: 
\par \plain\f4\fs20\cf0\b  
\tab \tab None 
 
\par 
\par \plain\f4\fs20\cf0 \tab Function: 
\par \plain\f4\fs20\cf0\b \tab \tab void STM_viSRN0(void)\plain\f4\fs20\cf0 
\par \tab Description: 
\par \plain\f4\fs20\cf0\i 
\tab \tab This is the interrupt service routine 0 of STM. It is 
 
\par \tab \tab called if the selected compare match is pending. 
 
\par \tab \tab Please note that you have to add application specific code 
 
\par \tab \tab to this function. 
 
\par \plain\f4\fs20\cf0 \tab Returnvalue: 
\par \tab \tab \plain\f4\fs20\cf0\b None\plain\f4\fs20\cf0 
\par \plain\f4\fs20\cf0 \tab Parameters: 
\par \plain\f4\fs20\cf0\b  
\tab \tab None 
 
\par 
\par \plain\f4\fs24\cf0 Initialization: 
\par \plain\f4\fs20\cf0\b 
\par 
\tab Configuration of the Module Clock:\par  
\tab - enable the STM module\par  
\tab - Application Reset resets the STM module\par  
\tab - STM clock is System clock / 1 (= 90.00 MHz; 11.11 ns )\par  
\par  
\tab STM Resolution And Range:\par  
\tab STM_TIMER_0     bits 0 ... 31 :\par  
\tab - resolution = 0.01 us\par  
\tab - range = 47.72 s\par  
\par  
\tab STM_TIMER_1     bits 4 ... 35 :\par  
\tab - resolution = 0.18 us\par  
\tab - range = 12.73 min\par  
\par  
\tab STM_TIMER_2     bits 8 ... 39 :\par  
\tab - resolution = 2.84 us\par  
\tab - range = 3.39 h\par  
\par  
\tab STM_TIMER_3     bits 12 ... 43 :\par  
\tab - resolution = 45.51 us\par  
\tab - range = 2.26 days\par  
\par  
\tab STM_TIMER_4     bits 16 ... 47 :\par  
\tab - resolution = 728.18 us\par  
\tab - range = 36.20 days\par  
\par  
\tab STM_TIMER_5     bits 20 ... 51 :\par  
\tab - resolution = 11.65 ms\par  
\tab - range = 1.59 years\par  
\par  
\tab STM_TIMER_6     bits 32 ... 55 :\par  
\tab - resolution = 47.72 s\par  
\tab - range = 25.39 years\par  
\par  
\tab STM_TIMER_7     bits 32 ... 55 :\par  
\tab - resolution = 47.72 s\par  
\tab - range = 25.39 years\par  
\par  
\tab STM Compare 0 configuration:\par  
\tab - lowest bit number of STM which is compared with CMP0 is 0\par  
\tab - 28 bit(s) in register CMP0 are used for the compare operation with\par  
\tab STM\par  
\tab - required compare value of CMP0 is 0x05F5E100\par  
\tab - real compare value of CMP0 is 0x05F5E100\par  
\tab - request on compare match with CMP0 is enabled and located to STMIR0\par  
\par  
\tab STM Compare 1 configuration:\par  
\tab - lowest bit number of STM which is compared with CMP1 is 0\par  
\tab - 1 bit(s) in register CMP1 are used for the compare operation with STM\par  
\tab - required compare value of CMP1 is 0x00000000\par  
\tab - real compare value of CMP1 is 0x00000000\par  
\tab - request on compare match with CMP1 is not enabled\par  
\par  
\tab Configuration of the used STM Interrupts:\par  
\tab - SRN0 service request node configuration:\par  
\tab - SRN0 interrupt priority level (SRPN) = 2\par  
\tab - SRN0 CPU interrupt is selected\par  
\par  
 
}