How to use Filter Polling method for channel A and channel B?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hello Every One,

   

I am trying to implement polling method for channel A and channel B of my filter.

   

I am following and example project. This project is written for Channel A only. I have some confusion in it. I wrote the following code for channel A and B. Kindly tell me if am i am doing it write:

   

I am doing the following:

   

ADC---->Filter---->DAC.

   

Code:

   


#include <device.h>
#include <VDAC8.h>
#include <math.h>
#include <stdio.h>
    
void DMA_ADC_ChA_Config(void);

   

void DMA_ADC_ChB_Config(void);

   

int main()
{

   

 ADC_ChA_Start();
    ADC_ChA_IRQ_Start();
    ADC_ChA_StartConvert();
    ADC_ChB_Start();
    ADC_ChB_IRQ_Start();
    ADC_ChB_StartConvert();
    VDAC_ChA_Start();
    VDAC_ChB_Start();
    Filter_Start();
     Filter_INT_CTRL_REG |= (1 << Filter_CHANNEL_A);
     Filter_INT_CTRL_REG |= (2 << Filter_CHANNEL_B); (IS THIS COMMAND IS CORRECT FOR CHANNEL B?)

   

DMA_ADC_ChA_Config();
   
    DMA_ADC_ChB_Config();

   


    /* Enable Global Interrupts */
    CYGlobalIntEnable;

   

for(;;)
    {
       
        while (Filter_IsInterruptChannelA() == 0) ;
        VDAC_ChA_SetValue(Filter_Read8(Filter_CHANNEL_A) + 128u);

   

        while (Filter_IsInterruptChannelB() == 0);
        VDAC_ChB_SetValue(Filter_Read8(Filter_CHANNEL_B) + 128u);
    }
} /* End of main

   

 

   

Looking forward for your reply.

   

Awais

0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Do not use "while", this can skip a result in the other channel. Use if(Filter_IsInterruptChannelA() )

   

Do not forget to remove/disable your interrupt component.

   

 

   

Bob

View solution in original post

0 Likes
3 Replies