• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC18F4550 via SPI to a Quad DAC - some guidance

Status
Not open for further replies.

lachick

New Member
Hi

I was hopeing someone might have some sample code (in C) to help me with the set up of the SPI bus on the PIC18F4550 (or similar) to set 12 bit values in steps of 1/3 or 1/2 on an Analog AD5324 Quad DAC.

I am trying to show that I can simply talk with DAC initially then will be adding additional devices on the SPI.

I guess what I am not getting - forgive me for being so new - is once the PIC is configured for SPI mode is the data simply transfered to the DACs via the shift register (SSPSR) and the buffer register (SSPBUF)? I understand the setting of the top two bits in the shift register to designate which of the 4 buffers on the DAC I am writing to but I guess I'm timid on the actual implementation of it all... and when I add an additional device on the SPI how do I know what I am writing to the AD5324 or the AD7888 since I do not specify an address or anything?

Thank you in advance.
 

Wp100

Well-Known Member
Hi,

With SPI it is the /SS or /chip select signal from the master that controls which device is to be active.

In your case it should work on the /Sync Pin of the AD5324.

The AD5324 only receives data, it does not return data, as demanded by the Microchip SPI protocol, so to get it to work you need to fit a 2K2 resistor across the pic ports SDI and SDO, so it can get a return signal this way.

Am only into assember so cannot help with the code.
 
Status
Not open for further replies.

EE World Online Articles

Loading
Top