高级会员
- 积分
- 722
- 威望
- 454
- 贡献
- 150
- 兑换币
- 102
- 注册时间
- 2011-10-4
- 在线时间
- 59 小时
|
本帖最后由 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
|
|