vsmain.c

来自「msp430串口程序 MSP430_UART_DEMO」· C语言 代码 · 共 62 行

C
62
字号
/*****************************************************************************
* IAR visualSTATE Main Loop Source File
*
* The file contains an implementation for a main loop using the visualSTATE
* basic API.
*
* The code uses a simple queue for storing events. The functions for inter-
* facing to the queue are described in the sample code file
* simpleEventHandler.h.
*****************************************************************************/



/* *** include directives *** */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include "device.h"
#include "deviceSetup.h"
#include "putchar_232.h"
#include "putchar_485.h"
/* *** variable definitions *** */


/* *** function definitions *** */

void uart_comm(void);
int __low_level_init(void)
  {
    /* Insert your low-level initializations here */
    WDTCTL = WDTPW + WDTHOLD;             // Disable the Watchdog

  return (1);                           // Flag to initialize the data segment

    /*==================================*/
    /* Choose if segment initialization */
    /* should be done or not.		*/
    /* Return: 0 to omit seg_init	*/
    /*	       1 to run seg_init	*/
    /*==================================*/
  }

void main(void)
{
  InitDevice();
  RS232Init();
  RS485Init();
  rs232_send_string_232("maoWubin!");
  /* Do forever: */
  for(;;)
  {
      //检查缓冲区是否有数据接收到
    if(RS232RXBufferCount_232())
    {
      char tmp;
      tmp = RS232GetChar_232();
      putchar_232(tmp);
    }
  }
}

⌨️ 快捷键说明

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