Search found 66 matches

by rkompass
Mon Jul 11, 2022 12:45 am
Forum: MicroPython pyboard
Topic: 16 x 2 LCD
Replies: 5
Views: 29916

Re: 16 x 2 LCD

We had it several times here in the forum: Don't forget to turn the brightness poti up (or down, I forgot). The first time I used this display it seemed to display nothing, just because I did not know that.
by rkompass
Sun Jul 10, 2022 8:56 am
Forum: MicroPython pyboard
Topic: 16 x 2 LCD
Replies: 5
Views: 29916

Re: 16 x 2 LCD

Perhaps the difficulty is to select the two matching files from dhylands site. I preferred to have one file and thus put the two into one, also removed the const() definitions and found that the memory consumption in the end was much reduced. So if you prefer this modification put lcd_i2c8574.py ont...
by rkompass
Fri Jul 08, 2022 7:59 pm
Forum: Raspberry Pi microcontroller boards
Topic: possible bug with viper code in class
Replies: 12
Views: 5207

Re: possible bug with viper code in class

Thank you jimmo, that was fast:-) After compiling it in I can confirm it works. I had a look at Peters example code pieces again and tested and found: The (Damiens) workaround is still needed. I repeat the code: def foo(): x : int = 0 @micropython.viper def inner() -> int: nonlocal x q : int = int(x...
by rkompass
Thu Jul 07, 2022 2:07 pm
Forum: Raspberry Pi microcontroller boards
Topic: possible bug with viper code in class
Replies: 12
Views: 5207

Re: possible bug with viper code in class

Hello SilverBullet, I could reproduce the Bug. Also on Blackpill with MicroPython v1.18-121-gd8a7bf83c. But with slight difference: If the __init(self)__ method has the @micropython.viper decorator the exception is raised already in the class instantiation (foo = Foo()). If only bar(self) has this d...
by rkompass
Tue Jul 05, 2022 6:41 am
Forum: Programs, Libraries and Tools
Topic: read / write png files
Replies: 7
Views: 3817

Re: read / write png files

Just out of curiosity:
Did you try to comment out the Writer class?
by rkompass
Sun Jun 19, 2022 9:38 pm
Forum: Raspberry Pi microcontroller boards
Topic: PIO program for probing quadrature encoders
Replies: 0
Views: 10392

PIO program for probing quadrature encoders

Hello, I present a quadrature code generator that is intended for probing different quadrature encoder approaches. Therefore it generates the quadrature code with options to simulate contract bouncing. It is written in RPi2040 Pio code for maximum autonomy, self-starting after a specified delay. Hop...
by rkompass
Tue Jun 14, 2022 5:28 pm
Forum: General Discussion and Questions
Topic: Assembler: rbit not working?
Replies: 10
Views: 2695

Re: Assembler: rbit not working?

I agree. The viperized version of rbit16 takes 4182 ns in total, 2971 ns being used just for the function call (RPi2040, 125 MHz). The 1211 ns for processing are thus almost optimal. I found a program to inspect the assembled code at dhylands site. My adapted version is here, together with the viper...
by rkompass
Mon Jun 13, 2022 8:16 pm
Forum: General Discussion and Questions
Topic: Assembler: rbit not working?
Replies: 10
Views: 2695

Re: Assembler: rbit not working?

I made an assembler version of Peters code: @micropython.asm_thumb def rbit16_asm(r0) -> int: # v = (v & 0x00ff) << 8 | (v & 0xff00) >> 8 mov(r1, r0) # v mov(r4, 0x08) mov(r2, 0xff) and_(r1, r2) # v & 0x00ff lsl(r1, r4) # (v & 0x00ff) << 8 lsl(r2, r4) # movw(r2, 0xff00) and_(r0, r2) # v & 0xff00 lsr...
by rkompass
Sat Jun 11, 2022 7:31 pm
Forum: General Discussion and Questions
Topic: Fast/efficient alternative to bytearray.index()?
Replies: 18
Views: 9234

Re: Fast/efficient alternative to bytearray.index()?

Hello Martincho and Peter, the last time I got somewhat deeper involved with assembler was on a Z-80 self-built machine, which 2 KB Rom, 2 KB Ram and 1 KB of text-based TV output. I managed to program a sieve of Eratosthenes and was impressed how fast (quite immediately) the primes appeared on the s...
by rkompass
Fri Jun 10, 2022 7:24 pm
Forum: General Discussion and Questions
Topic: Fast/efficient alternative to bytearray.index()?
Replies: 18
Views: 9234

Re: Fast/efficient alternative to bytearray.index()?

Hello martincho, thank you. Nice stuff, I enjoyed reading the code and learnt a bit too. The last asm_thumb code appears quite optimal to me. The timing of one search should be in us, because you have 1000 iterations. So we have 27 us. That is not only the assembler but also the iteration in uPy. Wi...