Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sine function on 16-bit microcontroller

I need to generate a sine wave to fill a char table of size 1024. The word size on the microcontroller is 16-bit and floating-point operations are not available.

The sine wave itself will oscillate between the value of 0 to 255, with 127 being the center point.

Any ideas?

like image 771
sj755 Avatar asked Dec 12 '22 07:12

sj755


1 Answers

You only actually need to store one quarter of the sine wave -- you can lookup the other three quarters from the first quadrant. So you only need 256 bytes.

To generate the values on the micro controller, implement CORDIC. You can store one value, and generate the whole sine wave from that.

like image 60
Anthony Blake Avatar answered Jan 18 '23 07:01

Anthony Blake