智能车制作
标题:
求大神指导 关于用中断读取一场多少行的代码
[打印本页]
作者:
winners000001
时间:
2013-4-18 17:38
标题:
求大神指导 关于用中断读取一场多少行的代码
本帖最后由 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
欢迎光临 智能车制作 (http://dns.znczz.com/)
Powered by Discuz! X3.2