Post here first, or if you can't find a relevant section!
- Posts: 5
- Joined: Wed Jan 04, 2017 1:09 pm
I have an old project on a Arduino Mega and i used those interupts bellow
can somebody please , help me translate it for STM32F1 i am having a hard time to understand what i have to do
Code: Select all
Initialize Amega registers
TCCR1A = 0;
// Enable timer1. ICES0 is set to 0 for falling edge detection on input pin.
TCCR1B = _BV(CS10);
// Enable input interrupt
TIMSK1 |= _BV(ICIE1);
// Enable external interrupt INT0 on pin 2 with falling edge.
EIMSK = _BV(INT0);
EICRA = _BV(ISC01);
i guess for a start i have to #include <libmaple/bitband.h>
- Posts: 1422
- Joined: Wed Jul 08, 2015 2:09 pm
- Location: St Annes, Lancs,UK
what it does is in the comments
immediate assignments are most likely set up values
look up the names in the atmegaxxxx datasheet & reference manual
look for equivalent in the stm32f1xxx datasheet & reference manual
search for how to use stm32f1 timers with google & on github
just as i'd do.
- Posts: 140
- Joined: Wed May 11, 2016 4:29 pm
1) take out the datasheet, set / clear the bits for each of the registers and figure out what the module is doing. looks like it is enabling input capture interrupt 1 -> so take a look at the associated isr;
2) then go to your target chip and see how you would enable input capture interrupt and code the isr in a similar fashion.