野火电子论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 10382|回复: 1

关于invalid operands to binary

[复制链接]
发表于 2019-4-13 21:03:59 | 显示全部楼层 |阅读模式
【code】
void MY_NVIC_Init(u8 NVIC_PreemptionPriority,u8 NVIC_SubPriority,u8 NVIC_Channel,u8 NVIC_Group)     
{
    u8 temp;   
    u8 IPRADDR=NVIC_Channel/4;                        //ÿ×éÖ»ÄÜ´æ4¸ö,µÃµ½×éµØÖ·
    u8 IPROFFSET=NVIC_Channel%4;                  //ÔÚ×éÄÚµÄÆ«ÒÆ
    IPROFFSET=IPROFFSET*8+4;                        //µÃµ½Æ«ÒƵÄÈ·ÇÐλÖÃ
    MY_NVIC_PriorityGroupConfig(NVIC_Group);  //ÉèÖ÷Ö×é
    temp=NVIC_PreemptionPriority<<(4-NVIC_Group);      
    temp|=NVIC_SubPriority&(0x0f>>NVIC_Group);
    temp&=0xf;//&#200;&#161;&#181;&#205;&#203;&#196;&#206;&#187;

    if(NVIC_Channel<32)NVIC->ISER[0]|=1<<NVIC_Channel;           //使能中断位
    else NVIC->ISER[1]|=1<<(NVIC_Channel-32);   
    NVIC->IP |= temp<<IPROFFSET;出错行     invalid operands to binary    expression (‘volatile uint8_t 【240】’and ‘int’)                        
}
typedef struct
{
  __IO uint32_t ISER[8];                      /*!< Offset: 0x000  Interrupt Set Enable Register           */
       uint32_t RESERVED0[24];                                   
  __IO uint32_t ICER[8];                      /*!< Offset: 0x080  Interrupt Clear Enable Register         */
       uint32_t RSERVED1[24];                                    
  __IO uint32_t ISPR[8];                      /*!< Offset: 0x100  Interrupt Set Pending Register          */
       uint32_t RESERVED2[24];                                   
  __IO uint32_t ICPR[8];                      /*!< Offset: 0x180  Interrupt Clear Pending Register        */
       uint32_t RESERVED3[24];                                   
  __IO uint32_t IABR[8];                      /*!< Offset: 0x200  Interrupt Active bit Register           */
       uint32_t RESERVED4[56];                                   
  __IO uint8_t  IP[240];                      /*!< Offset: 0x300  Interrupt Priority Register (8Bit wide) */
       uint32_t RESERVED5[644];                                 
  __O  uint32_t STIR;                         /*!< Offset: 0xE00  Software Trigger Interrupt Register     */
}  NVIC_Type;   

【/code】
没弄懂怎么改动










回复

使用道具 举报

发表于 2019-4-23 14:09:05 | 显示全部楼层
要进行类型转换
回复 支持 反对

使用道具 举报

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

本版积分规则

联系站长|手机版|野火电子官网|野火淘宝店铺|野火电子论坛 ( 粤ICP备14069197号 ) 大学生ARM嵌入式2群

GMT+8, 2024-6-12 05:06 , Processed in 0.029926 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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