|
本帖最后由 超群天晴 于 2013-9-18 22:12 编辑
加上了串口,参考数据手册的。发现7P90没有端口复用配置寄存器啊。
加上串口就能看发送的调试信息了。
贴上源代码- /*
- hr7p90h 串口测试(发送) 程序
- 波特率 9600
- TX1端口 (PC6)
- */
- #include "hic.h"
- #include "hr7p90h.h"
- #define uchar unsigned char
- #define uint unsigned int
- void Uart_init(void);
- void Uart_sendChar(char c);
- void Uart_sendMsg(char * str);
- void delay(uint x)
- {
- uint i,j;
- for(i=500;i>0;i--)
- for(j=x;j>0;j--);
- }
- void main()
- {
- char str[13] = {'h','e','l','l','o',' ','w','o','r','l','d','\n','\0'};
- Uart_init();
- PBT0=0;
- while(1)
- {
- PB0=0;
- delay(500);
- PB0=1;
- delay(500);
- Uart_sendMsg(str);
- }
- }
- void Uart_init(void)
- {
- TX1C = 0;
- BRGH1 = 1;//0低速率
- TX1M = 0;
- TX1EN = 0;
- BR1R = 104;//9600=16M/(16*(104+1))
- PCT &=~(0x01<<6);//PCT6 = 0:输出状态
- TX1EN = 1;
- }
- void Uart_sendChar(char c)
- {
- while(!TRMT1)
- {}
- TX1B = c;
- }
- void Uart_sendMsg(char * str)
- {
- while(*str!='\0')
- {
- Uart_sendChar(*str);
- str++;
- }
- }
复制代码 IDE也不支持string.h啊,没有办法定义string类型,所以helloworld就只能用一个一个的字符表示了。
阿莫的代码显示功能不给力啊,对其颜色什么的都没有,求莫大升级代码编辑器功能
下一步就是测试AD了,等买到的7361 模块到了,就可以做动作识别和上位机的开发了。
==========================
工程代码:
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|