Saturday, March 5, 2016

Changing the buzzer tone

Reading the upd7810 manual says that the upcounter (ECNT) is incremented every 12 cycles of the phi-12 clock (phi-12 is clock divided by 12) (1 microsecond when operating at 12 Mhz). But it looks like the ap2000 runs at 14.7 mhz.

static MACHINE_CONFIG_FRAGMENT( epson_lx810l )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", UPD7810, XTAL_14_7456MHz)

So if I want to generate a 1000hz tone, I'll have to fudge the delay a little bit.

The half cycle is 1000us/2=500us and we'll multiply that by (14.7/12) to make 500*(14.75/12) and we get around 615 which is 0x267.

One cycle should take (1/14.7e6*12)*615*2=0.00100408163 which is about right for 1000hz.


My debugger line looks like:

eom=b0;etm1=267;etmm=0c;gt 15


I like the gt 15 (gtime) as it won't drive you totally insane with the beeping.

eom=b0;etm1=4ce;etmm=0c;gt 15

for a bit lower tone (doubling the timer value)


I was actually trying to mimic the apple ii's beep tone, and this sounds similar with etm1=220 being pretty close

etm1=220;eom=b0;etmm=0c;gt 20

No comments:

Post a Comment