Timer programming info for DA series

Go To Last Post
9 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm looking through the datasheet but I'm a bit lost on how I'm supposed to program and set up the timers.  I don't see register descriptions in the DA like the older series had.

 

I quite like these new units so far.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

chriscalandro wrote:
I'm looking through the datasheet

Which data sheet is that, there is now more then one DS, the family DS and the specific part DS.

There are also app notes and example code on github.

 

Jim

Edit: sorry, looks like just the preliminary DS is available for these.

 

Keys to wealth:

Invest for cash flow, not capital gains!

Wealth is attracted, not chased! 

Income is proportional to how many you serve!

Lets go Brandon!

Last Edited: Mon. Jan 18, 2021 - 08:43 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The github example for what I'm try to do doesn't seem to exist yet.  Maybe I just have the wrong datasheet?  I'm using whatever one pops up when you open it from the device in what is now "Microchip Studio"

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

https://www.microchip.com/wwwpro...

click on Documents tab, look for "Getting started with TCn" notes.

If this is not your chip, select that first.

Jim

 

 

Keys to wealth:

Invest for cash flow, not capital gains!

Wealth is attracted, not chased! 

Income is proportional to how many you serve!

Lets go Brandon!

Last Edited: Mon. Jan 18, 2021 - 08:40 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think this is what I want to do.

TCB0.CTRLA = (!(TCB_CLKSEL0_bm | TCB_CLKSEL1_bm | TCB_CLKSEL2_bm));

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

>I don't see register descriptions in the DA like the older series had.

 

Find the TCB chapter, and like all other peripherals in the datasheet, they have a register summary at the end of the peripheral chapter, then a detailed register description of each register after that.

 

 

For a DA, you have 3-5 TCB instances depending on pin package.

 

TCB0.CTRLA = 1; //enable = 1, clk=CLK_PER (cpu clock div1)

 

you now have a running TCB0 timer

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Attached is an excel spreadsheet I generated from the atdf file.  It shows some of the registers and bit masks.  It might be helpful.

(I have not tried to tune my script to deal with the Dx series yet.)

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

chriscalandro wrote:

I think this is what I want to do.

TCB0.CTRLA = (!(TCB_CLKSEL0_bm | TCB_CLKSEL1_bm | TCB_CLKSEL2_bm));

 

The expression !x only generates 0 or 1.  Did you mean ~x (i.e., ones complement)?

You probably want maybe TCB0.CTRLA =  TCB_CLKSEL_DIV1_gc ?

Last Edited: Mon. Jan 18, 2021 - 10:16 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have several examples in sysTime.c at https://github.com/CmdrZin/chips...

"If you find yourself in an even battle, you didn't plan very well."
https://www.gameactive.org
https://github.com/CmdrZin