SPI communications nightmare!

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
407charles
Posts: 122
Joined: Thu Jun 26, 2014 12:01 pm
Has thanked: 41 times
Been thanked: 19 times
Contact:

SPI communications nightmare!

Post by 407charles »

I have being trying to understand the SPI communications. In one hand there is an example available written one way, and in the other hand I read in the Matrix blog an article from Benjamin showing something completely different, there is any other example available? I'm trying to write a simple program, using two PIC16F877A microcontrollers, that is able to send a simple variable from one microcontroller to another. So far I got confuse about what approach I need to follow. I did my first attempt to accomplished this task but not functional. First I don't know if a have to sent the variable value to a particular memory or just sent the variable needed. Also the Slave PIC it's going to need a small program to receive this value I think, but there is not example available. I read the complete article from Benjamin but I'm not to familiar with programmer's language so I just got an idea of how it works. This is the last part of my project but unfortunately there is not a clear example. By sending a simple variable to another PIC, a lot of sub-processes can be achieved expending the PINs availability; for example if you need an LCD and a 7 segment display for certain application the availability of pins will be very limited because just this two use more than 18 pins in total. Please if somebody already have success with the subject I will appreciate if he or she can help me with this nightmare! I've been reading and searching about the subject but not luck, everything I found is in C language. this is my first attempt..... About the second program (the slave) I don't even have an idea.
Attachments
SPIcomm.fcfx
This is the PIC master program
(10.74 KiB) Downloaded 274 times

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: SPI communications nightmare!

Post by kersing »

Why don't you use serial (RS232 but at 5v) communications? A lot simpler to implement.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

407charles
Posts: 122
Joined: Thu Jun 26, 2014 12:01 pm
Has thanked: 41 times
Been thanked: 19 times
Contact:

Re: SPI communications nightmare!

Post by 407charles »

Hi Kersing, you were right, the SendChar command in RS-232 communications is easy and it works perfectly but the Send_String command did not work for me, it just send the first three letters. Do you have and idea of why? I will appreciate your feedback. Thanks a lot.

Post Reply