Read Rs232 Sring in to Pic16F88 and let 2 steppers rotate

Any general or miscellaneous queries that do not fit into the other forum catagories

Moderators: Benj, Mods

Post Reply
silviodanceclub
Posts: 12
Joined: Tue Oct 30, 2007 11:10 am
Contact:

Read Rs232 Sring in to Pic16F88 and let 2 steppers rotate

Post 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 329 times
Thanx.

User avatar
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

Post 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.

silviodanceclub
Posts: 12
Joined: Tue Oct 30, 2007 11:10 am
Contact:

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

Post 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.
Attachments
stepper int test.fcf
(16.5 KiB) Downloaded 318 times

User avatar
Dan81
Valued Contributor
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

Post 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
Attachments
stepper int test2.fcf
(8.5 KiB) Downloaded 373 times

silviodanceclub
Posts: 12
Joined: Tue Oct 30, 2007 11:10 am
Contact:

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

Post by silviodanceclub »

This works perfect !

Thanx :-)

Post Reply