- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Solved! Go to Solution.
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thankyou for your reply.
Yes i used "if command".
Also for channel B: Filter_INT_CTRL_REG |= (2 << Filter_CHANNEL_B); is this command is correct? I didnt find enough explanation about this command.
Awais
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No, do a Filter_INT_CTRL_REG |= 0x03 to enable channel A and B.
Filter_INT_CTRL_REG |= (1 << Filter_CHANNEL_B); might work, but "ich hab keine Lust nachzusehen, mach Du das" 😉
Bob