SPI Slave on a PIC16f887?

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

Moderator: Benj

Post Reply
gmwow
Posts: 11
Joined: Sat Sep 27, 2014 4:14 am
Location: Colorado, US
Has thanked: 2 times

SPI Slave on a PIC16f887?

Post by gmwow »

I'm working on a web connected audio switching device that is going to use SPI communication between a pic18f46k20 which runs a wiz5100 for the web, an SD card for website storage and some configuration files, and four slave pic16f887s that run the front panel button interfaces and control the audio switches. Does anyone have a working example code I could use to implement the slave function on the 887 in Flowcode v6? What do I need to modify to get the code working for the 887? Does anyone know how far off we are on a working SPI slave component for Flowcode v6? Thanks in advance.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: SPI Slave on a PIC16f887?

Post by Benj »

Hello,

Could you use the I2C slave component instead of SPI? There is a blog on this available from here: http://flowcode.co.uk/blog/?p=771

gmwow
Posts: 11
Joined: Sat Sep 27, 2014 4:14 am
Location: Colorado, US
Has thanked: 2 times

Re: SPI Slave on a PIC16f887?

Post by gmwow »

I2C slave could have worked and I'll keep it noted for the next project but my engineer and I came to an epiphany about our project yesterday after I posted this. We're altering the design to use several SPI I/O port expanders instead of slave PICs.

I do now have a question about those though. In the SPI master component it lists DAC and NVM. From an older thread on the forum it seems like DAC and NVM are actually CS and INT or something like them. Is that true and if so which is which?

We need to attach 7 MCP23s17's to a PIC18f46k20. The MCP's are hardware addressable up to 8 devices so we can have them all running on one CS and they have 2 ports per device with separate INT pins per port so when getting button interrupt conditions we don"t have to poll all of them just the port that sent the INT. I'd prefer not to have to bit bang this out as that will take more time and as I understand it not run quite as fast in the program which will reduce button response in our device.

Another question I have for this project is can you send me an unlocked and alterable version of the Webserver component? I like the simplicity of it and don't have the time right now to make my own version using the TCP/IP. I just need the ability to set the network information like MAC and IP and Gateway from data in a config file on an SD card. I can't figure out how I can change those values without having to reprogram the device every time or spend too much time setting up all the web server functions using the TCP/IP component.

Any help is greatly appreciated. Thanks

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

Re: SPI Slave on a PIC16f887?

Post by kersing »

DAC and NVM are chip selects for the D/A converter and memory component on the 'E-blocks SPI bus D/A and memory board'. The pins are only set in the D/A converter and memory specific macros, not in the generic macros. It is best to ignore them and use an output operation to set a chip select yourself before calling SPI macros and reset the pin at the end of the SPI transaction.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

gmwow
Posts: 11
Joined: Sat Sep 27, 2014 4:14 am
Location: Colorado, US
Has thanked: 2 times

Re: SPI Slave on a PIC16f887?

Post by gmwow »

Ok. So I have to manually implement CS and INT. No worries about that then.

On to the other issue then. Does anyone have a version of the Webserver component I can use that will let me set the MAC, gateway, and IP from data pulled from an SD file?

Post Reply