void Move(){
TrisB = 0x00;
PortB = 0x00;
PORTB=0b00000110;
Delay_ms(50);
PORTB=0b00000101;
}
void Move(){
TrisB = 0x00;
PortB = 0x00;
PORTB=0b00000110; // portB from second pic
Delay_ms(50);
PORTB=0b00000101; // portB from second pic
}
PORTC=0b00000110; // portC from second pic
Delay_ms(50);
PORTC=0b00000101; // portC from second pic
PORTD=0b00000110; // portD from second pic
Delay_ms(50);
PORTD=0b00000101; // portD from second pic
You only need 4 outputs max to drive a conventional bipolar stepper motor, so why not find a microcontroller with 4 additional pins.
If you really want to use two microcontrollers, then technically I suppose you could connect the two Rx pins together, and have each
microcontroller listen for it's own instructions simultaneously. Obviously, you can't connect the two Tx pins together (think about why).
In that case, a distributed approach will need to be used. Highly worth considering dedicated stepper motor controllers, unless you're implementing some novel motor control in your PIC.I want to control 5-6 more motors.
You can tie Rx pins on the microcontroller together. It's not a great approach, but should work.
void main(void)
{
PORTB=0b00000110; //first pic
Delay_ms(50);
PORTB=0b00000101; //first pic
Delay_ms(50);
PORTC_OF_SECOND_PIC=0b00000101; //second pic
Delay_ms(50);
Depends what you mean by communicate - bidirectional? Or just from PC to PIC and not PIC to PC?If you need to connect two or 3 pics and PC communication so that pics communicate
and one of them can communicate with pc what can you do?
Correct, this is fine.Without any pc communication, just two pics communication i can do this :
Pic 1 Tx ----> Rx Pic 2
Pic 1 Rx ----> Tx Pic 2
Correct, this is possible.With pc communication bidirectional and two pics it can NOT be done and only i can do this one way communication
pc--> Rx pic1 --> Tx pic1 ---> Rx pic2 (and optionaly) Tx pic2---> Pc
AgreeSo with this i can send data from pc to pic1(Tx1 not connected with pc) and then from pic 1 send data to pic2 (with Tx1 to Rx2)
and if i want to send data to pc i can use the Tx pic2 to send to pc.
Yes, this is correct. (assuming you're using the MAX232 for the first and last legs of this chain, i.e. the connections to the PC - but I think you know this).And like that i can only send data to pic1 from pc and not receive from pic1 to pc
and pic2 can only receive from pic1 and not tranceive to pic1 because pc tranceiving to pic1,but if i want
i can tranceive from pic2 to pc.
It's an ugly thing to program, so you may prefer to have a single larger microcontroller and multiple stepper motor control ics.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?