Page 1 of 1

Read Rs232 Sring in to Pic16F88 and let 2 steppers rotate

Posted: Fri Feb 27, 2009 8:19 pm
by silviodanceclub
Hello,

I want to control 2 stepper motors by an Pic16f88, i build it with 2 potmeters this works perfect. now i want to do this controlled bij rs232.

I cant get this to work, is there someone who can help me with this, i think its a timing issue.

When i startup the pic the led shows the incomming data, when i change the incoming data so one of the steppers will start to rotate ik wont do anything els then rotate the stepper very slow.

Hope someone can help me, here is my working file.
stepper controller.fcf
(13.5 KiB) Downloaded 331 times
Thanx.

Re: Read Rs232 Sring in to Pic16F88 and let 2 steppers rotate

Posted: Tue Mar 03, 2009 9:56 am
by Benj
Hello

Im guessing the problem is your RS232 read timeout. What you could do is setup the RXINT interrupt to allow you to:

a) read serial data as soon as it comes in so your speeds, directions etc are updated immediatly.

b) run your main loop without any RS232 read timeout delays.

Alternatively you can keep the RS232 read in your main loop but reduce the timeout to a low value eg 1 or 2.

Re: Read Rs232 Sring in to Pic16F88 and let 2 steppers rotate

Posted: Sat Mar 07, 2009 1:18 pm
by silviodanceclub
Thanx for the response Benj.

I build the project with the Rs232 interupt, I have an led connected at B4 that will light up when the rs232 Start bit is received. that wont light up.
the code is for an robot project, the main unit will constantly send the rs232 commands so the led should blink fast.
Did i make an mistake in the interrupt ?

I dont know if it is possible to run 2 main loops at the same time. on that way i could run the main rs232 loop as fast as possible and i can delay the stepper loop as slow as i need.

hope you could help me.

See the atteched file.

Re: Read Rs232 Sring in to Pic16F88 and let 2 steppers rotate

Posted: Sat Mar 07, 2009 5:35 pm
by Dan81
hello

I think there is an error in the "Custom interrupt properties".

Flag register must be "pir1" and not "pie1".

see 16F88 pdf p: 21

I've changed also RS232_RX macro, but it is not tested .


Daniel

Re: Read Rs232 Sring in to Pic16F88 and let 2 steppers rotate

Posted: Wed Apr 08, 2009 8:22 pm
by silviodanceclub
This works perfect !

Thanx :-)