/******************************************************************************
**   Main Function  main()
******************************************************************************/
int main (void)
{
  /* SystemClockUpdate() updates the SystemFrequency variable */
  SystemClockUpdate(); //SystemFrequency = 72000000 by default
  Systick_Init();      //10 ms de bir tick atacak sekilde Systick i baslat

  Gpio_Config();       //Beacon MCU da kullanilacak pinleri konfigure et

  ADF7021_CHIP_POWER_DOWN;        //CE pini asagi cek
  Delay_ms(10);
  ADF7021_LOAD_REGISTER_DISABLE;  //LE pinini yukari cek, load register disable olsun
  Delay_ms(10);
  ADF7021_CHIP_POWER_UP;          //CE pinini yukari cek, ADF7012 enable olsun
  Delay_ms(10);

  SSP1Init();			          // SSP1 portunda SPI konusalim*/
  DACInit();                      // 1.2kHz ve 2kHz sinus olusturmak icin DAC peripheral i baslatalim
  Delay_ms(10);

  Init_Adf7012();                 //Adf7012 registerlarini istedigimiz konfigurasyonda yazalim
  Init_Timer(10);                 //10us intervalinde timer0 baslat
  Enable_Timer();                 //Timer0 enable et


  while ( 1 );                    //main de yapilacak is kalmadi bundan sonra isr lerle devam edecegiz
  return 0;
}
int main (void) {

	uint8_t data = 0;
    uint32_t len = 0;

    //SystemClockUpdate();
    SystemCoreClockUpdate();

    init_i2c();
    uart2_init(115200, CHANNEL_A);		// Control de flujo: NINGUNO
    DACInit();

    uart2_sendString((uint8_t*)"\r\nModulador PSK\r\n");

    while (1) {
    	len = uart2_receive(&data, 1, FALSE);
        if (len > 0) {
                uart2_send(&data, 1);
                procesarBytes(data);
        }
        Timer0_Wait(50);

    }

}
Beispiel #3
0
/*****************************************************************************
**   Main Function  main()
******************************************************************************/
int main (void)
{
  uint32_t i = 0;
  volatile uint32_t regVal;
#if DAC_DMA_ENABLED
  uint32_t *src_addr;
#else
  uint32_t m;
#endif

  /* SystemClockUpdate() updates the SystemFrequency variable */
  SystemClockUpdate();

  /* Initialize DAC  */
  DACInit();

#if DAC_DMA_ENABLED
  src_addr  = (uint32_t *)DMA_SRC;
  /* Fill the pattern in the DMA source memory */
  for ( i = 0; i < DATA_LENGTH; i++ )
  {
	*src_addr = (uint32_t)((i<<6)|(DAC_BIAS));	/* pre format the data to DACR register */
	src_addr++;	
  }
  
  DMA_Init();

  /* on DMA channel 0, source is memory, Destination is DAC */
  /* Enable channel and IE bit */
  DMAChannel_Init( 0, M2P ); 
  LPC_DAC->CTRL |= (0x1<<3);	/* DMA enabled on DAC */

  LPC_GPDMACH0->CConfig = 0xC001|(0x00<<1)|(DMA_DAC<<6)|(0x01<<11);
  while ( 1 )
  {
	/* Wait for DMA0 to finish. */
	while ( !DACDMA0Done );
	DACDMA0Done = 0;
	DMAChannel_Init( 0, M2P ); 
	/* Set TC int mask, channel enabled, src peripheral is memory(0x0), 
	dst peripheral is DAC(9), and transfer type is the M2P(1) */
	LPC_GPDMACH0->CConfig = 0xC001|(0x00<<1)|(DMA_DAC<<6)|(0x01<<11);
	/* During the DMA transfer, a saw wave should be seen on the scope. */
  }
#else
  while ( 1 )
  {
	LPC_DAC->CR = (i << 6) | DAC_BIAS;
	i++;
	for(m = 1000; m > 1; m--);
	if ( i == DATA_LENGTH )
	{
	  i = 0;
	}
  }
#endif
}
Beispiel #4
0
void JERRYInit(void)
{
   JoystickInit();
   memcpy(&jerry_ram_8[0xD000], waveTableROM, 0x1000);

   JERRYPIT1Prescaler = 0xFFFF;
   JERRYPIT2Prescaler = 0xFFFF;
   JERRYPIT1Divider = 0xFFFF;
   JERRYPIT2Divider = 0xFFFF;
   jerryInterruptMask = 0x0000;
   jerryPendingInterrupt = 0x0000;

   DACInit();
}
Beispiel #5
0
int main(void)
{

	/* perform the needed initialization here */
	LEDsInit();
	Tec1Init();
	Tec2Init();
	Tec3Init();
	Tec4Init();
	ADCInit();
	DACInit();
	UARTInit();
	TimerInit(100);

	for(;;)
	{
		if(LeerTec1()==0)
		{
			A += 0.1;
			UARTSendString(msj1);

		}

		if(LeerTec2()==0)
		{
			A -= 0.1;
			UARTSendString(msj2);
		}

		if(LeerTec3()==0)
		{
			A = 0;
			UARTSendString(msj3);
		}

		if(LeerTec4()==0)
		{
			UARTSendString(msj4);
		}

	}

         return 0;
}
/*****************************************************************************
**   Main Function  main()
******************************************************************************/
int main (void)
{
	uint32_t i = 0;
	volatile uint32_t delay_counter;

	//SystemInit(); //Called by startup code

	/* Initialize DAC  */
	DACInit();

	while ( 1 )
	{
		for(delay_counter = 1000; delay_counter > 1; delay_counter--);
		LPC_DAC->DACR = ((i&0x3FF) << 6) | DAC_BIAS;
		if ( i++ > 1023 )
		{
			i = 0;
		}
	}
}
Beispiel #7
0
//*****************************************************************************
//
//! Initialize the sound driver.
//!
//! This function initializes the audio hardware components of the EVALBOT,
//! in preparation for playing sounds using the sound driver.
//!
//! \return None.
//
//*****************************************************************************
void
SoundInit(void)
{
    //
    // Set the current active buffer to zero.
    //
    g_ulPlaying = 0;

    //
    // Enable and reset the peripheral.
    //
    SysCtlPeripheralEnable(SYSCTL_PERIPH_I2S0);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);

    //
    // Set up the pin mux.
    //
    GPIOPinConfigure(GPIO_PB6_I2S0TXSCK);
    GPIOPinConfigure(GPIO_PE4_I2S0TXWS);
    GPIOPinConfigure(GPIO_PE5_I2S0TXSD);
    GPIOPinConfigure(GPIO_PF1_I2S0TXMCLK);

    //
    // Select alternate functions for all of the I2S pins.
    //
    SysCtlPeripheralEnable(I2S0_SCLKTX_PERIPH);
    GPIOPinTypeI2S(I2S0_SCLKTX_PORT, I2S0_SCLKTX_PIN);

    SysCtlPeripheralEnable(I2S0_MCLKTX_PERIPH);
    GPIOPinTypeI2S(I2S0_MCLKTX_PORT, I2S0_MCLKTX_PIN);

    SysCtlPeripheralEnable(I2S0_LRCTX_PERIPH);
    GPIOPinTypeI2S(I2S0_LRCTX_PORT, I2S0_LRCTX_PIN);

    SysCtlPeripheralEnable(I2S0_SDATX_PERIPH);
    GPIOPinTypeI2S(I2S0_SDATX_PORT, I2S0_SDATX_PIN);

    //
    // Set up the DMA.
    //
    uDMAControlBaseSet(&DMAControlTable[0]);
    uDMAEnable();

    //
    // Initialize the DAC.
    //
    DACInit();

    //
    // Set the FIFO trigger limit
    //
    I2STxFIFOLimitSet(I2S0_BASE, 4);

    //
    // Clear out all pending interrupts.
    //
    I2SIntClear(I2S0_BASE, I2S_INT_TXERR | I2S_INT_TXREQ );

    //
    // Disable all uDMA attributes.
    //
    uDMAChannelAttributeDisable(UDMA_CHANNEL_I2S0TX, UDMA_ATTR_ALL);

    //
    // Enable the I2S Tx controller.
    //
    I2STxEnable(I2S0_BASE);
}