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.
Thanx.
Read Rs232 Sring in to Pic16F88 and let 2 steppers rotate
-
- Posts: 12
- Joined: Tue Oct 30, 2007 11:10 am
- Contact:
- 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: Read Rs232 Sring in to Pic16F88 and let 2 steppers rotate
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.
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.
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
-
- Posts: 12
- Joined: Tue Oct 30, 2007 11:10 am
- Contact:
Re: Read Rs232 Sring in to Pic16F88 and let 2 steppers rotate
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.
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.
- Attachments
-
- stepper int test.fcf
- (16.5 KiB) Downloaded 323 times
- Dan81
- Valued Contributor
- Posts: 268
- Joined: Sun Jan 15, 2006 4:07 pm
- Location: Albi France
- Been thanked: 60 times
- Contact:
Re: Read Rs232 Sring in to Pic16F88 and let 2 steppers rotate
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
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
- Attachments
-
- stepper int test2.fcf
- (8.5 KiB) Downloaded 377 times
-
- Posts: 12
- Joined: Tue Oct 30, 2007 11:10 am
- Contact: