|
楼主 |
发表于 2011-1-29 17:30:42
|
显示全部楼层
1楼说的好像是LINUX的中断吧,我是在void USART1_IRQHandler(void)这个中断函数里
用result_in=USART_ReceiveData(USART1)接受电脑发的指令
,然后要传送到线程里,不想用全局变量,是不是就直接用
rt_mb_send(&mb, (rt_uint32_t)&result_in);发送就行了~
我的中断程序:void USART1_IRQHandler(void)
{
#ifdef RT_USING_UART1
u16 result_in=0;
extern struct rt_device uart1_device;
extern void rt_hw_serial_isr(struct rt_device *device);
/* enter interrupt */
rt_interrupt_enter();
result_in=USART_ReceiveData(USART1);
rt_mb_send(&mb, (rt_uint32_t)&result_in);
rt_hw_serial_isr(&uart1_device);
/* leave interrupt */
rt_interrupt_leave();
#endif
}
或者得使用其它方式? |
|