HT66FU50 유수등 프로그램

895 단어
요즘은 합태 단편기를 잘 만들어야 한다.
#include "HT66FU50.h"

#define LED_PORT _pa
#define LED_PORTC _pac

void init(void)
{
	_tmpc0 = 0;			//    TM     ,     I/O      
	_tmpc1 = 0;
	_acerl = 0;			//  PA 8    AD    
	_cp0c = 0;			//  A0 A2 A3 A5       
	_cp1c = 0;
	LED_PORT = 0xff;		//0b11111111;	//  pa              
	LED_PORTC = 0x00;		//0b00000000;	//  pa        0     1    	
}

/*nms  */
void delaynms(unsigned int t)
{
	while (t > 0) { 
		_delay(1000);	//1ms
		t--;
	}
}

int main()
{
	unsigned char i;
	unsigned int j;
	
	init(); 
	
	while(1) {
		
		//    
		for (i=0; i<8; i++) {
			LED_PORT = 0x01<<i;
			delaynms(1000);
		}
		
		//    
		for (i=0; i<8; i++) {
			LED_PORT = 0x80>>i;
			delaynms(1000);	
		}
	} 
	
	return 0;
}

좋은 웹페이지 즐겨찾기