CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Using SPI and Maxim 5354 DAC

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
slahiri
Guest







Using SPI and Maxim 5354 DAC
PostPosted: Mon Mar 24, 2003 9:37 am     Reply with quote

<font face="Courier New" size=-1>Guys,
I am using 16F877 to connect Maxim 5354 "DAC" through SPI. I need to send 1v using two byte.I am sending the value but seeing the voltage ramping up to 3v at the DAC output. This is what I wrote, can some one take look at it and tell me what I am doing wrong.

Thanks

setup_spi(SPI_MASTER |SPI_L_TO_H |SPI_CLK_DIV_16);
delay_us(30);
if (choice==1 || choice==2)
{
full_charge=6;
output_low (PIN_C0);
spi_write(32);
spi_write(8);
delay_us(30);
spi_write(64);
spi_write(0);
delay_us(30);
output_high(PIN_C0);
delay_us(30);</font>
___________________________
This message was ported from CCS's old forum
Original Post ID: 13002
Charlie U
Guest







Re: Using SPI and Maxim 5354 DAC
PostPosted: Tue Mar 25, 2003 7:58 am     Reply with quote

:=<font face="Courier New" size=-1>Guys,
:= I am using 16F877 to connect Maxim 5354 "DAC" through SPI. I need to send 1v using two byte.I am sending the value but seeing the voltage ramping up to 3v at the DAC output. This is what I wrote, can some one take look at it and tell me what I am doing wrong.
:=
:=Thanks
:=
:= setup_spi(SPI_MASTER |SPI_L_TO_H |SPI_CLK_DIV_16);
:= delay_us(30);
:= if (choice==1 || choice==2)
:= {
:= full_charge=6;
:= output_low (PIN_C0);
:= spi_write(32);
:= spi_write(8);
:= delay_us(30);
:= spi_write(64);
:= spi_write(0);
:= delay_us(30);
:= output_high(PIN_C0);
:= delay_us(30);</font>

I checked the device you are using, and it appears that it requires SPI mode 0,0 which is not possible with the basic spi setup above. Follow the link below and the links in the various messages for a full explanation of the problem.

CCS changed the SPI setup when they released version 3.xxx and the basic parameters no longer create either mode 0,0 or 1,1 which most devices use.

A good reference for SPI is a Motorola applications note AN991/D.
___________________________
This message was ported from CCS's old forum
Original Post ID: 13043
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group