16F877A - TWO FUTABA SERVOS AND USART

Forum for problems or queries regarding other Flowcode Components. Eg LEDs, Switches, LCD, Gfx LCD etc

Moderators: Benj, Mods

Cris
Posts: 16
Joined: Sun Nov 02, 2008 7:25 pm
Contact:

16F877A - TWO FUTABA SERVOS AND USART

Postby Cris » Fri Mar 26, 2010 1:17 am

Hello all,

I’m working on a project using two Futaba servos with programming based on an example found in this user forum. The servos work fine but the example program uses all of port “C” on the 16F877A. My problem is that I need to use the USART function for RS232 communication and it won’t function due to the way the program uses all of port C. I have tried different ways to free up RC 6 and 7 (RC/TX) but have been unsuccessful, and not having great programming skills (I use FlowCode Pro v3) I am unable to change the program to use say port D instead of port C.

I tried masking port c and changing the output symbols to another port but there is more to it than just that. I see some strange code in the Int. routine, little square boxes that I’m not sure how to do with a keyboard and I'm not sure what they mean. I need some help to change the code so it will use another port to operate my two Futaba servos and still have a working USART function. Is it possible to use the Int. routine as it is used in this program and still have the off chip communications work. I have uploaded the example program that I am referring to. Any help would be appreciated.
Also can you please give info based on using FlowCode V3.6, I ask because I found the same example in the FC v3 section of the forum that had changes made but I think they were done with V4 because I can’t open them to see what was changed or if they have another port being used. Thanks guys.

Cris
Attachments
MultiServo2.fcf
(8 KiB) Downloaded 234 times

User avatar
Benj
Matrix Staff
Posts: 14073
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4297 times
Been thanked: 4050 times
Contact:

Re: 16F877A - TWO FUTABA SERVOS AND USART

Postby Benj » Fri Mar 26, 2010 10:56 am

Hello Cris

In the CCP1_isr macro open the output icon properties and tick the use masking box. Then tick all the values from 0 - 5.

Next in the CCP2_isr macro do the same for the output icon.

The RS232 component should then work correctly in your program.

You should also be able to switch the ports for both these icons if you wish. The square boxes that are appearing tin the custom interrupt code are simply carriage returns that have been turned into unicode. Nothing to worry about and they can be deleted if you wish.