REM sine11.bas - a program to generate a sine wave table for tone generation REM REM Table is output to a file in a format which can be inserted or included REM into the tone generator PIC program. REM Table is 8 bit - 64 entries - starts at midscale (128) REM REM 12/28/99 Chuck Olson, WB9KZY REM Jackson Harbor Press REM http://jacksonharbor.home.att.net/ REM jacksonharbor@att.net INPUT "Enter sine table output filename: "; n$ OPEN n$ FOR OUTPUT AS #1 REM This is a 64 entry table FOR i = 0 TO 63 REM Calculate the sine value for the "angle" (i/64) z = SIN(2 * i * 3.14159 / 64) REM Scale the sine value from a -1 to +1 range to a 0 to 255 (8 bit) range y = CINT((z + 1) * 127.5) REM "print" the results to a file in the retlw table format. REM retlw is a return from a subroutine call with the value specified REM in the w register. PRINT #1, " retlw "; y; ";"; i, z NEXT i CLOSE