communication between 2 pic16f877a

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
some3
Flowcode V4 User
Posts: 20
Joined: Tue Mar 09, 2010 6:01 am
Has thanked: 1 time

communication between 2 pic16f877a

Post by some3 »

hi

I am building a cnc machine (3 axis)
I'm planing to build a control panel whit a lcd 4*20 controled by a pic 16f877a this pic will be just for controling the lcd, 2 led, 6 butons. in the contrl cabinet will be a 2nd pic aloso a 16f877a this pic will be "the brains" behinde all the inputs and outputs(16 relay output, 10digital input,2 analog input (I will not use al of thes I/O just hardwear) this control panel setup will be used just for manual operation of the machine like joging individual axis spindle on off error dysplay......(main control of the machine is mach3)

Lenght of the cable from one pic to the other will be aproximely 6m or 20feet

I need your help to conect the two pic together whit some tipe of communication I was thinking rs232 or something else

tnx for melp :)

User avatar
fotios
Posts: 458
Joined: Mon Feb 08, 2010 10:17 am
Location: Greece
Has thanked: 109 times
Been thanked: 117 times

Re: communication between 2 pic16f877a

Post by fotios »

Hello some3
You should know that is my secret dream; to build a CNC machine like you, but i haven't money left over to do this at the moment :( . I have a question: can you replace the P16F877A with the new P16F887? The cost is negligible compared to mechanical parts, and P16F887 will make your life easiest in the course.
You should know that with Mach3 of ArtSoft, you have to use a parallel port (LPT) of PC. I have checked this 3 - 4 months ago, i don't know if things have changed, please take a look on Mach3 official web page for recent upgrades. There are new programs that use the USB ports of PC. Try a search (if you did not this already) at e-bay: e.g. CNC-USB. I will post you later a link, i have stored it in my account on e-bay.
Best Regards
Fotis
Best Regards FOTIS ANAGNOSTOU

some3
Flowcode V4 User
Posts: 20
Joined: Tue Mar 09, 2010 6:01 am
Has thanked: 1 time

Re: communication between 2 pic16f877a

Post by some3 »

I will stick to my version of mach....and alsow I think that usb devices are to slow for things like this(experience from pokeays)maby I am wrong.
The only reason I am doing thic control unit(besides from learning) is This is my diploma I want something more on my machine.

on topic
no problem I can replace the 16f877a whit the 16f877 but what will be the diferenc.

User avatar
fotios
Posts: 458
Joined: Mon Feb 08, 2010 10:17 am
Location: Greece
Has thanked: 109 times
Been thanked: 117 times

Re: communication between 2 pic16f877a

Post by fotios »

some3 wrote:I will stick to my version of mach....and alsow I think that usb devices are to slow for things like this(experience from pokeays)maby I am wrong.
The only reason I am doing thic control unit(besides from learning) is This is my diploma I want something more on my machine.

on topic
no problem I can replace the 16f877a whit the 16f877 but what will be the diferenc.
OK, i haven't practical experience with CNC machines; my knowledge comes from anything i have read and i have seen on the internet so far. For example, the last 2 years i have seen many DIY CNC machines controlled from Laptops and i know that ArtSoft's Mach3 does not run on such computers due to their integrated graphics card; therefore, in these DIY CNC machines, communication between Laptop and stepper motor controllers should be done thru a USB port. In your case - if i understand well - you already have an existing CNC machine which of stepper motor controllers are managed from Mach3, and you are looking to build an extra - industrial looking - controll system to work in parallel mode with the existing PC, so your option to stay sticked with Mach3 is absolutelly understandable :wink: . In my case, when i will be ready - from money - to build a CNC machine i will make it controlled from the USB port of my Laptop and of course i will use a different G-Code software than Mach3. I know that LPT port is very fast, maybe faster than USB2, but i think that the communication speed does not affects the precision of machine. For me, the flexibility and portability of the CNC system is of bigger importance than processing speed. That is all. :D
Regarding extras of P16F887 compared to P16F887A:
1) Precision internal oscillator module adjustable up to 8MHz. No need for configuration of "OSCCON" register if the factory calibrated Fosc = 4MHz (+/-1%) is enough for your project (e.g. for driving LCDs is just fine). No need for external XTAL, so 2 more pins available for I/O.
2) Precision internal MCLR module; if enabled no need for external R - C circuit to reset the micro during start-up.
With few words, you can have 36 pins available as general I/O ports.
3) Better handling of Port B. Internal weak pull-ups are individually activated on all of 8 pins of Port B. No need for external pull-up resistors connected at switch inputs. Interrupt On Change state in all of 8 pins - individually activated on each pin - of Port B.
And much more; P16F887 is the upgrade of P16F877A which was the upgrade of P16F877.
Probably, all that might be incomprehensible for you at ths time. You will discover their value in the course (like me) when you will have the need to explore deeper the possibilities of microcontroller, working with different projects.
Regards
Fotis
Best Regards FOTIS ANAGNOSTOU

some3
Flowcode V4 User
Posts: 20
Joined: Tue Mar 09, 2010 6:01 am
Has thanked: 1 time

Re: communication between 2 pic16f877a

Post by some3 »

:)

I just orderd 5 of 16f877.

now what cinde of communication would you use . I was experimenting whit rs232 and to 16f877a(just had them lying around)in simulation it worked(vnet) it woked ok but the problem is the hardwear I dont know how to select the pins of the chip so thet it workes like it should(in real life)

User avatar
fotios
Posts: 458
Joined: Mon Feb 08, 2010 10:17 am
Location: Greece
Has thanked: 109 times
Been thanked: 117 times

Re: communication between 2 pic16f877a

Post by fotios »

some3 wrote::)

I just orderd 5 of 16f877.

now what cinde of communication would you use . I was experimenting whit rs232 and to 16f877a(just had them lying around)in simulation it worked(vnet) it woked ok but the problem is the hardwear I dont know how to select the pins of the chip so thet it workes like it should(in real life)
OK, P16F877 is just fine. :)
As for communications between PICs, i know nothing! You should wait until tomorow when the experts of MM tech team and some expertised members will be back again on the forum.
From those i know, many people preffer the I2C communications protocol between micros. FlowCode offers ready "component macros" for it, and lot of examples.
Regards
Fotis
Best Regards FOTIS ANAGNOSTOU

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: communication between 2 pic16f877a

Post by Benj »

Hello,

RS485 is commonly used for multi-drop or multi-node networks between micros, this would simply use the RS232 component in Flowcode. Maybe in 9 bit mode as detailed in the article.

See this article for more information.
http://www.matrixmultimedia.com/article.php?a=419

I made a USB CNC machine which sent down the required positions to the PIC and the PIC then interpolated via linear movements to the desired position. It worked well and wasn't noticeably slow but then my machine is fairly big and bulky so won't move that fast anyway. To be fair I did also write my own controller software from scratch using the Mach3 LazyCAM software to convert my CAD files into G-code format which I then parsed.

This is a handy website if you've not already seen it.
http://buildyourcnc.com/default.aspx

some3
Flowcode V4 User
Posts: 20
Joined: Tue Mar 09, 2010 6:01 am
Has thanked: 1 time

Re: communication between 2 pic16f877a

Post by some3 »

hi
I'm sory for a long time no replay (job and other stuff)

I have problem whith hardwear can somebody give me a scematics and how to setup the confugiration of the rs232.

ps:

benj you mentionedm rs485 which is fine but how do I get rs485 from the pic (or flowcode) is it posible to just add a standart rs232 to rs485 converter

but for now I would be happy just whit rs232 which is alredi marde in flowcode.

tnx
psps:
I will run whit 16f877a pics because I cant order 16f877 in slovenia nobody has them:(
and I also have 12 chips at home(wrong ordering).

Post Reply