Giter Club home page Giter Club logo

hardware_final_proj's Introduction

Hardware_Final_Proj

本代码使用MDK5开发,需配合STM32F103开发板使用。

针脚定义

ADC的输入为P1针脚,DAC的输出为P4针脚。

宏定义

各个宏定义如下:

#define SLOPE 25		//k
#define V_ZERO 840		//Vzero
#define CONS 4
#define VOUT_FORMULA (float)1000*pow((float)10,(((float)adc_raw*3300)/(81900*(float)SLOPE)-(float)V_ZERO/(20*(float)SLOPE)-(float)CONS/20))

这是通过公式由ADC输入值计算实际波形峰峰值的部分,VOUT_FORMULA定义的是计算公式,而SLOPEV_ZEROCONS分别对应公式里的k、Vzero和CONS, 这一部分可以直接修改。

#define STATE0 1
#define STATE1 10
#define STATE2 20
#define STATE3 100

这一部分定义的是DAC输出各个状态下对应的增益倍数,用来从Vout计算Vin的值,可以直接修改。

#define STATE0_VAL 0
#define STATE1_VAL 1023
#define STATE2_VAL 2482
#define STATE3_VAL 4095

这一部分定义的是DAC各个输出状态的寄存器值,DAC的实际输出Vdac=(寄存器值*3.3V)/4096。可以直接修改。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.