Search found 4914 matches
- Thu Feb 12, 2015 4:48 pm
- Forum: General Discussion and Questions
- Topic: Use of timer.deinit()
- Replies: 6
- Views: 3760
Re: Use of timer.deinit()
The docs https://micropython.org/doc/module/pyb/Timer do indeed state that it "stops the timer" and this doesn't happen as far as I can see. I suggest you file an issue on github.
- Thu Feb 12, 2015 4:38 pm
- Forum: General Discussion and Questions
- Topic: max reasonable timer callback frequency?
- Replies: 10
- Views: 4943
Re: max reasonable timer callback frequency?
This looks promising as a basis, churning out a 40KHz square wave modulated at 500Hz: import pyb import micropython micropython.alloc_emergency_exception_buf(100) toggle = False timer = pyb.Timer(2, freq=40000) ch2 = timer.channel(2, pyb.Timer.PWM, pin=pyb.Pin.board.X2, pulse_width_percent=50) def c...
- Thu Feb 12, 2015 3:37 pm
- Forum: General Discussion and Questions
- Topic: Digital filter and assembler code examples
- Replies: 17
- Views: 6730
- Thu Feb 12, 2015 11:35 am
- Forum: General Discussion and Questions
- Topic: Digital filter and assembler code examples
- Replies: 17
- Views: 6730
Digital filter and assembler code examples
I've posted some code here https://github.com/peterhinch/micropython-filters.git with implementations of moving average and FIR (finite impulse response) functions written in ARM assembler. These are intended for use in interrupt callbacks to handle real time integer data from the ADC's or transduce...
- Thu Feb 12, 2015 8:40 am
- Forum: General Discussion and Questions
- Topic: max reasonable timer callback frequency?
- Replies: 10
- Views: 4943
Re: max reasonable timer callback frequency?
I doubt you'll get a callback running that fast. I think you may be able to achieve results using two timers. If you can configure one to flash the LED at 40KHz without using a callback - look at PWM and timer channels - then use the second to gate it on and off, The second only needs to operate at ...
- Wed Feb 11, 2015 9:41 am
- Forum: General Discussion and Questions
- Topic: Inline assembler advice requested
- Replies: 2
- Views: 1546
Re: Inline assembler advice requested
Thanks, Damien. Doubtless a safer fix than pigging about with r13. I've now found the doc that explains the coding and have coded some other unimplemented instructions, including SDIV and UDIV. For anyone following this, search for "armv7-m architecture reference manual". Machine code. Takes me back...
- Tue Feb 10, 2015 5:57 pm
- Forum: General Discussion and Questions
- Topic: Inline assembler advice requested
- Replies: 2
- Views: 1546
Inline assembler advice requested
This follows on from the issue I raised on Github. https://github.com/micropython/micropython/issues/1111 It seems that registers above r7 aren't safe to use so the question is how to proceed when you run out of registers. One solution is to push registers onto the stack; alas the STFMFD and LDFMFD ...
- Mon Feb 09, 2015 8:45 am
- Forum: General Discussion and Questions
- Topic: Bug in the pyb.Timer's callback or a user mistake
- Replies: 6
- Views: 3334
Re: Bug in the pyb.Timer's callback or a user mistake
That's how timers work. They count up to a value determined by the desired frequency, then they reset to zero and the callback function is called. So your callback will always output zero, apart from the first instance. The timer appears to invoke the callback once at the moment it's assigned to it....
- Sun Feb 08, 2015 4:54 pm
- Forum: Development of MicroPython
- Topic: Micro Python development wish list
- Replies: 52
- Views: 27086
Micro Python development wish list: Asm enhancement
Can I suggest a few minor enhancements to the support for inline assembler? Primarily I'd like to see SDIV and UDIV instructions implemented. But it would also be handy to have CLZ (count leading zeros) and RBIT (reverse bits) as these are tedious to do in code. One application for assembler is for ...
- Tue Feb 03, 2015 5:59 pm
- Forum: Hardware Projects
- Topic: MicroPython live
- Replies: 8
- Views: 5703