PDA

View Full Version : Shiftin with external Clock howto ?



RFsolution
- 18th September 2011, 22:07
Hi all

I have an excisting piece of hardware which is controlling a 12bit DAC7611

The DAC 7611 gets the clock from the excisting hardware,Data and Load/ , CS/ is wired low,
CLR/ is wired high

I want to read the value (0-4096) which the excisting hardware is sending and display it on an LCD

Anyone who can point me how to do so ?

I noticed that shiftin is generating it's own clock so that is not an option

Looking forward

aerostar
- 19th September 2011, 16:41
What I think you need to do is "eavesdrop" on the clock and data line.

Eg wait for the clock to change from idle state, read the data line and store the bit, wait for clock change back to idle state,wait for the clock to change from idle state, read the data bit and store it.......................keep going until you have the data you need.

See the manual http://melabs.com/resources/pbpmanual/5_65-5_70.htm and the clock and date illustration

tumbleweed
- 19th September 2011, 18:45
The DAC 7611 gets the clock from the excisting hardware
Do you know what the clock speed of the existing circuit is?

It could be running WAY too fast to try and catch the transaction by polling the lines.

pyrogeek
- 19th September 2011, 21:39
hardware MSSP

tumbleweed
- 19th September 2011, 21:52
It might be very difficult to capture the 12-bit DAC transfer with an 8-bit MSSP module.

pyrogeek
- 20th September 2011, 02:07
:confused: really?

tumbleweed
- 20th September 2011, 12:08
Yes. The DAC7611 can accept a clock up to 20MHz (50ns). I doubt that it's being used that fast, but who (other than the OP) knows.

Potentially that doesn't give you much time between the first and second bytes, but since the second "byte" is only four bits long it won't set BF anyway so I'm not sure how you'd get at it/know when it's done being transferred.

Also, with CS wired low, you'll have to come up with some way of using the LOAD pulse to resync transfers if you ever get out of sync with the transmitter. Otherwise, you'll never know high bytes from low bytes.

Charles Linquis
- 20th September 2011, 14:10
There is probably a slick way of doing all of this with the standard PIC hardware, but maybe this is the time to get two cascaded 8-bit serial in / parallel out shift registers and use them.

But another possibility: Since you are trying to read what is sent to the DAC - There are quite a few PICs with 12 bit A/Ds. (18F8723 for one). You could just A/D the DACs output. The PIC will convert in about 25uSec, if you have a low source impedance (which you should with the DAC). 25uSec is fast enough to digitize audio.

RFsolution
- 20th September 2011, 20:22
Hi all

First of all thanks for the reply's

I'm measuring 28.2 uS periode for the clock going to the DAC7611

Charles Linquis
- 20th September 2011, 22:38
If you run an 18F at 40Mhz, you can decode that in software. If you don't need to do anything else at the same time, it is easy. But
if you have to read continuously while you are doing something else, then I would recommend making friends with someone who can write you an ISR in ASM.

Charles Linquis
- 21st September 2011, 16:45
I have been doing some timing. You can, indeed get into- and out of, an ASM interrupt in about 12 uSec (18F @ 40Mhz), so that is a viable solution. A PBP ISR takes about 25, so that wouldn't work.