无线传感网络课程设计

更新时间:2023-11-12 21:13:01 阅读量: 教育文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

无线传感网络 课程设计报告

姓名:胡韶辉

胡衎

2017

学号:139074377 139074376 班级:物131班 指导教师:卫琳娜

年1月1日

无线传感网络课程设计

实验一、无线传感网络点对点通信实验

1. 实验内容

此实验为验证实验,根据实验步骤进行实验,观察结果是否与预期相符

2.实验步骤

用IAR8.1打开路径:C:\\Users\\xs\\Desktop\\无线传感器网络课程设计\\无线传感网实验资料201604\\感知RF2-2530WSNV1.2\\代码和例子程序\\Light_Switch\\IDE\\Light_Switch\\srf05_cc2530\\Iar\\Light_Switch.eww分别编译并下载至两个节点上,打开节点,左右键选择/,选择完成后按中间键确认,观察LED灯显示情况。 3.实验代码及分析

/*

功 能:查找字符在索引中的哪一个位置 */

/**************************************************************************************************/

static u16 lookforChar( u8 ch ) { uint16 i; for( i = 0; i < FONTLISTCOUNT; i ++ ) { if( fontList[i] == ch ) return i; } return i; }

//查中文

static u16 lookforChar16( u16 ch ) { uint16 i,j; u16 temp16; for( i = 0; i < fontChar16ListCount; i ++ ) { j = i*2; temp16 = fontChar16List[j + 1]; temp16 <<= 8; temp16 |= fontChar16List[j]; if( temp16 == ch ) return i; } return i; }

/**************************************************************************************************/

/*

功 能:在指定位置输出8*8 */

/**************************************************************************************************/

static void LcdPutChar8( u8 x,u8 y,u8 ch ) { LcdBuf[y][x] = ch; }

/**************************************************************************************************/

/*

功 能:在指定位置输出16*16 */

/**************************************************************************************************/

/*static void LcdPutChar16( u8 x,u8 y,u16 ch ) { LcdBuf[y][x] = (u8)ch; //低前高后 LcdBuf[y+1][x] = (u8)(ch>>8); }

void LcdPutString8( u8 x,u8 y,u8 *ptr u8 len,u8 op ) { u8 i,*tptr = ptr,xx = x,yy = y; u16 m; if( x > 95) return ; if( y > 1) return ; for( i = 0;i < len; i ++ ) { m = lookforChar(*tptr ++); if( m != FONTLISTCOUNT ) { m = m * 8; }

else return; xx += 8; if( xx > 88 ) return; } } */

void LcdClearRam( void ) { u8 i; for( i = 0;i < 96;i ++ ) { LcdBuf[0][i] = 0; } for( i = 0;i < 96;i ++ ) { LcdBuf[1][i] = 0; } }

void LcdClearScrean( void ) { LcdClearRam(); PutPic( (void *)LcdBuf ); }

void LcdPutString16_8( u8 x,u8 y,u8 *ptr,u8 len,u8 op ) { u8 i,j,*tptr = ptr,xx = x,yy = y; u16 m; if( xx > 95) return ; if( yy ) return ; for( i = 0;i < len; i ++ ) { m = lookforChar(*tptr ++); if( m != FONTLISTCOUNT ) { m = m * 16; for( j = 0;j < 8;j ++ ) {

if(op) { LcdPutChar8( (xx + j),yy,font[m+j] ); LcdPutChar8( (xx + j),yy+1,font[m+j+8] ); } else { LcdPutChar8( (xx + j),yy,~font[m+j] ); LcdPutChar8( (xx + j),yy+1,~font[m+j+8] ); } } } else break; xx += 8; if( xx > 96 ) return; } PutPic( (void *)LcdBuf ); }

//显示16*16字符

void LcdPutString16_16( u8 x,u8 y,u8 *ptr,u8 len,u8 op ) { u8 i,j,*tptr = ptr,xx = x,yy = y; u16 m; if( xx > 95) return ; if( yy ) return ; for( i = 0;i < len; i ++ ) { m = lookforChar(*tptr ++); if( m != FONTLISTCOUNT ) { m = m * 32; for( j = 0;j < 16;j ++ ) { if(op) { LcdPutChar8( (xx + j),yy,font[m+j] ); LcdPutChar8( (xx + j),yy+1,font[m+j+16] ); } else

本文来源:https://www.bwwdw.com/article/h3lv.html

Top