6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Thu Mar 28, 2024 8:12 am

All times are UTC




Post new topic Reply to topic  [ 13 posts ] 
Author Message
PostPosted: Tue Mar 24, 2020 7:22 pm 
Offline
User avatar

Joined: Fri Dec 12, 2008 10:40 pm
Posts: 993
Location: Canada
I have been dealing a lot with trying to get good and easy to use devices working in systems that run at speeds those devices were never intended for. Sometimes it's pretty easy, as it was with the MCP14495 hex decoder driver, and sometimes it's a bit harder. I'm still working on some devices and may never succeed, but I did have some success with the ADC0804N analog to digital converter. It will now work with 65C02s running at 16MHz just dandy. Here's how I did it - comments are welcomed and encouraged.

Attachment:
ADC_Standalone.jpg
ADC_Standalone.jpg [ 148.5 KiB | Viewed 1096 times ]


The ADC0804N requires the /WR and /RD pulses to be a minimum of 200ns wide. I was able to push some examples to run on 2MHz systems hanging them directly off the CPU buss and qualified control lines, but beyond that they just quit. In the circuit above, a write to the device address will trigger 1/2 the 74HCT123 to produce a 220ns pulse which is directed to the the /WR input on the ADC. This begins the conversion. Once the conversion is complete it drives the /INT line low which triggers the other half of the dual one-shot to produce another 220ns pulse. This pulse is then used to drive both the /RD line on the ADC and the clock input of the 74AC574, giving the ADC enough time to guarantee valid output data before the rising edge transfers the data into the 574.

The whole thing takes a maximum of 120us, so you must wait that length of time between initiating the conversion and reading the 74AC574. Since the entire activity is asynchronous from the CPU's perspective, this solution should work on any system that produces a write pulse long enough to be recognized by the 74HCT123. Which is typically about 2.5ns (17ns max) at 24C.

_________________
Bill


Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 26, 2020 5:07 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3327
Location: Ontario, Canada
Bill, I like it! The '123 dual timer is a good fit here. No doubt it'll work just fine -- a nice, tidy solution.

But I couldn't leave it alone. :lol: :roll: Same as with my own circuits, I felt the urge to tease things around and explore tradeoffs. Instead of measuring time by charging a capacitor we could measure it by counting clock pulses. Depending on circumstances, this revised circuit may have a small advantage. (I'm not suggesting you ought to do it this way. But I thought it was interesting to look at an alternative approach.)

Attachment:
ADC revised 01.png
ADC revised 01.png [ 65.75 KiB | Viewed 1035 times ]

The revised circuit eliminates the resistors and capacitors associated with the RC-based timer chip, but the savings may be offset by the need to add an inverter. Or not, depending on the details of the surrounding glue logic! :) The write pulse that's presented to the shift-reg reset input needs to be active-high, not active-low like the read pulse that's applied to the '574 /OE. This is a detail that can perhaps be accommodated for free (it might even save resources), but in the worst case it will cost you an inverter (as shown).

In the diagram I omitted many of the ground and supply connections, making it somewhat sparse. At the center of the action is the 74HC4015 -- a 16-pin package containing two serial-to-parallel shift registers. (The 'HC4015 is an update of the old metal-gate CMOS 4015. 4015 and 'HC4015 are both still in production, available in through-hole and SMD.)

Left undisturbed, the reg in the A section will fill up with ones, meaning that Q3 (our output -- the end of the chain) is normally high. When a write occurs the reg's reset input briefly gets pulsed high. The reg is then full of zeros, and it will take four clock before it fills with ones again and Q3 returns high. So, we have a timer that spits out a long-ish low pulse on Q3, mimicking what happens in the first half of the '123 design.

Section B is simply a delay line. When conversion is complete the /INT signal goes low, and that low gets delayed four clocks before emerging at Q3 and being applied to /RD. Low on /RD means /INT will return high... and that high will get delayed by four clocks before reaching /RD. During that time, /RD gets a nice, chunky low pulse, which is what we set out to achieve.

There are some details I didn't bother to figure out; for example, the upper limit re the CPU bus clock. But the ADC will see /RD and /WR pulses that are over three PHI2 clocks in duration, which is favorable. What would provide even longer pulses is if the shift registers were clocked at a rate lower than PHI2. Maybe the clock generated by the ADC0804N would be suitable. :)

-- Jeff

(datasheets here )
Attachment:
74HC(T)4015.pdf [49.25 KiB]
Downloaded 65 times
Attachment:
adc0804-n.pdf [6.7 MiB]
Downloaded 59 times

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 26, 2020 11:01 pm 
Offline
User avatar

Joined: Fri Dec 12, 2008 10:40 pm
Posts: 993
Location: Canada
Dr Jefyll wrote:
Bill, I like it! The '123 dual timer is a good fit here. No doubt it'll work just fine -- a nice, tidy solution.
Thanks, and it does indeed work as intended.

Dr Jefyll wrote:
But I couldn't leave it alone. :lol: :roll: Same as with my own circuits, I felt the urge to tease things around and explore tradeoffs. Instead of measuring time by charging a capacitor we could measure it by counting clock pulses. Depending on circumstances, this revised circuit may have a small advantage. (I'm not suggesting you ought to do it this way. But I thought it was interesting to look at an alternative approach.)

Attachment:
ADC revised 01.png

The revised circuit eliminates the resistors and capacitors associated with the RC-based timer chip, but the savings may be offset by the need to add an inverter. Or not, depending on the details of the surrounding glue logic! :) The write pulse that's presented to the shift-reg reset input needs to be active-high, not active-low like the read pulse that's applied to the '574 /OE. This is a detail that can perhaps be accommodated for free (it might even save resources), but in the worst case it will cost you an inverter (as shown).

In the diagram I omitted many of the ground and supply connections, making it somewhat sparse. At the center of the action is the 74HC4015 -- a 16-pin package containing two serial-to-parallel shift registers. (The 'HC4015 is an update of the old metal-gate CMOS 4015. 4015 and 'HC4015 are both still in production, available in through-hole and SMD.)

Left undisturbed, the reg in the A section will fill up with ones, meaning that Q3 (our output -- the end of the chain) is normally high. When a write occurs the reg's reset input briefly gets pulsed high. The reg is then full of zeros, and it will take four clock before it fills with ones again and Q3 returns high. So, we have a timer that spits out a long-ish low pulse on Q3, mimicking what happens in the first half of the '123 design.

Section B is simply a delay line. When conversion is complete the /INT signal goes low, and that low gets delayed four clocks before emerging at Q3 and being applied to /RD. Low on /RD means /INT will return high... and that high will get delayed by four clocks before reaching /RD. During that time, /RD gets a nice, chunky low pulse, which is what we set out to achieve.

There are some details I didn't bother to figure out; for example, the upper limit re the CPU bus clock. But the ADC will see /RD and /WR pulses that are over three PHI2 clocks in duration, which is favorable. What would provide even longer pulses is if the shift registers were clocked at a rate lower than PHI2. Maybe the clock generated by the ADC0804N would be suitable. :)

-- Jeff


Cool idea Jeff, but there is a small issue. /INT will only be reset if /RD is asserted 8 clock cycles of the ADC after /INT. I guess in the - Old Days - the interrupt handler would have allowed enough time for this to occur. If /RD is asserted by /INT, /INT does not reset until /WR is asserted to begin a new conversion.

_________________
Bill


Top
 Profile  
Reply with quote  
PostPosted: Fri Mar 27, 2020 2:26 am 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3327
Location: Ontario, Canada
BillO wrote:
/INT will only be reset if /RD is asserted 8 clock cycles of the ADC after /INT.
Wow! -- you sound like someone who has actually read the datasheet... instead of just glancing at it as I did.

Dr Jefyll wrote:
There are some details I didn't bother to figure out

:roll:

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
PostPosted: Sat Mar 28, 2020 1:57 am 
Offline
User avatar

Joined: Fri Dec 12, 2008 10:40 pm
Posts: 993
Location: Canada
Dr Jefyll wrote:
Wow! -- you sound like someone who has actually read the datasheet...

Fairly atypical, I can assure you. Years ago unexpected behavior riveted my attention to the details. Even then it's just a side note.

I am learning though...

_________________
Bill


Top
 Profile  
Reply with quote  
 Post subject: SN76489AN Sound Chip
PostPosted: Sat Apr 04, 2020 4:36 pm 
Offline
User avatar

Joined: Fri Dec 12, 2008 10:40 pm
Posts: 993
Location: Canada
These are great little sound chips that were used in many early computers, but they are so sllooooowwwwww that even on a 1MHz system you need to hang them off a PIA or something. I wanted to get one up and running this last week but did not have a PIA that would work in a system running at 14MHz, so I had to figure out some way of keeping the the data, /WE and /CE asserted while the chip took it's leisurely 32 clock cycles to grab the data. Luckily the Ready signal stays low until the data has been acquired, so I utilized that to hold the /WE and /CE inputs low and incorporated the system reset to prevent any false triggering while the Ready stabilized on power-up. I used a 74AC574 to latch the data.

The data sheet was misleading to say the least and was more of a hindrance than a help. With bits labeled the wrong way around (MSB = D0) and outright errors. ftp://ftp.whtech.com/datasheets%20and%2 ... N76489.pdf

My solution:
Attachment:
SC.jpg
SC.jpg [ 189.9 KiB | Viewed 831 times ]


I made a sample recording, but you can't attach files like that here.

_________________
Bill


Top
 Profile  
Reply with quote  
 Post subject: Re: SN76489AN Sound Chip
PostPosted: Sat Apr 04, 2020 6:08 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8114
Location: Midwestern USA
BillO wrote:
I made a sample recording, but you can't attach files like that here.

Sure you can. Wrap it in a ZIP.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
 Post subject: Re: SN76489AN Sound Chip
PostPosted: Sat Apr 04, 2020 6:38 pm 
Offline
User avatar

Joined: Fri Dec 12, 2008 10:40 pm
Posts: 993
Location: Canada
BigDumbDinosaur wrote:
Sure you can. Wrap it in a ZIP.

Good idea BDD!

Here it is ... This was one of the first songs I learned when learning to play piano.
Attachment:
Lavender's Blue.zip [532.12 KiB]
Downloaded 55 times

_________________
Bill


Top
 Profile  
Reply with quote  
 Post subject: Re: SN76489AN Sound Chip
PostPosted: Sat Apr 04, 2020 6:46 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8114
Location: Midwestern USA
BillO wrote:
BigDumbDinosaur wrote:
Sure you can. Wrap it in a ZIP.

Good idea BDD!

Here it is ... This was one of the first songs I learned when learning to play piano.
Attachment:
Lavender's Blue.zip

Urk! It's one of those MA4 files for which I have no compatible software.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
 Post subject: Re: SN76489AN Sound Chip
PostPosted: Sat Apr 04, 2020 7:27 pm 
Offline
User avatar

Joined: Fri Dec 12, 2008 10:40 pm
Posts: 993
Location: Canada
BigDumbDinosaur wrote:
Urk! It's one of those MA4 files for which I have no compatible software.


M4A. I just assumed everyone would be running a modern Windoze platform. My bad.

Here it is in MP3:
Attachment:
Lavender's Blue.zip [370.66 KiB]
Downloaded 52 times

_________________
Bill


Top
 Profile  
Reply with quote  
PostPosted: Sat Apr 04, 2020 10:15 pm 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1373
Well, I use OSX or iOS and both support m4a without issue. For any platform that doesn't support it, you should be able to download VLC, which is supported on just about everything.

https://www.videolan.org/vlc/index.html

_________________
Regards, KM
https://github.com/floobydust


Top
 Profile  
Reply with quote  
 Post subject: Re: SN76489AN Sound Chip
PostPosted: Sun Apr 05, 2020 5:07 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8114
Location: Midwestern USA
BillO wrote:
BigDumbDinosaur wrote:
Urk! It's one of those MA4 files for which I have no compatible software.


M4A. I just assumed everyone would be running a modern Windoze platform. My bad.

Here it is in MP3:
Attachment:
Lavender's Blue.zip

That works!

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
 Post subject: Re: SN76489AN Sound Chip
PostPosted: Sun Apr 05, 2020 8:52 am 
Offline
User avatar

Joined: Sat Dec 01, 2018 1:53 pm
Posts: 727
Location: Tokyo, Japan
BigDumbDinosaur wrote:
Urk! It's one of those MA4 files for which I have no compatible software.

On Linux, mplayer, vlc, etc. etc. all should be able to play it just fine. (It worked right off the bat for me in mplayer as installed by apt-get on Debian 9.)

_________________
Curt J. Sampson - github.com/0cjs


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: