SPI Component

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

Moderators: Benj, Mods

Post Reply
echase
Posts: 429
Joined: Mon Jun 11, 2007 11:55 am
Has thanked: 49 times

SPI Component

Post by echase »

I added an SPI component to a 16F690. On this PIC RB4 and 6 are part of the SPI port. I had already allocated these to front panel push buttons. Do you think it's OK to share the SPI port with digital inputs? I don't need them to be permanently configured as one or the other, so presumably can use time slicing or an interrupt to read the switches in between occasionally using SPI. Is that OK?

Second question, I know you have answered this before, but should switches be between input and earth with pull-up or input and 5V with pull down.

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 Component

Post by Benj »

Hello

Yes sharing the SPI should be ok. Just make sure that the enable pin is not active when timesplicing in the front panel switches. The enable pin should only be activated when the SPI functions are active so you should be ok.

Depends on what you want the switch to do.
If you want it to give a 1 when connected then connect between the uC pin and 5V and use a pull down resistor between the uC pin and ground.
If you want it to give a 0 when connected then connect between the uC pin and ground and use a pull up resistor between the uC pin and 5V.

echase
Posts: 429
Joined: Mon Jun 11, 2007 11:55 am
Has thanked: 49 times

Re: SPI Component

Post by echase »

I want the pushbutton to do the same as the Flowcode simulaion does, as Flowcode makes an assumption as to whether a pusbutton delivers a 0 or a 1.

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 Component

Post by Benj »

Ok then you want the switch to be between the uC pin and 5V. Flowcode V4 will have the active high and active low functionality switch components.

Post Reply