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

spi_read help
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
geokonst



Joined: 04 Apr 2009
Posts: 27

View user's profile Send private message

PostPosted: Mon Apr 06, 2009 11:34 am     Reply with quote

Sorry, I am using a PIC24FJ128GA110 but have also tried with a PIC24FJ256GB106 .

I am using the internal oscillator (I don't believe that makes any difference)

There is nothing relative in the errata.
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Mon Apr 06, 2009 12:23 pm     Reply with quote

What is your compiler version number?
geokonst



Joined: 04 Apr 2009
Posts: 27

View user's profile Send private message

PostPosted: Mon Apr 06, 2009 12:29 pm     Reply with quote

it's 4.084
Guest








PostPosted: Mon Apr 06, 2009 3:20 pm     Reply with quote

I'm somewhat new to SPI but don't think your writing to the accelerometer correctly. In all the code I have seen and the code I use for my accelerometer I never do just an spi read because I never remember it working correctly. But if you have time try the code below
Code:

output_bit (PIN_B2,0);

spi_write(0x8f);
dataout = spi_read(0x00);
output_bit (PIN_B2,1);

output_a (dataout);

delay_us(10);

Also how do you know your output is working? Have you checked with a logic analyzer? Can you use rs232 and a debug window to view the value stored in dataout?


Thanks
geokonst



Joined: 04 Apr 2009
Posts: 27

View user's profile Send private message

PostPosted: Tue Apr 07, 2009 2:04 am     Reply with quote

Actually I am using a 4 channel oscilloscope and RS232.

The only difference I see in your code is that you are sending 00 instead of FF with spi_read. I don't believe it will make any difference but I will try it anyway.

Thank you
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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