I’m a little confused as to how to use this module.
i am trying to use the timer/counter for the the module to count external pulses.
If i was using registers to access it on a mainboard in c# it would look something like this
Register SYSAHBCLKCTRL = new Register(0x40048080);
SYSAHBCLKCTRL.SetBits(1 << 7);//enable timer b0
// Select PIO0_2 /CT16B0_CAP0
Register PINSEL0_2 = new Register(0x40044000);
PINSEL0_2.SetBits((3 << 0));//set bits 0 and 1 ---- enable pin
// System AHB clock divider register
Register AHB = new Register(0x40048078);
AHB.SetBits((1 << 0));//set bits 0 and 1 ---- enable pin
Register T0CTCR = new Register(0x4000C070);
T0CTCR.Write(2 << 0 | 0 << 2);//count on falling edge and use CAP0.
// To enable timer/counter
Register T0TCR = new Register(0x4000C000 + 0x004);
T0TCR.SetBits(1 << 0);
// set prescale to 0
Register T0PR = new Register(0x4000C000 + 0x00C);
T0PR.Write(0);
// should be 0 for a counter
Register T0CCR = new Register(0x4000C000 + 0x028);
T0CCR.ClearBits(0x07);
// Don't do anything on match
Register T0MCR = new Register(0x4000C000 + 0x014);
T0MCR.Write(0);
// To start the counter
T0TCR.SetBits((1 << 1));
T0TCR.ClearBits((1 << 1));
// To read
Register T0TC = new Register(0x4000C000 + 0x008);
while (true)
{
uint count = T0TC.Read();
Debug.Print("Total count: " + count);
T0TCR.SetBits((1 << 1));
T0TCR.ClearBits((1 << 1));
Thread.Sleep(1000);
}
Can I implement this just using the generic daisylink already on board of the DL40?
If so how?
If not do i need to change the firmware to do this?
if so would I just need to modify the DL40.c file in Keil?