예제 #1
0
int Xbee_init() {
    uint8_t garbage;
    int ret;
    //init the serial link
#ifdef ARCH_X86_LINUX
    ret=UART_init(XBEE_UART_PATH,E_115200_8N2);
#elif defined(ARCH_328P_ARDUINO)
    Xbee_rst();
    ret=UART_init(NULL,111111);
#elif defined(ARCH_LM4FXX)
    Xbee_rst();
    ret=UART_init(NULL,111111);
#else
#error "no arch defined for Xbee4sb.c, or arch no available (yet)"
#endif
    if (ret<0) return ret;

    //waits for the Xbee to totally start
    uint32_t sw=0;
    while( testTimeout(10000000,&sw));

    //clear in buffer from remaining bytes
    while ( serialReadEscaped(&garbage,1000)>0 );
    return 0;
}
예제 #2
0
int main(void) {
    unsigned char s[80];
	int n;
	
		
    UART_init();	// in UART.c
	sei(); 			// Global interrupt enable
	
	//fdevopen( UART_fputc, UART_fgetc );			// establish buffered I/O callbacks

	for(;;) {
		// this demos the small memory function set. See below for FILE buffered version.
		UART_puts_P(PSTR("Enter text\r\n"));
		n = UART_gets(s, sizeof(s)-2);
		s[strlen(s)-1] = 0;	// drop the ending \r
		UART_puts_P(PSTR("You entered '"));
		UART_puts(s);
		UART_puts_P(PSTR("' length="));
		UART_puts(itoa(n, s, 10));
		UART_puts_P(PSTR("\n\r"));
		
		// uncomment this to use the buffered I/O (memory hog). 
		//   and fdevopen(), above too.
		
		/* Same function as printf() but the format string resides in flash */
		//printf_P(PSTR("Enter text\r\n"));
		//fgets(s, sizeof(s)-1, stdin);
		//s[strlen(s)-2] = 0;	// drop the ending \r\n
		//printf_P(PSTR("\r\nYou entered '%s'\r\n"),s);
	}
}
예제 #3
0
파일: full.c 프로젝트: rimek/aquarium
int main(void)
{             
  char c;			// odebrany znak
  UART_init();			// inicjalizacja portu szeregowego
  LCD_init();			// inicjalizacja wy�wietlacza LCD
  LCD_PL_chars_init();		// polskie znaki na wy�wietlaczu LCD
  KBD_init();			// inicjalizacja klawiatury
  LED7SEG_init();		// inicjalizacja wy�wietlacza
  sei();                       	// w��cz obs�ug� przerwa�

  while(1)			// p�tla niesko�czona
  {
    PCF8583_get_time(&godz,&min,&sek,&ssek);

    LED7SEG_putU08(sek);	// wy�wietlaj warto�� 

    if (UART_rxlen()>0)	// je�li odebrano znak
    {
      c=UART_getchar();
    	// tu mo�na wstawi� reakcje na komendy steruj�ce np. typu ESC[
      LCD_putchar(c);		// wy�wietl go na LCD
    }
    if (KBD_read())		// je�li naci�ni�to klawisz
    {
      if ((KBD_ascii>='A')&&(KBD_ascii<='D'))
        UART_putstr_P(CURSOR);	// sterowanie kursorem
      UART_putchar(KBD_ascii);	// wy�lij go na port szeregowy
      KBD_wait();		// czekaj na zwolnienie klawisza
    }
  }
}
예제 #4
0
int main(void)
{
    uint16_t adc_result;
	int i;
	char value[10];
	sbi(DDRB, 4);
	sbi(DDRC, 5);
	cbi(PORTB,4);
	sbi(PORTC,5);	
    UART_init(250000);
	InitADC();
	sei();
	
	
	
	while(1)
	{
	adc_result=ReadADC(2);           // Read Analog value from channel-2
    // Voltage = adc_result*5/1024
	// Temperature = (V  -  1035 mV)/(-5.5 (mV/oC))
	itoa(adc_result,value,10);
	for(i=0;i<=2;i++){
	UART_TxChar(value[i]);}
	UART_TxStr("\n\r\0");
	PORTB ^= (1<<PB4);	
	_delay_ms(100);
	}
	
}
예제 #5
0
파일: main.c 프로젝트: roland-wilhelm/iot
int main(void)
{
 	int SYSm;

    /* Initialise MPU, I/O and SysTick */
    SCS_init();
    UART_init();
    SysTick_init();

    /* Finally change Thread mode to unprivileged
     * but continue using Main Stack Pointer */
    SYSm = __MRS_control();
    SYSm |= 1;
    __MSR_control(SYSm);

    /* Flush and refill pipline with unprivileged permissions */
    __ISB();

    printf("Cortex-M3 Example - Build 3\n");

    /* Loop forever */
    while( 1 )
    {
        Display_80((char*) ".");
    }
}
예제 #6
0
/**
 * /fn SetupUartTask
 * /brief Setup UART tasks.
 *
 * Task has priority 15 and receives 1kB of stack.
 *
 * /return Always 0. In case of error the system halts.
 */
int SetupUartTask(void) {
	Task_Params taskTransferParams;
	Task_Handle taskTransfer;
	Error_Block eb;

	/* Enable and configure the peripherals used by the UART7 */
	SysCtlPeripheralEnable(GPIO_PORTC_BASE);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_UART7);
	GPIOPinConfigure(GPIO_PC4_U7RX);
	GPIOPinConfigure(GPIO_PC5_U7TX);
	GPIOPinTypeUART(GPIO_PORTC_BASE, GPIO_PIN_4 | GPIO_PIN_5);

	/* Enable and configure the peripherals used by the UART6 */
	SysCtlPeripheralEnable(GPIO_PORTP_BASE);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_UART6);
	GPIOPinConfigure(GPIO_PP0_U6RX);
	GPIOPinConfigure(GPIO_PP1_U6TX);
	GPIOPinTypeUART(GPIO_PORTP_BASE, GPIO_PIN_0 | GPIO_PIN_1);

	UART_init();

	InitializeLedUserSwitch();

	Error_init(&eb);
	Task_Params_init(&taskTransferParams);
	taskTransferParams.stackSize = 1024;
	taskTransferParams.priority = 15;
	taskTransfer = Task_create((Task_FuncPtr) TransferFunction,
			&taskTransferParams, &eb);
	if (taskTransfer == NULL) {
		System_abort("UART task create failed");
	}

	return (0);
}
예제 #7
0
파일: Uart.c 프로젝트: sdajani/sdp
int main(void)
{

    Board_init();
    UART_init(UART2_ID,9600);
    printf("\r\nUno Serial Test Harness\r\nAfter this Message the terminal should mirror anything you type.\r\n");
    unsigned char ch = 0;
    int x;
    while (1) {
        if (UART_isTransmitEmpty(UART1_ID) == TRUE){
            if (UART_isReceiveEmpty(UART1_ID) == FALSE){
                ch = UART_getChar(UART1_ID);
                UART_putChar(UART1_ID, ch);
                printf("  Through UART2: ");
                UART_putChar(UART2_ID, ch);
                x = 1024;
                while(--x){
                    if(UART_isReceiveEmpty(UART2_ID) ==FALSE)
                        break;
                }
                if(UART_isReceiveEmpty(UART2_ID) == FALSE){
                    printf("%c\n", UART_getChar(UART2_ID));
                } else{
                    printf("FAILED\n");
                }
                //DELAY(1000)
            }
        }
    }
    return 0;
}
예제 #8
0
파일: Functions.c 프로젝트: OfnyaHoo/EV15
void Setup(void) {

    PinSetMode();
    // setup internal clock for 72MHz/36MIPS
    // 12 /2 = 6  *24 = 144 / 2=72
    CLKDIVbits.PLLPRE = 0; // PLLPRE (N2) 0=/2c
    CLKDIVbits.DOZE = 0;
    PLLFBD = 22; // pll multiplier (M) = +2
    CLKDIVbits.PLLPOST = 0; // PLLPOST (N1) 0=/2   
    // Initiate Clock Switch to Primary Oscillator with PLL (NOSC = 0b011)
    __builtin_write_OSCCONH(0x03);
    __builtin_write_OSCCONL(OSCCON | 0x01);
    // Wait for Clock switch to occur
    while (OSCCONbits.COSC != 0b011);
    while (!OSCCONbits.LOCK); // wait for PLL ready


    INTCON1bits.NSTDIS = 1; //no nesting of interrupts
    timerOne();
    initADC();
    //timerTwo();
    begin(receiveArray, sizeof (receiveArray), SAS_ADDRESS, false, Send_put, Receive_get, Receive_available, Receive_peek);
    UART_init();
    //UART1_init();
    //begin(receiveArray1, sizeof (receiveArray1), SAS_ADDRESS, false, Send_put1, Receive_get1, Receive_available1, Receive_peek1);

}
예제 #9
0
void main (void)
{
    //Stop WDT
    WDT_hold(__MSP430_BASEADDRESS_WDT_A__);

    //P3.4,5 = USCI_A0 TXD/RXD
    GPIO_setAsPeripheralModuleFunctionInputPin(__MSP430_BASEADDRESS_PORT3_R__,
        GPIO_PORT_P3,
        GPIO_PIN4 + GPIO_PIN5
        );

    //Initialize USCI UART module
    if ( STATUS_FAIL == UART_init(__MSP430_BASEADDRESS_USCI_A0__,
             UART_CLOCKSOURCE_SMCLK,
             UCS_getSMCLK(__MSP430_BASEADDRESS_UCS__),
             BAUD_RATE,
             UART_NO_PARITY,
             UART_LSB_FIRST,
             UART_ONE_STOP_BIT,
             UART_MODE,
             UART_OVERSAMPLING_BAUDRATE_GENERATION
             )){
        return;
    }

    //Enable UART module for operation
    UART_enable(__MSP430_BASEADDRESS_USCI_A0__);

    //Enable Receive Interrupt
    UART_enableInterrupt(__MSP430_BASEADDRESS_USCI_A0__, UART_RECEIVE_INTERRUPT);

    //Enter LPM3, interrupts enabled
    __bis_SR_register(LPM3_bits + GIE);
    __no_operation();
}
int main(void) {
    OSC_init();
    TRISA = 0b00000000;
    TRISB = 0b00000011;
    TRISC = 0b10000000;
    ANCON0 = 0b11111111;
    ANCON1 = 0b00011111;
    INTCON2bits.RBPU = 0; // Pull-up enable

    timer0_init(3);

    UART_init();
    uint8_t txbuf[100];
    ringbuf_init(&tx_buf, txbuf, sizeof (txbuf));

    INTCONbits.GIE = 1;

    while (1) {
        static int16_t prev_e;
        if (encoder != prev_e) {
            prev_e = encoder;
            if (encoder < 0) {
                tx_send('-');
                tx_sendn(-encoder, 5);
                tx_send('\n');
            } else {
                tx_sendn(encoder, 5);
                tx_send('\n');
            }
        }
    }
    return 0;
}
예제 #11
0
int main(void)
{
	DDRB = 0xFF;
	PORTB = 0x20;

	// use CLK/1024 prescale value, clear timer/counter on compareA match
	TCCR1B = (1<<CS10) | (1<<CS12) | (1<<WGM12);
	// preset timer1 high/low byte
	OCR1A = ((F_CPU/1024) - 1 );   
	// enable Output Compare 1 overflow interrupt
	//TIMSK  = (1<<OCIE1A);
	// Enable interrupts
	sei();

	UART_init(4800);
	UART_putchar('W');
	UART_putchar('\n');
	UART_putchar('\r');

	UART_puts("Hello World!\n\r");
	UART_puts("This is a longer message!\n\rLet's hope it works well enough...\n\r");
	UART_puts("Hello World! 1\n\r");
	UART_puts("Hello World! 2\n\r");
	UART_puts("Hello World! 3\n\r");
	unsigned int i = 0;
	while (1) {
		i++;
		PORTB ^= 0x20;
		char charbuf[100];
		sprintf(charbuf, "Loop number %d\n\r",i); 
		UART_puts(charbuf);
	}
}
예제 #12
0
//*****************************************************************************
//
// 板级开发包初始化
//
//*****************************************************************************
void BSP_init(void)
{
    // Set the clocking to run directly from the crystal.
    SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |
                       SYSCTL_XTAL_8MHZ);

    // Enable processor interrupts.
    IntMasterEnable();

    // Configure SysTick for a periodic interrupt.
    SysTickPeriodSet(SysCtlClockGet() / SYSTICKHZ);
    SysTickEnable();
    SysTickIntEnable();

    // Initialize the DEBUG UART.           (UART0)
    DEBUG_UART_init();

    // Initialize the IO Hardware.          (LED/SOL/I2C_HOTSWAP)
    IO_init();

    // Initialize the UART Hardware.        (ICMB/SOL)
    UART_init();

    // Initialize the SPI Hardware.         (SSIF)
    SPI_init();

    // Initialize the I2C Hardware.         (IPMB/PMB)
    I2C_init();

    // Initialize the Ethernet Hardware.    (LAN)
    ETH_init();
}
예제 #13
0
파일: Xbee.c 프로젝트: SamChenzx/sdp
uint8_t Xbee_init(uint8_t uartId){
    xbeeUartId = uartId;
    UART_init(uartId,XBEE_BAUD_RATE);
#ifdef XBEE_REPROGRAM_SETTINGS
    if( programMode() == FAILURE){
        while(1);
        return FAILURE;
    }
#else
    /*
    int i = 0;
    char confirm[3];
    DELAY(2000);
    UART_putString(uartId, "+++", 3);
    DELAY(API_DELAY);
    //wait for "OK\r"
    do {
        confirm[i] = UART_getChar(XBEE_UART_ID);
        if (confirm[i] != 0)
            i++;
    } while(i < 3);

    if (!(confirm[0] == 0x4F && confirm[1] == 0x4B && confirm[2] == 0x0D)){
        return FAILURE;
    }
     * */
#endif
    return SUCCESS; 
}
예제 #14
0
void __main(void)
{
	uint8_t k;
	uint32_t i;

	UART_init();
	TMR16_Init();
	GPIO_init();

	if ( SysTick_Config(12000000) ) {
		while(1);
	}

	__enable_irq();

	puts("LPC1114 UART Test\r\n");

	while(1) {
		for ( k = 0; k < 8*3; k++ ) {
			LPC_TMR16B1->MR0 = Freq[k];
			LPC_TMR16B1->TCR = 1;

			for (i = 0xfffff; i !=0; i--);
			LPC_TMR16B1->TCR = 0;
			LPC_TMR16B1->TCR |= (1 << 1);
		}
	}
}
예제 #15
0
/*
 *  UART_open( )
 *    Open UART handle and configure it for 115200 baud
 * 
 */
Int16 EZDSP5535_UART_open( )
{
    CSL_Status        status;
    CSL_UartConfig 		    Config;

    /*  
     * Configuring for baud rate of 115200
     * Divisor = UART input clock frequency / (Desired baud rate*16)
     * = 100MHz / 115200 / 16
     * = 54 = 0x36
     */
    Config.DLL = 0x36;  // Set baud rate
    Config.DLH = 0x00;
        
    Config.FCR = 0x0000;            // Clear UART TX & RX FIFOs
    Config.LCR = 0x0003;            // 8-bit words,
                                    // 1 STOP bit generated,
                                    // No Parity, No Stick paritiy,
                                    // No Break control
    Config.MCR = 0x0000;            // RTS & CTS disabled,
                                    // Loopback mode disabled,
                                    // Autoflow disabled

    status = UART_init(&uartObj, CSL_UART_INST_0, UART_INTERRUPT);
    hUart = (CSL_UartHandle)&uartObj;
    status |= UART_reset(hUart);
    status |= UART_config(hUart,&Config);
    status |= UART_resetOff(hUart);        

    CSL_SYSCTRL_REGS->EBSR &= ~0xF000;   //
    CSL_SYSCTRL_REGS->EBSR |=  0x1000;   // Set parallel port to mode 1 (SPI, GPIO, UART, and I2S2)
    
	return status;
}
예제 #16
0
int main(void)
{

	initTimeOut();
	initQueue();
	UART_init();
	LCDInit();
	clearMem(WHITE);
	LCDStart();

	refresh();
	while (1) {
		if (msg_flag) {
			if(RxBuffer[0] == 1){
				printNewMsg();
				START_TIMEOUT;
			} else if(RxBuffer[0] == 2){
				uint8_t h = RxBuffer[1]-1;
				uint8_t m = RxBuffer[2]-1;
				uint8_t s = RxBuffer[3]-1; //since it's probably a bad idea to have a data value that's the same as the string terminator
				RTCinit(h,m,s);
				rtc_time_flag = 1;
			}
			msg_flag = 0;
			RxBuffer[0] = 0;
		}if (rtc_time_flag) {
			printTime();
			rtc_time_flag = 0;
		}

	}

}
예제 #17
0
int main(void)
{
	CLK_init();
	SYS_init();
	UART_init();
	ADC_init();
	PWM_init();			//Initialize PWM (servos not running)
	PWM_dutySet(500, 200);

	_bis_SR_register(LPM0_bits + GIE); // interrupts enabled

	while(1)
	{

		//_ldrL_ADCVal = _readADC(INCH_4); 		//Read ADC input on P2.1
		//_ldrR_ADCVal = _readADC(INCH_5); 		//Read ADC input on P2.2

		UART_puts((char *)"\n\r");
		UART_puts((char *)"_ldrL_ADCVal: ");
		UART_outdec(_ldrL_ADCVal, 0);
		UART_puts((char *)"\n\r");
		UART_puts((char *)"_ldrR_ADCVal: ");
		UART_outdec(_ldrR_ADCVal, 0);

		_delay_cycles(125000);
		P1OUT ^= (BIT0 + BIT6);
	}
}
/*
 *  ======== SENSORTAG_CC2650_initUART ========
 */
Void SENSORTAG_CC2650_initUART()
{
    /* Initialize the UART driver */
    UART_init();
    
    /* Initialize the UART IOs */
    UARTCC26XX_ioInit(UART_config);
}
예제 #19
0
파일: init.c 프로젝트: robotronik/archives
void init(){
    init_parametre();
    PWM1_init ();
    QEI_init ();
    io_init();
    UART_init();
    timer_init();
}
예제 #20
0
파일: Serial.c 프로젝트: BananaSlug/sdp
char Serial_init()
{
    #ifdef DEBUG
    printf("Intializing the Serial on UART %d.\n", SERIAL_UART_ID);
    #endif
    UART_init(SERIAL_UART_ID,SERIAL_UART_BAUDRATE);
    return SUCCESS;
}
예제 #21
0
/**
 * usage: this method sets up the environment to make sure the UART interface can be used
 * @method initializeUART
 * @author: patrik.szabo
 * @param *none*
 * @return *none*
 */
void initializeUART() {
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
	GPIOPinConfigure(GPIO_PA0_U0RX);
	GPIOPinConfigure(GPIO_PA1_U0TX);
	GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
	UART_init();
}
예제 #22
0
int main()
{
	UART_init();
	TWI_init();
	sei();
	while (1);
	return 0;
}
예제 #23
0
파일: init.c 프로젝트: robotronik/archives
void init(){
	init_osc();
	__builtin_write_OSCCONL(OSCCON & ~(0x40));	// Débloquage des RPIN et RPOR
    io_init();
    PWM1_init ();
    QEI_init ();
    UART_init();
	__builtin_write_OSCCONL(OSCCON | 0x40);		// Rebloquage des RPIN et RPOR
}
예제 #24
0
static  void  UART_putc(unsigned char ch)
{
    if (init_UART_done == 0) {
        UART_init();
        init_UART_done++;
    }
    while ((AT91C_BASE_DBGU->DBGU_CSR & AT91C_US_TXRDY) == 0) __nop();
    AT91C_BASE_DBGU->DBGU_THR = ch;
}
void _init(void)
{
  UART_init( &g_uart, COREUARTAPB0_BASE_ADDR, BAUD_VALUE_115200, (DATA_8_BITS | NO_PARITY) );
  
  extern int main(int, char**);
  const char *argv0 = "hello";
  char *argv[] = {(char *)argv0, NULL, NULL};

  exit(main(1, argv));
}
예제 #26
0
파일: Board_init.c 프로젝트: energia/emt
/*
 *  ======== Board_openUART ========
 *  Initialize the UART driver.
 *  Initialize the UART port's pins.
 *  Open the UART port.
 */
UART_Handle  Board_openUART(UInt uartPortIndex, UART_Params *uartParams)
{
    /* Initialize the UART driver */
    /* By design, UART_init() is idempotent */
    UART_init();

    /* initialize the pins associated with the respective UART */
    switch(uartPortIndex) {
        case 0:
            /* Serial */
            /* enable UART1 clock */
            MAP_PRCMPeripheralClkEnable(PRCM_UARTA1, PRCM_RUN_MODE_CLK);

            /*
             * Configure LaunchPad P2.9 as a UART1: UART1 TX (via USB port)
             *     device pin: 55 (UART1_TX)
             *     Wiring id : 12
             */
            MAP_PinTypeUART(PIN_55, PIN_MODE_6);

            /*
             * Configure LaunchPad P3.3 as a UART1: UART1 RX (via USB port)
             *     device pin: 57 (UART1_RX)
             *     Wiring id : 23
             */
            MAP_PinTypeUART(PIN_57, PIN_MODE_6);
            break;

        case 1:
            /* Serial1 */
            /* enable UART0 clock */
            MAP_PRCMPeripheralClkEnable(PRCM_UARTA0, PRCM_RUN_MODE_CLK);

            /*
             * Configure LaunchPad P1.4 as a UART0: UART0 TX
             *     device pin: 3 (UART0_TX)
             *     Wiring id : 4
             */
            MAP_PinTypeUART(PIN_03, PIN_MODE_7);

            /*
             * Configure LaunchPad P1.3 as a UART0: UART0 RX
             *     device pin: 4 (UART0_RX)
             *     Wiring id : 3
             */
            MAP_PinTypeUART(PIN_04, PIN_MODE_7);
            break;

        default:
            return (NULL);
    }

    /* open the UART */
    return (UART_open(uartPortIndex, uartParams));
}
예제 #27
0
int main(void) {

    volatile float zz = 360.0 * zz;

    // clear stripe
    for(uint16_t i = 0; i < LED; i++){
        stripe[i].blue = 0;
        stripe[i].green = 0;
        stripe[i].red = 0;
    }

    // run uart
    UART_init();

    UART_SendString("STM32F103WS2812 says hello\n\0");

    //WS2812_Init();

    //WS2812_clear();

    Delay(5000000L);

   Animator_Init();


    while(1){
        for(uint16_t j = 1; j < LED; j++){
            // wandering light
            for(uint16_t i = 0; i < LED; i++){
                stripe[i].blue = 0;
                stripe[i].green = 0;
                stripe[i].red = 0;
            }

            stripe[j].red = 0xAF;
            stripe[j].green = 0;
            stripe[j].blue = 0;

            // first led bugfix? pegel zu klein?
//            if(j!=0){
//                stripe[0].blue = 1;
//            }



            //WS2812_Init();

   //         WS2812_send(stripe, LED);


            Delay(7500000L);
            //while(1);
        }
    }
}
예제 #28
0
int main() /////////////////////////////////// MASTER ///////////////////////////////////////////
{

	CLEAR_BIT(DDRA,PA0);  // motor start button
	CLEAR_BIT(PORTA,PA0); // motor start button initialization

	CLEAR_BIT(DDRA,PA1); // motor stop button
	CLEAR_BIT(PORTA,PA1); // motor stop button initialization

	CLEAR_BIT(DDRA,PA2); // request motor status button
	CLEAR_BIT(PORTA,PA2); // request motor status button initialization

	SET_BIT(DDRC,PC0); // status led
	CLEAR_BIT(PORTC,PC0); // status led initialization

	UART_init(); // UART module initialization

	uint8 motorStatus;

	while(1)
	{

		if(BIT_IS_SET(PINA,PA0))
		{
			_delay_ms(250);
			UART_sendByte('A'); // turn motor on
		}

		if(BIT_IS_SET(PINA,PA1))
		{
			_delay_ms(250);
			UART_sendByte('B'); // turn motor off
		}

		if(BIT_IS_SET(PINA,PA2))
		{
			_delay_ms(250);
			UART_sendByte('G'); // request motor status
			motorStatus = UART_recieveByte(); // update led
			switch(motorStatus)
			{
			case 0:
				CLEAR_BIT(PORTC,PC0);
				break;
			case 1:
				SET_BIT(PORTC,PC0);
				break;
			}
		}


	}

	return 0;
}
예제 #29
0
int main()
{
	DDRB = 0xff;
	PORTB = 0x00;

	UART_init();
	TWI_init();
	sei();
	while (1);
	return 0;
}
예제 #30
0
int main()
{
	UART_init(9600); // 把串口波特率配置为9600
	
	while(1)
	{
		delay();
		UART_send("www.rationMCU.com", 17);//串口发送字符串数组
		UART_send_byte('\n'); //串口发送换行符字节
	}
}