zoukankan      html  css  js  c++  java
  • 测温补偿测试程序

    #include<stdio.h>
    #include<math.h>
    #define uchar unsigned char
    #define R1 10000 // the value of standard resistor is 10000
    #define c 0.0001// theroy current
    #define Vref 2.5//refrence voltage
    #define PGA 2//gain
    char *Hex="0123456789ABCDEF";
    void PrintHex(long a);

    //恒流源波动0.1uA时的测试情况
    int main(void)
    {
    double DM1 = 0x33404e;
    double DM2 = 0x52007d;
    double DT2 = (DM2/DM1) * R1 * c * PGA * (pow(2,23)-1)/(2 * Vref);
    long DT2_int = (long)DT2;//舍弃小数位
    printf("Decimal form: ");
    printf("%f ",DT2);
    printf("Hex form: ");
    PrintHex(DT2_int);
    printf(" ");
    return 0;
    }

    //函数的嵌套
    void PrintHex(long a)//Convert Decimal to Hex and print laster
    {
    if(!a)
    return;
    PrintHex(a/16);
    char x = Hex[a%16];
    printf("%c",Hex[a%16]);
    }

  • 相关阅读:
    980不同路径III
    输入函数
    IDEA更新maven依赖包
    join()函数
    方差偏差困境
    np.bincount()函数
    72编辑距离
    741摘樱桃
    523连续的子数组和
    1306跳跃游戏III
  • 原文地址:https://www.cnblogs.com/getyoulove/p/3874294.html
Copyright © 2011-2022 走看看