资源简介
基于msp430的cc1101 无线 WOR模式的例子程序,对于不同的开发板子 spi连的IO口可能不一样,下载后需要对应自己的板子稍作修改即可
代码片段和文件信息
//------Access Point Code--------
//---------Matt Taylor-----------
#include “msp430x22x4.h“
#include “radios/family1/mrfi_spi.h“
#include “mrfi.h“
//Packets
mrfiPacket_t wake_packet;
mrfiPacket_t stop_packet;
mrfiPacket_t packet;
//Function Prototypes
void GuiMenu();
void handleKeyboard(char); //Function to determine commands based on keystroke
void wakeOnRadio(); //Function to wakeup the radio
//-------------------------------MAIN-------------------------------------------
int main(void)
{
BSP_Init();
MRFI_Init();
P3SEL |= 0x30; //P3.45 = USCI_A0 TXD/RXD
UCA0CTL1 = UCSSEL_2; //SMCLK
UCA0BR0 = 0x41; //9600 from 8Mhz
UCA0BR1 = 0x3;
UCA0MCTL = UCBRS_2;
UCA0CTL1 &= ~UCSWRST; //Initialize USCI state machine
IE2 |= UCA0RXIE; //Enable USCI_A0 RX interrupt
int channel=20; //Channels from 0 to 200
MRFI_WakeUp();
MRFI_RxIdle();
mrfiSpiWriteReg(CHANNRchannel);
MRFI_RxOn();
P1DIR |= 0x03; //LED outputs
//--Clear Screen--
for (int i=0; i<15; i++) {
TXString(“\r\n“2); }
GuiMenu();
__bis_SR_register(GIE+LPM4_bits);
}
//--------------------KEYBOARD INTERUPTS----------------------------------------
#pragma vector=USCIAB0RX_VECTOR
__interrupt void USCI0RX_ISR(void)
{
char keystroke = UCA0RXBUF; //Capture keystroke
handleKeyboard(keystroke); //GUI option
}
//--------------------------PACKET RECEIVING------------------------------------
void MRFI_RxCompleteISR()
{
uint8_t i;
MRFI_Receive(&packet);
char output[] = {“ “};
for (i=9;i<29;i++) {
output[i-9]=packet.frame[i]; }
TXString(output (sizeof output));
}
void GuiMenu()
{
P1OUT &= ~0x03; //LEDs off
//--Output GUI options--
TXString( “\r\nWhat would you like to do?“ 30 );
TXString( “\r\n (0) Wake Up Device“ 22 );
TXString( “\r\n (1) Toggle LEDs“ 20 );
TXString( “\r\n (2) Turn Device Off“ 22 );
TXString( “\r\n“ 3 );
}
//-----------------CONVERT KEYSTROKE TO COMMAND---------------------------------
void handleKeyboard(char keystroke)
{
int i=0;
//----------------------Setup Packets----------------------
wake_packet.frame[0]=28;
stop_packet.frame[0]=28;
for(i=9;i<29;i++) {
wake_packet.frame[i]=‘ ‘;
stop_packet.frame[i]=‘ ‘;
}
wake_packet.frame[9]=‘T‘;
wake_packet.frame[10]=‘E‘;
wake_packet.frame[11]=‘S‘;
wake_packet.frame[12]=‘T‘;
stop_packet.frame[9]=‘S‘;
stop_packet.frame[10]=‘T‘;
stop_packet.frame[11]=‘O‘;
stop_packet.frame[12]=‘P‘;
//-------------------------------------------------------
if (keystroke==‘m‘ || keystroke==‘M‘)
{
GuiMenu();
}
if (keystroke==‘0‘)
{
wakeOnRadio();
for (i=0;i<5000;i++) { __no_operation(); } //Delay for a bit
MRFI_Transmit(&wake_packet MRFI_TX_TYPE_FORCED); //Check if its ready
}
if (keystroke==‘1‘)
{
MRFI_Transmit(&wake_packet MRFI_TX_TYPE_FORCED);
P1OUT ^= 0x01;
for (i=0;i<3000;i++) { __no_operation(); }
P1OUT ^= 0x01;
}
if (keystro
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 6200 2010-05-11 14:37 WOR.Example\AP\AccessPoint.dep
文件 17847 2010-05-11 12:52 WOR.Example\AP\AccessPoint.ewd
文件 48232 2010-05-11 12:52 WOR.Example\AP\AccessPoint.ewp
文件 55225 2010-05-11 14:22 WOR.Example\AP\Debug\Exe\AccessPoint.d43
文件 299 2010-05-11 14:22 WOR.Example\AP\Debug\Obj\AccessPoint.pbd
文件 13864 2010-05-11 14:17 WOR.Example\AP\Debug\Obj\bsp.r43
文件 26403 2010-05-11 14:22 WOR.Example\AP\Debug\Obj\main.r43
文件 104215 2010-05-11 14:17 WOR.Example\AP\Debug\Obj\mrfi.r43
文件 3650 2010-05-11 14:21 WOR.Example\AP\main.c
文件 2685 2010-05-11 14:22 WOR.Example\AP\settings\AccessPoint.cspy.bat
文件 7943 2010-05-11 14:37 WOR.Example\AP\settings\AccessPoint.dbgdt
文件 1140 2010-05-11 14:37 WOR.Example\AP\settings\AccessPoint.dni
文件 149 2010-05-10 15:00 WOR.Example\Debug\Obj\EndDevice.pbd
文件 5202 2009-03-09 01:35 WOR.Example\drivers\bsp\boards\EZ430RF\bsp_board.c
文件 4600 2009-03-09 01:35 WOR.Example\drivers\bsp\boards\EZ430RF\bsp_board_defs.h
文件 1931 2008-12-17 16:37 WOR.Example\drivers\bsp\boards\EZ430RF\bsp_button_defs.h
文件 6435 2008-12-17 16:37 WOR.Example\drivers\bsp\boards\EZ430RF\bsp_config.h
文件 3920 2008-12-17 16:37 WOR.Example\drivers\bsp\boards\EZ430RF\bsp_drivers.c
文件 3113 2008-12-17 16:37 WOR.Example\drivers\bsp\boards\EZ430RF\bsp_driver_defs.h
文件 4131 2009-03-06 05:17 WOR.Example\drivers\bsp\boards\EZ430RF\bsp_external\mrfi_board.c
文件 9544 2008-12-17 16:37 WOR.Example\drivers\bsp\boards\EZ430RF\bsp_external\mrfi_board_defs.h
文件 4580 2008-12-17 16:37 WOR.Example\drivers\bsp\boards\EZ430RF\bsp_led_defs.h
文件 4639 2008-12-17 16:37 WOR.Example\drivers\bsp\bsp.c
文件 6940 2008-12-17 16:37 WOR.Example\drivers\bsp\bsp.h
文件 3963 2008-12-17 16:37 WOR.Example\drivers\bsp\bsp_macros.h
文件 4606 2008-12-17 16:37 WOR.Example\drivers\bsp\drivers\bsp_buttons.h
文件 6245 2008-12-17 16:37 WOR.Example\drivers\bsp\drivers\bsp_leds.h
文件 4483 2008-12-17 16:37 WOR.Example\drivers\bsp\drivers\code\bsp_buttons.c
文件 10716 2008-12-17 16:37 WOR.Example\drivers\bsp\drivers\code\bsp_generic_buttons.h
文件 16726 2008-12-17 16:37 WOR.Example\drivers\bsp\drivers\code\bsp_generic_leds.h
............此处省略122个文件信息
相关资源
- Tom Mitchell《机器学习》中文word版本
- 2020滴滴行程单--word版
- QtWifiTestDemo
- VMware-Workstation-Full-15.0.3-12422535.x86_64
- msp430G2553直流电机控制PWM调速和正反转
-
robotfr
amework-ride-1.3.win-amd64.exe -
Z.Entityfr
amework.Extensions.EFCore.dll2.1. -
IAR em
bedded Workbench for 8051 7.60 破解 - 软件著作权60页代码整理生成工具V2
- Nachos中文文档教程word.dot
-
AjaxControlToolkit-fr
amework3.5SP1 - MSP430F149读写SD卡程序
- Workgroup.reg
- 自动生成word文档
- OsWorkflow工作流
- 常微分方程 王高雄主编 第三版 高等
- Word2TeX 注册破解版 Word转Tex软件 doc转
- MSP430G2*单片机利用HC-SR04测距
- powerword 新英格兰39节点系统
- VMware Workstation v6.5.Keygen FOR ACE
- win10中公式编辑器MT Extra字体
- 考试系统中Word操作题自动阅卷的实现
- word文件查重工具
- 数据结构课程设计 校园导航(含源程
- 我是一只IT小小鸟(word版+txt版)合集
- MSP430F6638时钟配置,注释清晰,可移植
- msp430f149单路AD采样电压值并在lcd1602上
- msp430编程器上位机软件
- 基于MSP430单片机实现的正弦波PWM输出
- Computer Networks 5th solution答案解析
评论
共有 条评论