智能车制作

 找回密码
 注册

扫一扫,访问微社区

查看: 1400|回复: 0
打印 上一主题 下一主题

求大神指导 关于用中断读取一场多少行的代码

[复制链接]

3

主题

22

帖子

0

精华

高级会员

Rank: 4

积分
722
威望
454
贡献
150
兑换币
102
注册时间
2011-10-4
在线时间
59 小时
跳转到指定楼层
1#
发表于 2013-4-18 17:38:16 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 winners000001 于 2013-4-18 17:46 编辑

#include "common.h"#include "HAL_GPIO.h"
#include "HAL_UART.h"
/********************************************************************/
void Get_H_P(void);
uint16_t A_Con;
uint16_t B_Con;
uint8_t C_Con,D_Con;
void main (void)
{   
  DisableInterrupts;
  LPLD_UART_Init(UART0,115200);
  LPLD_GPIO_Init(PTB,0,DIR_INPUT,INPUT_PDOWN,IRQC_RI);  //PTB0接行中断                               LPLD_GPIO_Init(PTB,1,DIR_INPUT,INPUT_PDOWN,IRQC_RI);  //PTB1接场中断
  EnableInterrupts;  LPLD_GPIO_SetIsr(PTB,Get_H_P);
  while(1)
  {   
  }
}
/********************************************************************/
void Get_H_P(void)
{  
  if(PORTB_ISFR&0x00000001)
  {
    A_Con++;
  }
  if(PORTB_ISFR&0x00000002)
  {
    B_Con=A_Con;
    A_Con=0;
    C_Con=B_Con/256;
    D_Con=B_Con%256;
    LPLD_UART_PutChar(UART0,C_Con);
    LPLD_UART_PutChar(UART0,D_Con);
  }
}


代码如上 用的拉普兰德的库 可是收到的是
00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 02 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01





您需要登录后才可以回帖 登录 | 注册

本版积分规则

关于我们|联系我们|小黑屋|智能车制作 ( 黑ICP备2022002344号

GMT+8, 2024-12-25 14:06 , Processed in 0.061896 second(s), 30 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表