var3.c

来自「Cypress公司Cy7c6xxxx芯片的USB键盘及USB鼠标的firmwar」· C语言 代码 · 共 88 行

C
88
字号
#pragma option f0 /* remove page breaks from listing file */
/* 
 * CYC Code Development System
 * Tutorial Example
 * VAR3.C
 * This code may be adapted for any purpose
 * when used with the CYC Code Development
 * System.  No warranty is implied or given
 * as to their usability for any purpose.
 * 
 * (c) Copyright 2000 Byte Craft Limited
 * 421 King St.N., Waterloo, ON, Canada, N2J 4E4
 * VOICE: 1 (519) 888 6911
 * FAX  : 1 (519) 746 6751
 * email: support@bytecraft.com
 * 
 * REVISION HISTORY
 * v1.00 AL 01/2000 Initial Version.
 */
#include <dev\c63413.h>
                                                        
                                                                /* figure_e */
int global_variable;

void main_loop_function(void)
{
        int i,j,k;

}

void isr_function(void)
{
        int l,m,n; /* the compiler is careful not to share local memory
                      with functions called from the main loop */

}

void GPIO_ISR(void)
{

        int var_in_interrupt; /* variables declared in the ISR are 
                                 automatically made static */

        isr_function();
        var_in_interrupt++;

}
                                                                /* figure_e */

                                                                /* figure_d */
void function1(void)
{
        int a,b,c; /* memory is not shared with function1() and function 2() */
}

void function2(void)
{
        int a,b,c; /* these locals occupy the same memory as the local variables
                      in function3() */
        function1();
}

void function3(void)
{
        int a,b,c;
}
                                                                /* figure_d */

void function4(char a,b,c) /* local memory is used to pass variables to
                              a function */
{
}

void main(void)
{
        int a,b,c;

        function1();
        function2();
        function3();
                                                                /* figure_f */
        function4(1,2,3); /* parameters for function4 are loaded before the call */

                                                                /* figure_f */
        main_loop_function();
        while(1);
}

⌨️ 快捷键说明

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