News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

Counterfeit components strike again. CD4040

Started by ken_k, Oct 20, 2024, 01:26 AM

Previous topic - Next topic

ken_k

Sorry no PIC's or code.

Counterfeit components strike again. CD4040
 eBay seller.

I designed a small PCB with three CD4040's, three R2R DAC's and a few other components.
The PCB did not function as my spice simulation suggested, it was found the fake CD4040's were
changing state on the positive going edge of the clock pulse and not the negative going as a CD4040 should. Purchase some chips from a local supplier and the PCB worked perfectly.

So easy to get caught. Am I one of the few people still using these R2R DAC's?  I use them to drive a 300uA moving coil meter for that old world look, only one resistor required from the R2R network to the meter.

https://au.rs-online.com/web/p/resistor-arrays/8651915/?sra=pstk
 
RS Stock No  865-1915

Below maybe useful information to somereaders.
The R-2R ladder has a fixed output impedance of R. If you shunt it with a
 resistor Rx you can attenuate the output equally for all codes.
You thus have two degrees of freedom that allow you to set the output
 impedance and output amplitude independently.
 
The output impedance of the R-2R resistor network is always equal to R,
 regardless of the size (number of bits) of the network.

Ken_K

david

Ken - you're not alone in your old school thinking.  I've used then a couple of times for DACs on DDS function generators.  Fast and simple, provided you have enough spare ports to drive them.   A company I worked for dumped literally buckets of them in to a skip before I found out.  They were part of an older marine product and deemed surplus to requirements. 
Have you tried a trinary network using 3 states of an output pin?

Cheers,
David

ken_k

Quote from: david on Oct 20, 2024, 05:53 AMA company I worked for dumped literally buckets of them in to a skip before I found out.  They were part of an older marine product and deemed surplus to requirements. 
Have you tried a trinary network using 3 states of an output pin?
Cheers,
David

David -I have not tried trinary networks.
This is an interesting read.  new.https://ternaryresearch.com/

I hope you grabbed a good quantity of those R-2R networks, I'd call them a resource. BTW I have an attic full of "resources".

It's amazing what you might need when you retire and do things just for fun.

Regards Ken


david

Hmmmmm.   I'm not sure it will catch on but I hadn't realised there was a following for it. 
I only got 2pcs of the tan coloured Bourns networks.  I was gutted I missed out and the rest was now landfill. 

David

top204

I have used an R2R DAC a few times on the old 40-pin PIC devices, because they are fast and stable, and as long as you have enough pins, you can easily make a 16-bit DAC, as I did once.

At one time, you could also get the resistor ladders in SMD format, and they worked well, but you can never beat the good old multi-pin mustard coloured component. Bob gave me some when he visited me last year, and I have them in a component drawer awaiting a future project. :-)


david

There's a lot of discussion about using two 8 bit DACs or R2R networks to create a 16 bit DAC but it seems the general consensus is that the 8 bit DACs would need 16 bit accuracy to achieve monotonic performance.  Yes you will have 65535 steps but some will likely go down before they go up again in level.  (that should start some lively discussion....)
The 8 bit R2R networks are probably only about 9 bit accuracy.  I think you would achieve better results by integrating 16 bit PWM but of course it won't be fast.

David


normnet

Optional dsPIC33FJ128GP802 which includes a 16-bit dual channel 100 ksps Audio DAC.

top204

#8
I'm not sure of the dsPIC33FJ128GP802 device, but some 8-bit and 16-bit devices are advertised as having 2 DAC peripherals, but only one can be used, and the other one cannot be used at the same time, and each share the same pin?

I know, I know... I could not figure out why they would do that either, but it did catch me out once when I was going to combine the two 8-bit DACs into a single 16-bit DAC with a couple of 1:256 ratio resistors and some clever coding. :-)

normnet

The dsPIC33FJ128GP802 16 bit DACs are separate pins. Utilized for a stereo Wave player as called in the following code:

Include "DAC.inc" 'FOR USAGE SEE LES's Proton24_FIR_Library

wLDAC = wBUFF_ARRAY256[yBUFF_RDPT]
Inc yBUFF_RDPT
wRDAC = wBUFF_ARRAY256[yBUFF_RDPT]
Inc yBUFF_RDPT

DAC1L_Write(wLDAC)        ' Write 16 bit value to the left DAC
DAC1R_Write(wRDAC)        ' Write 16 bit value to the right DAC

top204

#10
Crickey... I had forgotten I wrote that include file, it has been so long ago.

I wrote it when I was first experimenting with DSP on the dsPIC33 devices, and used it to output the audio from the digital filter programs I created, so I could see the results of the signal generator moving the frequency on the oscilloscope and make sure the filter mechanisms were working at the correct frequencies.