From: Tobias Girstmair Date: Tue, 27 Apr 2021 08:15:07 +0000 (+0200) Subject: increase PWM frequency to 64kHz X-Git-Url: https://git.gir.st/Chiptunes-pms150c.git/commitdiff_plain/82fa1697cabbd9d3cea5efce931e109660490796 increase PWM frequency to 64kHz audio is still borked, though --- diff --git a/bsv.asm b/bsv.asm index f31ee13..8a73ba5 100644 --- a/bsv.asm +++ b/bsv.asm @@ -236,14 +236,13 @@ init: ; to the PWM frequency, we can use a much faster clock for PWM. The ; highest "carrier frequency" for the PCM samples we can generate is by ; setting Timer2 to 6 bit, (IHRC/1)/1 mode, giving a frequency of - ; (4*4.096MHz)/2^6 = 256kHz. + ; (4*4.096MHz)/2^6 = 256kHz. We really use (4*4.096MHz)/2^8 = 64kHz. MOV pwm, a ; clear MOV tm2b, a ; clear MOV a, #(( 2<<4 | 3<<2 | 1<<1 | 0<<0 )) MOV tm2c, a ; timer2: IHRC, PA4, PWM, not inverted - MOV a, #(( 0<<7 | 1<<5 | 0<<0 )) + MOV a, #(( 0<<7 | 0<<5 | 0<<0 )) MOV tm2s, a ; 8bit, /4 prescaler, divide by (0+1) - ;XXX: increase pwm base frequency (/1) -> (4*4.096mhz)/(2^8) = 64khz ;timer16/ivr setup MOV a, #(( 0<<0 | 1<<3 | 4<<5 )) ; ovf@bit8 (512cy; §9.2.5), clk/4, ihrc