Close

ISR and DAC

A project log for DIAVOX Cellphone

Turning an old diavox phone into a cellphone. No smart stuff, just a telephone. Pick up the handset and dial just like the old days.

anders-helgessonAnders Helgesson 01/23/2025 at 04:390 Comments

I have implemented the ISR for the GPIO pins I want to use, keypad works perfectly but there is no debouncing on the reset/handset switch. This triggers the ISR multiple times for the different pins when the switch is quickly actuated.

That's not good and debouncing has to be added. There is probably a few different ways to do it. I decided to go with hardware debouncing of the switches. I used a 10k resistor and a 4.7uF capacitor for each switch. With the debouncing in place, the ISR acts like it should.

The handset input pin triggers the ISR on high edge, which is when the handset is removed.The reset input pin triggers the ISR on high edge, which is when the reset switch is engaged. Switches to the reset state and when it finishes it will poll the reset/handset switch, to tell if the handset is on or the reset has been released.

I've implemented the state switching. It does switch to the correct states without problems. While working with the keypad state switching, I had a problem with the keypad scanning for some reason. I figured that out, the R key seems to have traces connecting to the keypad matrix, which messes up the keypad scanning. I disconnected the real R key for now and connected the orange push button again.

I've implemented a function to play tones and I get tones out of the speaker but it sounds all messed up. Looking at the dac output in the oscilloscope it doesn't look like a 12bit signal more like a 4 bit one. I seemed to have missed to send 4 bits of the data.
The MCP4726 wants the first byte to have 2 command bits, 2 power down bits, 4 data bits, and The second byte is all data. I rewrote the code but I haven't tested it on the hardware yet.

Discussions