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

📄 utile.c

📁 第三届飞思卡尔智能车竞赛华东赛一等奖的程序
💻 C
字号:
#include <mc9s12dg128.h>     /* derivative information */
#pragma LINK_INFO DERIVATIVE "mc9s12dg128b"

char inch() //input a char via the SCI
{
	asm
	{
		BRCLR $00cc,#$20,*
	}
	return SCI0DRL;
}

void outch(char ch) //output a char
{
	asm
	{
		BRCLR $00cc,#$80,*
	}
	SCI0DRL=ch;
}

void main_exit(void)  //jump out to the monitor program
{
	_asm JSR $0fe80
}


void print_int(int n) //print a integer via the SCI
{
	char bits,ch[5];
	if(n==0)
	{
	  outch('0');
	  return;
	}
	bits=0;
	if(n<0)
	{
		outch('-');
		n=-n;
	}
	while(n>0)
	{
		ch[bits]=n%10+'0';
		n/=10;
		bits++;
	}
	bits--;
	while(bits>=0)
	{
		outch(ch[bits]);
		bits--;
	}
}

void print_string(char s[])
{
  for(;*s!='\0';s++) outch(*s);
}

⌨️ 快捷键说明

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