CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Communication between 2 processors

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ertansuluagac



Joined: 13 Jul 2017
Posts: 135
Location: IZMIR

View user's profile Send private message Send e-mail

Communication between 2 processors
PostPosted: Thu Nov 28, 2019 6:19 am     Reply with quote

I want to have 2 processors talk among themselves. Is serial communication a good method? or is there a method you can suggest?
Used processors:
18f45k22
18f67k40
_________________
Es
temtronic



Joined: 01 Jul 2010
Posts: 9229
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Nov 28, 2019 6:28 am     Reply with quote

It depends upon how much data has to be sent to them,how often and distance. Obviously parallel is faster( bytes or nibbles vs bits) but serial may be easier for you , especially for testing. You can 'sniff' the data with a PC and terminal program. Distance ? if less than 10 feet use parallel for speed.

Jay
ertansuluagac



Joined: 13 Jul 2017
Posts: 135
Location: IZMIR

View user's profile Send private message Send e-mail

PostPosted: Thu Nov 28, 2019 7:00 am     Reply with quote

There is no distance anyway. They will be on the same card. I'm using the first processor to drive the screen. And I use the data from the second processor to press the screen.

2. The processor will send the data generated to the 1st processor. So:

1. Processor 2. Processor
RX ---------> TX
TX <------- RX
it will be.
_________________
Es
temtronic



Joined: 01 Jul 2010
Posts: 9229
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Nov 28, 2019 7:08 am     Reply with quote

Assuming an LCD 'screen', use serial as it takes longer to display data on LCD than actual data transfers, so no benefit from using parallel methods.

Jay
ertansuluagac



Joined: 13 Jul 2017
Posts: 135
Location: IZMIR

View user's profile Send private message Send e-mail

PostPosted: Thu Nov 28, 2019 11:35 am     Reply with quote

I think there is no need for max232 between the two processors. Or do have?
_________________
Es
Ttelmah



Joined: 11 Mar 2010
Posts: 19518

View user's profile Send private message

PostPosted: Thu Nov 28, 2019 11:46 am     Reply with quote

None whatsoever. Just direct wire. Choose a baud rate dependant on how
long the connection is. If only a few inched 500000bps for example. If
longer bring this down. Remember if you do use a fast rate you must
use interrupt driven receive.
ertansuluagac



Joined: 13 Jul 2017
Posts: 135
Location: IZMIR

View user's profile Send private message Send e-mail

PostPosted: Thu Nov 28, 2019 11:58 am     Reply with quote

near. They will even be on the same card. 1. The processor is constantly sending data.
I'm using the second processor to drive 320x240 graphics lcd. and, I print data values from the first processor.

Code:

Communication setting
TX(master)
#include<18F67K40.h>
#use delay(clock=64MHz,crystal=16MHz)

#pin_select U1TX = PIN_D0
#pin_select U1RX = PIN_D1
#use rs232(UART1,parity=N,bits=8,stop=1,stream=PORT1)

RX(slave)
#include<18F45K22.h>
#use delay(clock=64MHz,crystal=16MHz)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8,stop=1,stream=PORT1)


_________________
Es
alan



Joined: 12 Nov 2012
Posts: 357
Location: South Africa

View user's profile Send private message

PostPosted: Thu Nov 28, 2019 1:21 pm     Reply with quote

Wht not use SPI if you have spare pin. Comms are then synchronous if that are needed.
Ttelmah



Joined: 11 Mar 2010
Posts: 19518

View user's profile Send private message

PostPosted: Thu Nov 28, 2019 2:02 pm     Reply with quote

A question here is what the chips use for clocks?.
If the two chips both have crystals, or share an external master oscillator,
or both have oscillators that are guaranteed to remain within a small
percentage of one another, then really SPI has no advantage. Simple
async, is easier to code and uses less wires. Where SPI 'wins' is if the
clock cannot be guaranteed to be this close. It also does give a fractionally
higher throughput for a given baud rate (1.25*), by not requiring start
or stop bits.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group