Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

SPI Interface

Status
Not open for further replies.

Ali_MAK

New Member
I am using a PIC16F877A and on that chip I am using both the CCP pins to control two separate motors.

The program will send the same PWM to both motors at some situations.

I want to make sure that both motors are running at the same speed when I do that so I am putting micro switches on both motors and want to count the ON/OFF change on each switch to determine if both motors are running at the same speed.

To do that I have to use the CCP pins in capture mode but since I'm already using them to produce PWM signals to control the motors, I need to use another PIC16F877A chip for the task.

I tried to connect the two chips using the SPI interface method but I'm not quiet sure that I'm doing it the right way.

I programmed both chips separately and then removed the (slave) chip from the programmer and connected the SDO, SDI and SCK on both chips as shown in the manual

Now:
do I need to connect 5V and ground from the Master to the Slave chip?

is there a special command that I need to use for sending data from one chip to another?

cause now I just tell the slave chip to read a signal, store it in a variable and then make the SDI pin = the variable

btw: I am using PIC Basic Pro compiler

thank you in advance for your help
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top