LM3S1911如何读P口

2019-03-24 15:33发布

LM3S1911如何读P口,就是如何把P口,比如PF口的状态读到一个字符变量,初学,请各位不吝赐教,谢谢,在线等 此帖出自小平头技术问答
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
7条回答
David_Lee
2019-03-25 10:40

原帖由 yuanyc5877 于 2011-10-11 21:22 发表 谢谢,就用这个HWREGB在试,可能是前面没搞对,我再看看。再次感谢

 

参考一下hw_types.h里面的定义吧

//*****************************************************************************
//
// Macros for hardware access, both direct and via the bit-band region.
//
//*****************************************************************************
#define HWREG(x)                                                             
        (*((volatile unsigned long *)(x)))
#define HWREGH(x)                                                            
        (*((volatile unsigned short *)(x)))
#define HWREGB(x)                                                            
        (*((volatile unsigned char *)(x)))
#define HWREGBITW(x, b)                                                      
        HWREG(((unsigned long)(x) & 0xF0000000) | 0x02000000 |               
              (((unsigned long)(x) & 0x000FFFFF) << 5) | ((b) << 2))
#define HWREGBITH(x, b)                                                      
        HWREGH(((unsigned long)(x) & 0xF0000000) | 0x02000000 |              
               (((unsigned long)(x) & 0x000FFFFF) << 5) | ((b) << 2))
#define HWREGBITB(x, b)                                                      
        HWREGB(((unsigned long)(x) & 0xF0000000) | 0x02000000 |              
               (((unsigned long)(x) & 0x000FFFFF) << 5) | ((b) << 2))

一周热门 更多>

相关问题

    相关文章