打印

【分享TI LM3S811开发板使用心得通过无线模块AP220通讯】

[复制链接]
1772|2
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
ddllxxrr|  楼主 | 2011-12-14 15:01 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
AP220无线模块,是很稳定的套件包括收发模块和一个USB转串模块,这样就可直接同电脑通讯了。
资料传下: dfrobot-apc220-manual1.pdf (213.52 KB)
中文资料: APC220.pdf (340.24 KB)

用LM3S811的串口1,通读数率为9600,

程序如下:
//*****************************************************************************
//
// Configure the UART and perform reads and writes using polled I/O.
//
//*****************************************************************************
int
main(void)
{
   
    //
    // Set the clocking to run directly from the external crystal/oscillator.
    // TODO: The SYSCTL_XTAL_ value must be changed to match the value of the
    // crystal on your board.
    //
    SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
                   SYSCTL_XTAL_6MHZ);
    //
    // Enable the peripherals used by this example.
    // The UART itself needs to be enabled, as well as the GPIO port
    // containing the pins that will be used.
    //
    SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
    //
    // Configure the GPIO pin muxing for the UART function.
    // This is only necessary if your part supports GPIO pin function muxing.
    // Study the data sheet to see which functions are allocated per pin.
    // TODO: change this to select the port/pin you are using
    //
    GPIOPinConfigure(GPIO_PD2_U1RX);
    GPIOPinConfigure(GPIO_PD3_U1TX);
    //
    // Since GPIO D2 and D3 are used for the UART function, they must be
    // configured for use as a peripheral function (instead of GPIO).
    // TODO: change this to match the port/pin you are using
    //
    GPIOPinTypeUART(GPIO_PORTD_BASE, GPIO_PIN_2 | GPIO_PIN_3);
    //
    // Configure the UART for 9600, 8-N-1 operation.
    // This function uses SysCtlClockGet() to get the system clock
    // frequency.  This could be also be a variable or hard coded value
    // instead of a function call.
    //
    UARTConfigSetExpClk(UART1_BASE, SysCtlClockGet(), 9600,
                        (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
                         UART_CONFIG_PAR_NONE));
    //
    // Put a character to show start of example.  This will display on the
    // terminal.
    //
    while(1)
{
UARTCharPut(UART1_BASE, 0xAA);
}
    //
   
    //return(0);
}

工程文件打包:
21ICUART.rar (1.37 MB)

最终效果:

相关帖子

沙发
lzlong| | 2011-12-14 16:54 | 只看该作者
谢楼主分享了

使用特权

评论回复
板凳
ddllxxrr|  楼主 | 2011-12-24 14:14 | 只看该作者
不谢:lol

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

个人签名:http://shop34182318.taobao.com/ http://shop562064536.taobao.com

2398

主题

6950

帖子

67

粉丝