conection pic to pic

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
aerofrick
Posts: 23
Joined: Mon Mar 08, 2010 4:37 pm
Location: Slovenia
Has thanked: 2 times
Contact:

conection pic to pic

Post by aerofrick »

Hi

I am quite new in programming pic microcontrollers and I was wondering witch connection pic to pic would be the easiest and best to perform.

I havent decided on witch pic to use but I am thinking about using PIC16F1933 or PIC18F2331.
I want to use three adjustable resistors an LCD display (4?20) and a keypad and link this on the first pic on one end of the cable. On the other end I would have another pic witch would generate three individual PWM signals each controlled with an adjustable resistor linked to the first pic witch would drive motors. This second pic would also have a temperature sensor (DS18S20 or DS18B20) and few sensors that work as adjustable resistors and data from these sensors would be displayed on the LCD connected to the first pic.

I already got some tips about what communication to use but I havent decided witch is better and easier to create and use.

Any help appreciated
Jan

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Has thanked: 6 times
Been thanked: 44 times
Contact:

Re: conection pic to pic

Post by Sean »

Hello Jan,

Your application appears to require bi-directional communications, so UARTs (RS232) will probably provide the simplest solution.

The Flowcode RS232 component should provide all the features you need. If the cable is relatively short, and the environment is not too electrically noisy, you might be able to connect the devices together directly (using a cross-over cable configuration).

If the application does not allow this, RS232 drivers can be used to improve signal transmission (as used on the RS232 e-block)

Alternatively, the UARTs could be connected via RS485 drivers (see the RS485 article in the Articles thread of this forum).

The RS485 example programs transmit data to each other with one acting as master - transmitting data to the slave device and requesting data from it. This helps to prevent the message collisions that can occur when two masters are trying to communicate.

Other possibilities, using the appropriate e-blocks and Flowcode components, are CAN and LIN.

aerofrick
Posts: 23
Joined: Mon Mar 08, 2010 4:37 pm
Location: Slovenia
Has thanked: 2 times
Contact:

Re: conection pic to pic

Post by aerofrick »

Hi

I saw you mentioned the distance of the cable. The distance of the cable is about 35m or 105 feet. In order to work a friend that is helping me with the project suggested me to use two max232 and place them one next to each pic so the amplitude of data being transferred would be higher there for there would be les chance that the data would get lost.

I also tried to create a communication with RS232 but using a shorter cable but it didnt work. I must have forgotten to ad something to the program.
I tried to send a PWM signal thru this 35m long UTP cable and it was still good enough on the other end that it controlled the servo motors.

There is one more question. Does the power supply have to be the same for both pic microcontrollers in order for this communication to work or can I use just the same source (car battery) and then lower the voltage to 5V (I'll probably use LM7805 or a 5V switcher)

Jan

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Has thanked: 6 times
Been thanked: 44 times
Contact:

Re: conection pic to pic

Post by Sean »

Hello,

35m is a long way even for RS232 communications. There might be limitations on the achievable Baud rate at this range. The routing of the cable will also have an affect on interference (not a strong point of RS232).

RS485 is better suited to communications at this range, and is relatively easy to implement using SN75176 drivers (or similar). It uses 5V differential signalling, so there is no need for a +/-12V supply or the charge pump circuits required by most RS232 drivers. RS485 does require twisted pair cable and terminating resistors to work to its full specification.

If separate power supplies are being used, a common 0V connection should be provided in the cable. The outer shield can sometimes be used for this purpose if screened cable is used.

Post Reply