Question on the NEC uPD7002 analog to digital converter

discuss both original and modern hardware for the bbc micro/electron
Post Reply
User avatar
scarybeasts
Posts: 701
Joined: Tue Feb 06, 2018 7:44 am
Contact:

Question on the NEC uPD7002 analog to digital converter

Post by scarybeasts »

Hi,

I don't suppose anyone here has looked at this chip in any depth?

The datasheet is somewhat, shall we say, sparse. A lot of the online resources show a 3-page datasheet but this one is 4 pages: https://html.alldatasheet.com/html-pdf/ ... D7002.html
The 4th page gives very minimal description of the registers.

In particular, does anyone know what the bit "D2 = Flag Input" does?

The AUG gives a similarly brief treatment: "Bit 2 Flag input, normally set to 0".
I do note that MOS1.2 startup appears to stick a "1" in that bitfield when writing to $FEC0. No idea why!


Cheers
Chris
User avatar
1024MAK
Posts: 10658
Joined: Mon Apr 18, 2011 5:46 pm
Location: Looking forward to summer in Somerset, UK...
Contact:

Re: Question on the NEC uPD7002 analog to digital converter

Post by 1024MAK »

Reading the datasheet, when the status register is read, D2 is likely to return whatever was written to D2 of the control register. But the chip does not make use of this bit internally.

Also keep in mind that NEC often copied chips from other manufacturers...

Edited to add: there’s a more detailed datasheet here. Not that it helps much... :roll:

But read the note at the bottom of the last page of this version of the datasheet...

Mark
User avatar
MartinB
Posts: 5396
Joined: Mon Mar 31, 2008 10:04 pm
Location: Obscurity
Contact:

Re: Question on the NEC uPD7002 analog to digital converter

Post by MartinB »

Maybe its just used by a host to determine whether there is a 7002 ADC chip present and alive at the expected mapped address. Not sure how else you could be sure one was present if you don’t know what state any analogue inputs might be in? Setting this flag and seeing it echoed back would be a reliable way of determining the presence of a viable device?
User avatar
IanS
Posts: 1662
Joined: Mon Aug 31, 2009 7:02 pm
Contact:

Re: Question on the NEC uPD7002 analog to digital converter

Post by IanS »

1024MAK wrote:
Thu Apr 08, 2021 7:25 am
Edited to add: there’s a more detailed datasheet here. Not that it helps much... :roll:
Makes it fairly clear in the "Application hints" section.
Attachments
d2.PNG
User avatar
MartinB
Posts: 5396
Joined: Mon Mar 31, 2008 10:04 pm
Location: Obscurity
Contact:

Re: Question on the NEC uPD7002 analog to digital converter

Post by MartinB »

......but for what purpose would one use it ?
User avatar
IanS
Posts: 1662
Joined: Mon Aug 31, 2009 7:02 pm
Contact:

Re: Question on the NEC uPD7002 analog to digital converter

Post by IanS »

MartinB wrote:
Thu Apr 08, 2021 12:46 pm
......but for what purpose would one use it ?
Free memory bit.
"BBC MICRO 32.0001220703125K"
User avatar
tricky
Posts: 5410
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Question on the NEC uPD7002 analog to digital converter

Post by tricky »

Who else checked that that was 1/8K and not 1/8000 :oops:

PS I don't even bother check the interrupt/status flags, just wait long enough and read the result :oops:
User avatar
1024MAK
Posts: 10658
Joined: Mon Apr 18, 2011 5:46 pm
Location: Looking forward to summer in Somerset, UK...
Contact:

Re: Question on the NEC uPD7002 analog to digital converter

Post by 1024MAK »

tricky wrote:
Thu Apr 08, 2021 1:11 pm
PS I don't even bother check the interrupt/status flags, just wait long enough and read the result :oops:
If you are only reading joystick data, that’s perfectly fine. The conversion should always be completed within the maximum time.

By the way, do you 8 bit mode or the 10/12 bit mode?

Mark
User avatar
1024MAK
Posts: 10658
Joined: Mon Apr 18, 2011 5:46 pm
Location: Looking forward to summer in Somerset, UK...
Contact:

Re: Question on the NEC uPD7002 analog to digital converter

Post by 1024MAK »

IanS wrote:
Thu Apr 08, 2021 12:42 pm
1024MAK wrote:
Thu Apr 08, 2021 7:25 am
Edited to add: there’s a more detailed datasheet here. Not that it helps much... :roll:
Makes it fairly clear in the "Application hints" section.
Yeah, that is what I was referring to here:
1024MAK wrote:
Thu Apr 08, 2021 7:25 am
But read the note at the bottom of the last page of this version of the datasheet...
Mark
User avatar
tricky
Posts: 5410
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Question on the NEC uPD7002 analog to digital converter

Post by tricky »

For games I do 8-bit mode, but only use the top two bits that come from the control register read (&FEC0 on a B).
I could just read them from the high byte, but sometimes I flip the bottom bit and write back to save storing which controller I'm reading 8)
User avatar
scarybeasts
Posts: 701
Joined: Tue Feb 06, 2018 7:44 am
Contact:

Re: Question on the NEC uPD7002 analog to digital converter

Post by scarybeasts »

IanS wrote:
Thu Apr 08, 2021 12:42 pm
1024MAK wrote:
Thu Apr 08, 2021 7:25 am
Edited to add: there’s a more detailed datasheet here. Not that it helps much... :roll:
Makes it fairly clear in the "Application hints" section.
Thanks all for the excellent response!

Might as well emulate this extra bit of RAM :-)


Cheers
Chris
User avatar
sweh
Posts: 2378
Joined: Sat Mar 10, 2012 12:05 pm
Location: New York, New York
Contact:

Re: Question on the NEC uPD7002 analog to digital converter

Post by sweh »

scarybeasts wrote:
Fri Apr 09, 2021 3:03 am
Might as well emulate this extra bit of RAM :-)
I do wonder if anyone used this BITD as a status bit!
Rgds
Stephen
User avatar
1024MAK
Posts: 10658
Joined: Mon Apr 18, 2011 5:46 pm
Location: Looking forward to summer in Somerset, UK...
Contact:

Re: Question on the NEC uPD7002 analog to digital converter

Post by 1024MAK »

In the past, I remember looking through the Beebs I/O chips to see if there were any registers that could be used like RAM, and saw that the 6522 VIAs have some that could be used (if the hardware was not being used). But admit I’d not spotted this bit in the ADC!

Mark
User avatar
scarybeasts
Posts: 701
Joined: Tue Feb 06, 2018 7:44 am
Contact:

Re: Question on the NEC uPD7002 analog to digital converter

Post by scarybeasts »

1024MAK wrote:
Fri Apr 09, 2021 7:16 am
In the past, I remember looking through the Beebs I/O chips to see if there were any registers that could be used like RAM, and saw that the 6522 VIAs have some that could be used (if the hardware was not being used). But admit I’d not spotted this bit in the ADC!
You also get back what you put in to some of the other bits in this ADC register, e.g. the selected ADC channel and 8-bit vs. 10-bit mode.

This reminds me of Kevin Edwards' infamous Nightshade protection. Last time I had the misfortune of having to step through it, I noticed that one of the decode stages stashes a value in one of the CRTC registers and a later stage expects it to be there!


Cheers
Chris
User avatar
tricky
Posts: 5410
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Question on the NEC uPD7002 analog to digital converter

Post by tricky »

Trixy!
Good job we have interlace (was it you or RichTW spotted this) and that Acorn didn't switch to a more basic one where you can't read the registers back!
Post Reply

Return to “8-bit acorn hardware”