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.
SPI Component
- 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
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: SPI Component
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.
- 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
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel