This time with Zynq's embedded XADC to collect some parameters inside the ZYNQ:
vccint: Internal PL Core Voltage
vccaux: Auxiliary PL voltage
VREFP:XADC Positive Reference voltage
VREFN:XADC Negative Reference voltage
VCCBRAM:PL Bram Voltage
Vccpint:ps Internal Core voltage
Vccpaux:ps Auxiliary Voltage
Operating voltage of VCCDDR:DDR RAM
This process and the development process of the previous indistinguishable, I hope you can fully familiar with the process ~ ~
As always, create a block Design and add the Zynq kernel and the XADC IP to it.
Setting the XADC Core
Execute these two items in turn:
After execution as shown:
Execute generate Output products and Create HDL Wrapper in turn
The final compilation until a bit file is generated.
Export the hardware and open the SDK via Vivado.
Enter the SDK, how to create a new project, do not re-verbose, please refer to the previous section. After you create a new MAIN.C, add the following code as follows ~ ~ (This code is a reference to a foreign God, Adam wrote, Tribute to the Great God ~ ~)
#include <stdio.h>//#include "platform.h"#include"Xadcps.h"#include"Xil_types.h"#definexpar_axi_xadc_0_device_id 0//void print (char *str);StaticXadcps Xadcmoninst;intMain () {Xadcps_config*configptr; Xadcps*xadcinstptr = &Xadcmoninst; //Status of Initialisation intSTATUS_ADC; //Temperature Readingsu32 Temprawdata; floatTempData; //Vcc Int Readingsu32 Vccintrawdata; floatVccintdata; //Vcc Aux Readingsu32 Vccauxrawdata; floatVccauxdata; //Vbram Readingsu32 Vbramrawdata; floatVbramdata; //Vccpint Readingsu32 Vccpintrawdata; floatVccpintdata; //Vccpaux Readingsu32 Vccpauxrawdata; floatVccpauxdata; //vddr Readingsu32 Vddrrawdata; floatVddrdata;//Init_platform (); //printf ("Adam Edition microzed Using Vivado How to printf \n\r");printf"Happy New Year ~~!!! 2015-12-31 \n\r"); //XADC initilizationconfigptr=Xadcps_lookupconfig (xpar_axi_xadc_0_device_id); if(Configptr = =NULL) { returnxst_failure; } STATUS_ADC= Xadcps_cfginitialize (xadcinstptr,configptr,configptr->baseaddress); if(Xst_success! =STATUS_ADC) {Print ("ADC INIT failed\n\r"); returnxst_failure; } //Self TestSTATUS_ADC =xadcps_selftest (XADCINSTPTR); if(STATUS_ADC! =xst_success) { returnxst_failure; } //Stop SequencerXadcps_setsequencermode (Xadcinstptr,xadcps_seq_mode_singchan); //Disable AlarmsXadcps_setalarmenables (Xadcinstptr,0x0); //Configure Sequencer to just sample internal on chip parametersXadcps_setseqinputmode (xadcinstptr, Xadcps_seq_mode_safe); //Configure the channel enables we want to monitorXadcps_setseqchenables (xadcinstptr,xadcps_ch_temp| Xadcps_ch_vccint| Xadcps_ch_vccaux| xadcps_ch_vbram| Xadcps_ch_vccpint| Xadcps_ch_vccpaux|Xadcps_ch_vccpdro); while(1) {Temprawdata=Xadcps_getadcdata (xadcinstptr, xadcps_ch_temp); TempData=xadcps_rawtotemperature (Temprawdata); printf ("Raw temp%lu Real temp%f \n\r", Temprawdata, TempData); Vccintrawdata=Xadcps_getadcdata (xadcinstptr, xadcps_ch_vccint); Vccintdata=xadcps_rawtovoltage (Vccintrawdata); printf ("Raw vccint%lu Real vccint%f \n\r", Vccintrawdata,vccintdata); Vccauxrawdata=Xadcps_getadcdata (xadcinstptr, Xadcps_ch_vccaux); Vccauxdata=xadcps_rawtovoltage (Vccauxrawdata); printf ("Raw vccaux%lu Real vccaux%f \n\r", Vccauxrawdata,vccauxdata); Vbramrawdata=Xadcps_getadcdata (xadcinstptr, Xadcps_ch_vbram); Vbramdata=xadcps_rawtovoltage (Vbramrawdata); printf ("Raw vccbram%lu Real vccbram%f \n\r", Vbramrawdata, Vbramdata); Vccpintrawdata=Xadcps_getadcdata (xadcinstptr, xadcps_ch_vccpint); Vccpintdata=xadcps_rawtovoltage (Vccpintrawdata); printf ("Raw vccpint%lu Real vccpint%f \n\r", Vccpintrawdata, Vccpintdata); Vccpauxrawdata=Xadcps_getadcdata (xadcinstptr, Xadcps_ch_vccpaux); Vccpauxdata=xadcps_rawtovoltage (Vccpauxrawdata); printf ("Raw vccpaux%lu Real vccpaux%f \n\r", Vccpauxrawdata, Vccpauxdata); Vddrrawdata=Xadcps_getadcdata (xadcinstptr, Xadcps_ch_vccpdro); Vddrdata=xadcps_rawtovoltage (Vddrrawdata); printf ("Raw vccddr%lu Real vccddr%f \n\r", Vddrrawdata, Vddrdata); } return 0;}
1. Use the "xadcps_selftest ()" This self-test is needless to say.
2. Use "Xadcps_setsequencermode ()" This is to set the sampling mode.
3. Use "Xadcps_setalarmenables ()" This is set sampling value alarm, direct shutdown, do not need to alarm
4. Use "Xadcps_setseqinputmode ()" This is the setting of the input mode
5. Use "Xadcps_setseqchenables () This is the Enable sampling channel
After compiling, remember to download the bit file ~ ~ Connected to the serial port, then you can execute the program:
Thus, by opening the serial debugging assistant, you can see the print out the following information ~ ~
New Year's Day ~ ~ from this article, Vivado upgrade to version 2015.2 ~ ~ If you need to download, the network address is as follows ~ ~
Vivado 2015.2 http://yunpan.cn/c3I7aVCGVneEh access password 7d64
MiZ702 Study notes 9--XADC capture on-chip data PS version