C----Study

1)  Numeric Data Types

Keyword           Variable Type               Range

char              Character (or string)       -128 to 127
int               Integer                     -32,768 to 32,767
short             Short integer               -32,768 to 32,767
short int         Short integer               -32,768 to 32,767
long              Long integer                -2,147,483,648 to 2,147,483,647
unsigned char     Unsigned character          to 255
unsigned int      Unsigned integer            to 65,535
unsigned short    Unsigned short integer      to 65,535
unsigned long     Unsigned long integer       to 4,294,967,295
float             Single-precision            +/-3.4E10^38 to +/-3.4E10^38
                  floating-point
                  (accurate to digits)     
double            Double-precision            +/-1.7E10^308 to +/-1.7E10^308 
                  floating-point
                  (accurate to 15 digits)

 

C has really only four types of variables:

  1. char
  2. int
  3. float
  4. double


1)enum

#include <stdio.h>

enum months 
   JAN = 1, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC };

int main()

   enum months month; 

   const char *monthName[] """January""February""March"
      "April""May""June""July""August""September""October",
      "November""December" };
   
   for month = JAN; month <= DEC; month++ ) {
      printf"%2d%11s\n", month, monthNamemonth ] );
   

   return 0;
} 

 3) Union

 
  1. Union has members of different data types, but can hold data of only one member at a time.
  2. The different members share the same memory location.
  3. The total memory allocated to the union is equal to the maximum size of the member.

#include <stdio.h>
union marks
{
    float percent;
    char grade;
};
int main ( )
{
    union marks student1;
    student1.percent = 98.5;
    printf"Marks are %f   address is %16lu\n", student1.percent, &student1.percent);
    student1.grade = 'A';
    printf"Grade is %c address is %16lu\n", student1.grade, &student1.grade);
}

4) Comparing the equality operator (==) with the '=' assignment operator.

 

 
aba = ba == b
53a = 3 (true)false
70a = 0 (false)false
00a = 0 (false)true

5) Register variable

 

Register variable is for faster access.

Register variable cannot be global variables.

#include <stdio.h>

main()
{
    register int i = 0;   

    fori=0;i<2;i++)
    {
        printf("value of i is %d\n",i);
    }
}


6) Type conversion

 

  1. Type conversion occurs when the expression has data of mixed data types.
  2. In type conversion, the data type is promoted from lower to higher.
  3. The hierarchy of data types: double, float, long, int, short, char.


内容概要:本文介绍了奕斯伟科技集团基于RISC-V架构开发的EAM2011芯片及其应用研究。EAM2011是一款高性能实时控制芯片,支持160MHz主频和AI算法,符合汽车电子AEC-Q100 Grade 2和ASIL-B安全标准。文章详细描述了芯片的关键特性、配套软件开发套件(SDK)和集成开发环境(IDE),以及基于该芯片的ESWINEBP3901开发板的硬件资源和接口配置。文中提供了详细的代码示例,涵盖时钟配置、GPIO控制、ADC采样、CAN通信、PWM输出及RTOS任务创建等功能实现。此外,还介绍了硬件申领流程、技术资料获取渠道及开发建议,帮助开发者高效启动基于EAM2011芯片的开发工作。 适合人群:具备嵌入式系统开发经验的研发人员,特别是对RISC-V架构感兴趣的工程师和技术爱好者。 使用场景及目标:①了解EAM2011芯片的特性和应用场景,如智能汽车、智能家居和工业控制;②掌握基于EAM2011芯片的开发板和芯片的硬件资源和接口配置;③学习如何实现基本的外设驱动,如GPIO、ADC、CAN、PWM等;④通过RTOS任务创建示例,理解多任务处理和实时系统的实现。 其他说明:开发者可以根据实际需求扩展这些基础功能。建议优先掌握《EAM2011参考手册》中的关键外设寄存器配置方法,这对底层驱动开发至关重要。同时,注意硬件申领的时效性和替代方案,确保开发工作的顺利进行。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值