Jump to content
43oh

CC3200 timers using energia


Recommended Posts

I have modified the code and now the zero crossing interrupt is occurring.But the timer is still not functioning.Can anyone see and tell whether I have configured it right?

#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_timer.h"
#include "inc/hw_types.h"
#include "debug.h"
#include "interrupt.h"
#include "timer.h"
#include "driverlib/prcm.h"
#include "inc/hw_gprcm.h"
#include "wiring_private.h"
#include "driverlib/rom_map.h"
#include "driverlib/pin.h"

void setup()
{
pinMode(2,INPUT_PULLUP);
pinMode(4,OUTPUT);
noInterrupts();
MAP_PRCMPeripheralClkEnable(PRCM_TIMERA0,PRCM_RUN_MODE_CLK);
MAP_PRCMPeripheralReset(PRCM_TIMERA0);
MAP_TimerConfigure(TIMERA0_BASE,TIMER_CFG_B_PERIODIC_UP);
MAP_TimerIntRegister(TIMERA0_BASE,TIMER_B,start);
MAP_TimerIntEnable(TIMERA0_BASE,TIMER_TIMB_MATCH);
MAP_TimerPrescaleSet(TIMERA0_BASE,TIMER_B,32);
MAP_TimerMatchSet(TIMERA0_BASE,TIMER_B,7500);
MAP_TimerLoadSet(TIMERA0_BASE,TIMER_B,0);
MAP_TimerEnable(TIMERA0_BASE,TIMER_B );
attachInterrupt(2,zeroCrossingInterrupt, RISING);
interrupts();
Serial.begin(9600);
}


void loop()
{
}

void zeroCrossingInterrupt()

digitalWrite(4,LOW);
MAP_TimerLoadSet(TIMERA0_BASE,TIMER_B,0);
MAP_TimerEnable(TIMERA0_BASE,TIMER_B );
Serial.println("0k");
}

void start()

digitalWrite(4,HIGH);
MAP_TimerIntClear(TIMERA0_BASE,TIMER_TIMB_MATCH);
MAP_TimerIntDisable(TIMERA0_BASE,TIMER_TIMB_MATCH);
MAP_TimerDisable(TIMERA0_BASE,TIMER_B );

Serial.println("hi");

}

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...