Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] my pic crash with spi + variable

Status
Not open for further replies.

bestrider14

Member level 1
Joined
Feb 27, 2015
Messages
39
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
300
Hi,

I got a new probleme now on my ds33fj128mc802. when a try to send some data on my spi whith a variable my pic crash

Code:
char dataLength=8;

SPI1_Write(dataLength); //will not work
SPI1_Write(8); //will work

I dont know why it crash, it try to do some test and still now working :(.

I joint my project here cause it to big to write the code here

thanks
 

Attachments

  • Nouveau dossier.rar
    141.8 KB · Views: 79

In the file you have provided, I (*finally*) found the lines where you have added the comments about the 'crash' - it is in "nRF.c" if anyone else is looking for it.
However in that file you do not declare or define what 'datalength' is - there are no include files referenced.
THEN I saw that the 'MyProject.c" file includes a whole lot of ".c" files! Whoever taught you to program like this has certainly NOT done you any favours!
What do you mean by "crash"? Does it reset? Does it loop forever? What?
As 'datalength' is declared as a global variable, I suggest that you have a look in the debugger just before you execute the statement that 'crashes' and see what value it has. I suspect that there may be a pointer or similar that is altering the data to something that is not accepted by the SPI1_Write() function (although I have no idea what as the SPI peripheral itself can send any 8 or 16 bit value in that device but there may be some strange code in the library function).
Susan
 

I see this question is now marked as "solved".
Perhaps you could tell others what you did to solve the problem as as way of helping others who may have the same/similar problem and find this thread.
Susan
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top