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

📄 math.c

📁 cypress 的PSOC DESIGNER 4.4如何在C语言中调用汇编程序.
💻 C
字号:
#include <..\math.h>		//Place the include file here. '..\. used to locate the math.h

//We need to tell the compiler that we are going to use some variables outside
//this file. We use the 'extern' keyword. The format for using extern is:
//  extern <type> RamLocation   
// extern - Keyword to tell the compiler the location is outside this module
// <type> - Type is the C declaration (char,int) of the ram location - default is int
// 			Ex. Var  blk  1 equates to char
//			    Var	 blk  2 equates to int
//				Var  blk  4 equates to long
// RamLocation - This is the name of the ram location with the _ we declared in main.asm

extern int   OperandOne;		//Notice we dont have the _ we just need it on the export
extern int   OperandTwo;
extern long  OperandThree;
extern long  Result;

//Here we declare our C Function. We do not use the _ even though we call it using
//the _
void Addition()
{
	//In this function we will add the two numbers in OperandOne and OperandTwo
	//We will place the location in Result

	Result = OperandTwo + OperandOne;

}

void Multiplication()
{
	
	//Lets perform a larger calculation that might be a little tougher in
	//assembly
	Result = OperandThree * OperandOne;

}

⌨️ 快捷键说明

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