⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 com_baud.lst

📁 ARM入门的好帮手.包含了从简单到相对较复杂的程序.
💻 LST
字号:
##############################################################################
#                                                                            #
# IAR ARM ANSI C/EC++ Compiler V3.10A/W32              05/Nov/2001  14:58:24 #
# Copyright 1999-2001 IAR Systems. All rights reserved.                      #
#                                                                            #
#    Cpu mode     =  arm                                                     #
#    Code model   =  small                                                   #
#    Endian       =  little                                                  #
#    Source file  =  C:\At91\software\projects\bench\Source\com_baud.c       #
#    Command line =  -I C:\Compil\EW23\ARM\INC\ -I ../../..\ -lcN            #
#                    C:\At91\software\projects\bench\IAR\ARM_INT\List\ -la   #
#                    C:\At91\software\projects\bench\IAR\ARM_INT\List\ -o    #
#                    C:\At91\software\projects\bench\IAR\ARM_INT\Obj\ -e     #
#                    -s9 --debug --cpu_mode arm --code_model small --endian  #
#                    little --cpu=arm7tdmi C:\At91\software\projects\bench\S #
#                    ource\com_baud.c                                        #
#    List file    =  C:\At91\software\projects\bench\IAR\ARM_INT\List\com_ba #
#                    ud.lst                                                  #
#    Object file  =  C:\At91\software\projects\bench\IAR\ARM_INT\Obj\com_bau #
#                    d.r79                                                   #
#                                                                            #
#                                                                            #
##############################################################################

C:\At91\software\projects\bench\Source\com_baud.c
      1          //*----------------------------------------------------------------------------
      2          //*      ATMEL Microcontroller Software Support  -  ROUSSET  -
      3          //*----------------------------------------------------------------------------
      4          //* The software is delivered "AS IS" without warranty or condition of any
      5          //* kind, either express, implied or statutory. This includes without
      6          //* limitation any warranty or condition with respect to merchantability or
      7          //* fitness for any particular purpose, or against the infringements of
      8          //* intellectual property rights of others.
      9          //*----------------------------------------------------------------------------
     10          //* File Name           : com_baud.c
     11          //* Object              : Baud rate compute com port terminal
     12          //*
     13          //* 1.0 25/08/00 JPP    : Creation
     14          //* 1.0 03/09/01 JPP    : Change com directory
     15          //*----------------------------------------------------------------------------
     16          
     17          #include "com.h"
     18          
     19          //*----------------------------------------------------------------------------
     20          //* Function Name       : at91_baud_com
     21          //* Object              : Compute the baud rate
     22          //* Input Parameters    : <mcki> external mcki if use in usart US_CLKS_MCK8 you
     23          //*                              must be divided mcki by 8
     24          //*                       <baud> use standart baud rate 4800,9600,19200,...
     25          //* Output Parameters   : Usart CD baud value
     26          //*----------------------------------------------------------------------------
     27          u_short at91_baud_com( u_int mcki, u_int baud)
     28          //* Begin
     29          {
     30              u_short cd;
     31              u_int   user_baud;
     32          
     33              //* baud rate calculation
     34              user_baud = ((mcki*10)/(baud*16));
     35              //*
     36              cd  = user_baud/10;
     37              //* compute the error
     38              user_baud = (user_baud - (cd *10));
     39              //* aproximation
     40              if (user_baud >= 5) cd++;
     41              // return the CD value for the Usart
     42              return cd;
     43          }
     44          //* End
     45          //*----------------------------------------------------------------------------
     46          //* Function Name       : at91_error_baud_com
     47          //* Object              : Compute the baud rate
     48          //* Input Parameters    : <mcki> external mcki if use in usart US_CLKS_MCK8 you
     49          //*                              must be divided mcki by 8
     50          //*                       <baud> use standart baud rate 4800,9600,19200,...
     51          //* Output Parameters   : baud error rate in % (sup average)
     52          //*----------------------------------------------------------------------------
     53          u_short at91_error_baud_com( u_int mcki, u_int baud)
     54          //* Begin
     55          {
     56              u_short cd;
     57              u_int usart_baud;
     58              //* Calculate the User cd
     59              cd = at91_baud_com(mcki, baud);
     60          
     61              //* compute the real baud rate
     62              usart_baud = (mcki/(cd*16));
     63          
     64              //* compute error
     65              if (usart_baud < (baud))
     66               cd =  100 - ((usart_baud*100)/baud);
     67              else
     68               cd =  100- ((baud*100)/usart_baud) ;
     69          
     70              // return the error value for the Usart
     71              return  cd;
     72          }
     73          //* End

   Maximum stack usage in bytes:

     Function             CSTACK
     --------             ------
     at91_baud_com            8 
     at91_error_baud_com     16 

 
 216 bytes in segment NEARFUNC_A
 
 216 bytes of CODE memory

Errors: none
Warnings: none

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -