But when i used serial oscilloscope to see waveform of digitalized output, amplitude of output signal was twice the input.
As you can see, amplitude is 200-600mV.
i don't know why the output is twice the input.
Is there any problem in my code?
(I didn;t checked bipolar mode in xadc wizard.)
i used below code.
#include<stdio.h>#include"platform.h"#include"xsysmon.h"staticXSysMonSysMonInst;//sysmon instancestaticintSysMonFractionToInt(floatFloatNum);#define SYSMON_DEVICE_ID XPAR_XADC_WIZ_0_DEVICE_ID
#define XSM_CH_AUX_7 23//AUX7#define XSM_CH_AUX_14 30//AUX14#defineXSysMon_RawToExtVoltage(AdcData)((((float)(AdcData))*(1.0f))/65536.0f)//#define XSysMon_RawToExtVoltage(AdcData) ((((float)(AdcData)))) int main(void){//u8 SeqMode;
u32 TempRawData,VccIntRawData,Aux_7_raw,Aux_14_raw;floatTempData,VccIntData,Aux_7,Aux_14;XSysMon_Config*SysMonConfigPtr;XSysMon*SysMonInstPtr=&SysMonInst;int xStatus;//prvSetupHardware();SysMonConfigPtr=XSysMon_LookupConfig(SYSMON_DEVICE_ID);if(SysMonConfigPtr== NULL) printf("LookupConfig FAILURE\n\r");
xStatus =XSysMon_CfgInitialize(SysMonInstPtr,SysMonConfigPtr,SysMonConfigPtr->BaseAddress);if(xStatus != XST_SUCCESS) printf("CfgInitialize FAILED\r\n");XSysMon_GetStatus(SysMonInstPtr);//pollingwhile(1){while((XSysMon_GetStatus(SysMonInstPtr)& XSM_SR_EOS_MASK)!= XSM_SR_EOS_MASK);//Aux_7_raw=XSysMon_GetAdcData(SysMonInstPtr,XSM_CH_AUX_7);Aux_7=XSysMon_RawToExtVoltage(Aux_7_raw);Aux_14_raw=XSysMon_GetAdcData(SysMonInstPtr,XSM_CH_AUX_14);Aux_14=XSysMon_RawToExtVoltage(Aux_14_raw);TempRawData=XSysMon_GetAdcData(SysMonInstPtr, XSM_CH_TEMP);//Read the on-chip Temperature DataTempData=XSysMon_RawToTemperature(TempRawData);VccIntRawData=XSysMon_GetAdcData(SysMonInstPtr, XSM_CH_VCCINT);//Read the on-chip Vccint DataVccIntData=XSysMon_RawToVoltage(VccIntRawData);//for serial oscilloscope
printf("\r\n%0d.%03d,%0d.%03d,%0d.%03d,%0d.%03d",(int)(Aux_7),SysMonFractionToInt(Aux_7),(int)(Aux_14),SysMonFractionToInt(Aux_14),(int)(VccIntData),SysMonFractionToInt(VccIntData),(int)(TempData),SysMonFractionToInt(TempData));}return0;}/*-----------------------------------------------------------*//*The AUX14 channel is defined to be 30 in xsysmon.h :*///#define XSM_CH_VCCPDRO 0x0F/**< On-chip PS VCCPDRO Channel, Zynq */#define XSM_CH_AUX_MIN 16/**< Channel number for 1st Aux Channel */#define XSM_CH_AUX_MAX 31/**< Channel number for Last Aux channel */#define XSM_CH_VUSR0 32/**< VUSER0 Supply - UltraScale */intSysMonFractionToInt(floatFloatNum){floatTemp;Temp=FloatNum;if(FloatNum<0){Temp=-(FloatNum);}return(((int)((Temp-(float)((int)Temp))*(1000.0f))));}//----------------------------------------------------------------------------------------------
Question
sungsik
Hi. Now i am using z-7010 with ZYBO.
I tried to convert sine function (by function generator) to digital output.
I used Aux14 P/N port.
positive port was connected to sine signal and negative one was connected to ground.(like single-ended).
I got an array of raw data using XSysmon_GetAdcData(), and converted that array by using newly defined function. (below code)
#define XSysMon_RawToExtVoltage(AdcData) ((((float)(AdcData))*(1.0f))/65536.0f)
Function generator output a 100-300mv, sine wave.
But when i used serial oscilloscope to see waveform of digitalized output, amplitude of output signal was twice the input.
As you can se e, amplitude is 200-600mV.
i don't know why the output is twice the input.
Is there any problem in my code?
(I didn;t checked bipolar mode in xadc wizard.)
i used below code.
thanks.
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.