ADCINCVR - Cypress.com Forums http://www.cypress.com/? Re: ADCINCVR http://www.cypress.com/?rID=41939 Mon, 22 Feb 2010 23:31:11 -0600 Re: ADCINCVR http://www.cypress.com/?rID=41938 Thank you for the info.
I'm still facing some problems with the ADCINCVR.
It seems not to be processing any data.
I hope that I've provided enough information for a discussion.

Global Resources
PowerSetting[Vcc/SysCLK]~5V/24MHz
VC1 = SysVlk/N~12
Ref Mux~P2[4]+/-P2[6]
The rest are as default

Here are the properties settings of the ADCINCVR I've set:
Input~Port2_2
ClockPhase~Swap
Clock~VC1(Which is 2Mhz)
ADCResolution~8
CalcTime~520
DataFormat~Unsigned
IntDispatchMode~ActiveStatus

For the Digital Block placements, I've placed the DAC Counter at DBB00 & 01, the ADCINCVR CNT at DCB12 and the ADCINCVR PWM at DBB20 & 21. All Digital blocks clock are from VC1(2Mhz). The DAC counter will generate a global interrupt in 266hz to trigger the DACs to output.

For the Analog blocks placements the ADC is placed at ASD13 and input from PORT2_2. I've one set of DAC8 placed at ASC10 and ASD20, Analogbus to Buf 0 then to Port_0_3. Then I've another set of DAC8 placed at ASC11 and ASD21, Analogbus to Buf 1 then to Port_0_3.

The C programming I've written is as follows:
BYTE Pointer;
int iData;

void main(void)
{ M8C_EnableGInt;
Counter16_1_Start();
Counter16_1_EnableInt();
DAC8_1_Start(DAC8_1_HIGHPOWER);
DAC8_2_Start(DAC8_2_HIGHPOWER);
ADCINCVR_1_Start(ADCINCVR_1_HIGHPOWER);
ADCINCVR_1_GetSamples(0);

While(1)
{
if (ADCINCVR_1_fIsDataAvailable() != 0)
{
iData = ADCINCVR_1_iGetData();
ADCINCVR_1_ClearFlag();
DAC8_1_Start(DAC8_1_LOWPOWER);
DAC8_2_Start(DAC8_2_LOWPOWER);
}
}
}

#pragma interrupt_handler Counter_ISR;
void Counter_ISR(void)
{
DAC8_1_WriteBlind (SineTable1[Pointer]);
DAC8_2_WriteBlind (SineTable2[Pointer]);
Pointer++;
if(Pointer >= 64)
{Pointer = 0}
}

Sinetable1 and SineTable2 are 64 Points lookup tables stored in ROM.
When i powered up the CY8C29466, the output gives a highpower signal instead of a lowpower signal.
If the ADC is reading and processing signal a lowpower signal should be observed.
Any comments from anyone?]]>
Mon, 22 Feb 2010 23:28:19 -0600
Re: ADCINCVR http://www.cypress.com/?rID=41937 If you have written the Timer ISR in C, you will have to open the .lst file and manually add the CPU cycles for all the instructions in the function. Check the Assembly Language User Guide (from Help >> Documentation menu) for details of CPU cycles of different instructions.]]> Mon, 22 Feb 2010 08:49:50 -0600 Re: ADCINCVR http://www.cypress.com/?rID=41936 How do I determine the numbers of CPU cycles the Timer ISR take so as to add the value with the ADC 180CPU cycles?

Anyway I've written the ADC part of the program as:

int iData;
void main(void)
{
.
.
.
while(1)
{
if (ADCINCVR_1_fIsDataAvailable() != 0)
{
iData = ADCINCVR_1_iGetData();
ADCINCVR_1_ClearFlag();
if(iData < 140)
{........}
else
{........}
}
}
}

The ADCINCVR Dataformat is set to unsigned.
I've also set the ADCINCVR Calc Time to 248.
Is there a problem with the program i've written or the settings I've done?]]>
Sun, 21 Feb 2010 21:42:02 -0600
Re: ADCINCVR http://www.cypress.com/?rID=41935
On the other hand, when the Timer Interrupt occurs, if the processor is busy with the ADC's interrupt, then the Timer's interrupt will be serviced only after the ADC's interrupt is completed. So, this will result in some interrupt latency which may reflect on the output sine wave. The worst case interrupt latency would be 180 CPU cycles. Place the Timer in a higher row than the ADC's digital blocks. This will place the Timer in a higher interrupt priority and will ensure that the Timer ISR executes first when both ADC and Timer interrupts are pending.]]>
Mon, 08 Feb 2010 20:24:08 -0600
Re: ADCINCVR http://www.cypress.com/?rID=41934 Thank you for the reply.

Maybe i should give more information about the DAC.
I've been working on the DAC to produce the sinewave from the example project recommanded from the previous tread "Sinewave generator".

The example project seems to use the 16BIT Counter to generate a global interrupt to trigger the ISR where instructions for the DAC to pick the relevant value from the lookup table and output the value resides.

If I'm to add in the ADCINCVR into the project, will the UM blocks from the ADCINCVR and the 16BIT Counter for the DAC effect each other's operation via the Global interrupt?

If a zero value is used in the ADC_GetSample function the ADC will get samples continueously. What will other value useds in the function prompt the function to do?

Last question...What value is to put in the CalcTime parameter for the ADCINCVR?
Isn't the CalcTime parameter for the ADCINCVR approximately 180 CPU cycles?
Must I convert the the 180 CPU cycles to Dataclock Cycles and input the parameter as DataClk cycles?]]>
Mon, 08 Feb 2010 18:34:55 -0600
Re: ADCINCVR http://www.cypress.com/?rID=41933
You can connect some of the Port2 pins directly to the ADC without having to go through the CT blocks. Depending on the SC block where you place your ADC, the direct Port2 connection varies. You can check the availability of the Port2 pin by clicking on the Input parameter of the ADC.

The InitDispatchMode parameter only applies to dynamic reconfiguration. If you are not using dynamic reconfiguration, then this parameter has no relevance to the ADC.]]>
Mon, 08 Feb 2010 06:09:35 -0600
Re: ADCINCVR http://www.cypress.com/?rID=41932
Is there another way to connect the package input to the ADCINCVR input?

If I'm using a REFMUX to get port[0]7 to input to the ADCINCVR input, what do i configure for the REF input of the REFMUX?

If i'm using a DAC and the ADCINCVR at the same time, do i configure both UM's IntDispatchMode to "OffsetPreCalc"?]]>
Sat, 06 Feb 2010 02:15:42 -0600
Re: ADCINCVR http://www.cypress.com/?rID=41931 Thanks for the confirmation.

Another thing about ADCINCVR....
Can the ADC work without using the ADCINCVR_GetSample API?
When the ADCINCVR_GetSample API is in use, the global interrupt is uitilise.
If a DAC incorprated in the microprocessor also uses the globel interrupt to execute a ISR, will the ADC trigger the ISR also via the ADCINCVR_GetSample API?]]>
Fri, 05 Feb 2010 07:23:02 -0600
Re: ADCINCVR http://www.cypress.com/?rID=41930
The units are:
Sampling Rate = Samples Per Second
Data Clock = Hz
CalcTime = No. of Data Clocks]]>
Thu, 04 Feb 2010 16:34:28 -0600