/******************************************************************************* * Function Name: WaveDAC8_1_StartEx ******************************************************************************** * * Summary: * The StartEx function sets pointers and sizes for both waveforms * and then starts the component. * * Parameters: * uint8 * wavePtr1: Pointer to the waveform 1 array. * uint16 sampleSize1: The amount of samples in the waveform 1. * uint8 * wavePtr2: Pointer to the waveform 2 array. * uint16 sampleSize2: The amount of samples in the waveform 2. * * Return: * None * * Reentrant: * No * *******************************************************************************/ void WaveDAC8_1_StartEx(const uint8 * wavePtr1, uint16 sampleSize1, const uint8 * wavePtr2, uint16 sampleSize2) { WaveDAC8_1_Wave1Setup(wavePtr1, sampleSize1); WaveDAC8_1_Wave2Setup(wavePtr2, sampleSize2); WaveDAC8_1_Start(); }
int main() { CyGlobalIntEnable; /* Enable global interrupts. */ /* Place your initialization/startup code here (e.g. MyInst_Start()) */ WaveDAC8_1_Start(); for(;;) { /* Place your application code here. */ if (Button_Pin_Read() == 0) { Control_Reg_1_Write(0); } else { Control_Reg_1_Write(1); } } }
int main() { Counter_1_Start(); Counter_2_Start(); QuadDec1_Start(); QuadDec2_Start(); QuadDec3_Start(); LCD_Char1_Start(); LCD_Char1_DisplayOn(); LCD_Char1_Enable(); LCD_Char1_PrintString("B.E.A.R. Con. v2.0"); CyDelay(2000); PWM_Start(); WaveDAC8_1_Start(); WaveDAC8_2_Start(); //double baseFreq=500; setFrequency0(500.0+offsetFreq); QuadDec1_SetCounter(500.0*10); setFrequency1(500.0+offsetFreq); QuadDec2_SetCounter(500.0*10); //setFrequency3(1.0); int16 quadCount1=0; int16 oldQCount1=0; int16 quadCount2=0; int16 oldQCount2=0; int16 quadCount3=0; int16 oldQCount3=0; QuadDec3_SetCounter(43); updateDisplay(); for (;;) { quadCount1=QuadDec1_GetCounter(); if (quadCount1!=oldQCount1) { if (CoarsePIN_Read()==0) //rapid tune pressed { int theDifference=quadCount1-oldQCount1; if (theDifference<0) quadCount1=quadCount1-10; else quadCount1=quadCount1+10; QuadDec1_SetCounter(quadCount1); } double newFreq=(((double)(quadCount1))/10); setFrequency0(newFreq+offsetFreq); oldQCount1=quadCount1; leftFreq=newFreq; updateDisplay(); updateLED(); } quadCount2=QuadDec2_GetCounter(); if (quadCount2!=oldQCount2) { if (CoarsePIN_Read()==0) //rapid tune pressed { int theDifference=quadCount2-oldQCount2; if (theDifference<0) quadCount2=quadCount2-10; else quadCount2=quadCount2+10; QuadDec2_SetCounter(quadCount2); } double newFreq=(((double)(quadCount2))/10); setFrequency1(newFreq+offsetFreq); oldQCount2=quadCount2; rightFreq=newFreq; updateDisplay(); updateLED(); } quadCount3=QuadDec3_GetCounter(); if (quadCount3!=oldQCount3) { double newFreq=(((double)(quadCount3))/10); offsetFreq=newFreq; oldQCount3=quadCount3; newFreq= (((double)(oldQCount1))/10); setFrequency0(newFreq+offsetFreq); newFreq= (((double)(oldQCount2))/10); setFrequency1(newFreq+offsetFreq); updateDisplay(); updateLED(); } } }