led.c

来自「Example codes for ADuC842 CPU family」· C语言 代码 · 共 63 行

C
63
字号
//#include <ADuC842.h>
#include <stdio.h>
#include <rs_usb.h>


sbit TEM = P2^0;
sbit ADXL_Y = P1^4;

unsigned char napis[22] = " Spuki jest debe渃iak ";


signed int i=0;
signed int s_data=0;
unsigned char c=0;


void delay(unsigned int length) { 
	while (length!=0) {
		i = ReadByte();
		if (i>=0) c = i&0xFF;
		length--;
	}
}


//void delayms(unsigned char length) { while (length!=0) length--; }
/*
void Timer2_Int () interrupt 5
{
	LED = !LED;
	TF2 = 0;
}
*/


void main (void)
{	
	DelayUs(0x01); DelayUs2();
	TxD_USB = 1; // Wysoki stan na linii nadawczej
	P1 = 11101111; // Port P1.4 jako Analog Input;
	PLLCON = 0x01; //PLL Clock config

	//Timer2 config
//    ET2 = 1;
//   	TH2 = 0x00;	TL2 = 0x00; 
//	RCAP2H = 0xF0; RCAP2L = 0x00;
    EA = 0;
//	T2CON = 0x04;
 	napis[0] = 0xFF;
	napis[21] = 0x00;

	while(1) {
		s_data = c;
		SendByte(s_data >> 8);
		SendByte(c);
		SendByte(P0);
		SendByte(P1);
		SendByte(P2);
		SendByte(P3);
		delay(0x03FF);
	}
}

⌨️ 快捷键说明

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