.(ex: =x*22/14-47/21249*x^2-7*x^3/(2^16) with x in binary radians has an error of about 1.7%, assuming I can implement it without being killed time-wise with DIV32)
on a esp8266 @ 160mhz clk or a esp32 , pic16fxx never
.(ex: =x*22/14-47/21249*x^2-7*x^3/(2^16) with x in binary radians has an error of about 1.7%, assuming I can implement it without being killed time-wise with DIV32)
on a esp8266 @ 160mhz clk or a esp32 , pic16fxx never
Warning I'm not a teacher
16Fxx isn't the best choiceaudio tones up to 10kHz on a 16Fxx architecture with a 20Mhz OSC
For comparison:
16Fxx @ 20MHz executes instructions at 5 MIPS,
16F1xxxx @ 32MHz -> 8 MIPS,
18F @ 64MHz -> 16 MIPS
Looking back at your original pseudo code with lookup table SINB array in ram:
On a PIC18F @ 64MHz this executes in 1us/loop (1MHz update rate)Code:loop1: lookbyte=timebyte and 31 ampvar=SINB(lookbyte) PORTB=ampvar timebyte=timebyte+1 goto loop1
If you put the SINB table in ROM (which is more likely) it slows down to 1.25us/loop (800KHz update rate)
I didn't do those evaluations using PBP, so I don't know if it's much slower than that.
Last edited by tumbleweed; - 24th April 2020 at 11:18.
a 16f648a@20mhz just passes 8khz with a 32 step lu in asm for a 4 bit r2r ladder on portb
my lu values may be dodgy i just guessed them, result looks awful @ any freq
Code:#CONFIG __config _INTOSC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_OFF & _MCLRE_ON & _BODEN_ON & _LVP_OFF & _DATA_CP_OFF & _CP_OFF #ENDCONFIG DEFINE OSC 20 inx var byte bank0 trisb=%11110000 goto overasm asm table addwf PCL, F retlw 8 retlw 9 retlw 10 retlw 11 retlw 12 retlw 13 retlw 14 retlw 14 retlw 15 retlw 14 retlw 14 retlw 13 retlw 12 retlw 11 retlw 10 retlw 9 retlw 8 retlw 6 retlw 5 retlw 4 retlw 3 retlw 2 retlw 1 retlw 1 retlw 0 retlw 1 retlw 1 retlw 2 retlw 3 retlw 4 retlw 5 retlw 6 _lu movf _inx ,w call table MOVE?AB PORTB RETURN ENDASM overasm: inx=0 loopp: CALL lu inx=inx+1 inx =inx&31 goto loopp
Warning I'm not a teacher
There is another approach. Check this video.
https://www.youtube.com/watch?v=ophqt_RmiS0
Code in description.
This guy has done unbelievable things with low end PIC and also a color video game with multi channel sound and VGA output on a PIC18F2550!
http://pic24.ru/doku.php/en/osa/articles/vga_game
Using an RTOS...
Ioannis
Yeah, in his creations, 16F690 outperforms some guys with RPI![]()
I dare to say that he is a Case Study! Wish I was proficient in C to run through his code.
Ioannis
Bookmarks