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 support@ccsinfo.com

Multiple PIC communication
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Mon Jul 19, 2010 7:43 am     Reply with quote

Jerson wrote:
Sherpa

1 wire for data + 2 wires for power makes that 3-wires. Jay was talking (I think) about a 2 wire-only scheme and that is what I'm doing at the moment.

I hope I haven't mis-understood what you're saying, if so, my apologies

Jerson


My system uses a twisted shielded pair because that was the wire available. There were a lot of mechanical requirements on this job. A coax tends to fail under cyclical tension loading as the center conductor stretches, becomes too long for the rest of the cable, and buckles under compression from the rest of the cable as the tension is released. Simple twisted pairs don't last long being reeled and unreeled repeatedly. The cable had to support a 1000 pound load and be neutrally buoyant in seawater. The mechanical engineers said to use a TSP so the electronics was designed around that wire.

But the relevant point for this thread is that a bare PIC pin at 5V driving 1000 meters at 1200 baud bidirectionally works fine.
_________________
The search for better is endless. Instead simply find very good and get the job done.
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Mon Jul 19, 2010 9:03 am     Reply with quote

Quote:

But the relevant point for this thread is that a bare PIC pin at 5V driving 1000 meters at 1200 baud bidirectionally works fine.

Sherpa,
just to fully understand:
PIC (Master)---> 1000m (24 AWG) ---> CAP ---> PIC (Slave)
Is it right? If so, that is incredible!! How? never mind... Mr. Green

Jay,
it seems like an telex link. Did you use Iddle, Mark and Dot sense circuits? Also incredible!!!
I used to work in the Telex machines maintenance -second generation- with optocoupler punched tape readers...

regards,

Humberto
jbmiller



Joined: 07 Oct 2006
Posts: 73
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Jul 19, 2010 3:06 pm     Reply with quote

Humberto
My circuit is a bit 'odd'. Basically the master transmits +,-, or 0v voltage pulses, 'listens' for current flow, with respect to ground, hence I can and do only need ONE wire and Mother Earth for bi-directional, interleaved communications.In the 'old school' theme,sync,commands,datain,dataout are all bit position and level programmable and can be scrambled in the datastream making it ultra secure.To date noone has been able to hack it.

As for speed, the circuit originally had R-C timers in it, 'upgraded' to 4000 series CMOS, now the remotes are an 18 pin PIC. I'm sure it can go faster,especially inhouse,just never had the 'need for speed',and there is the fully backward compatability reasons..

Optocouplers ? Wow 'new stuff' to the old ASR-33s I had to maintain ! Should have kept one or two of them...probably worth a fortune today as 'antiques' !! LOL
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Mon Jul 19, 2010 4:59 pm     Reply with quote

Jay,
You made me laugh with your 'upgraded' to 4000 series CMOS.!!!
I guess that even the ASR-33s (Teletype Corporation) and the T100 (Siemens) were the responsible
of 99% of the global written communications in those days. They used to be very reliable, solid rock, un-hackable devices.
The point is that was widely used mainly in Banks, Embassies, only big companies and highly confidential point to point links.
I used to know some guys that were able to read "on fly" those punched paper tapes, something like an "5-bit human reader and decoder
in real time @ 50 bauds" !!! Idea Exclamation Very Happy

Cheers,

Humberto
neverlog



Joined: 02 May 2010
Posts: 36

View user's profile Send private message

PostPosted: Sun Jul 25, 2010 5:38 am     Reply with quote

Dear All,

I am newbie, I would like to ask below:

In the PBUSM.c example, it mention:

Optional: To monitor communications at a PC:
Connect pin B0 to RS232 TX and plug monitor PC into port B

1) What does it meant by "plug monitor PC into Port B"?

2) Can the PC send the command to and retrieve data from the PICs thru RS232?

Thanks in advance. Please help!
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Sun Jul 25, 2010 10:14 am     Reply with quote

Yes, you have the option to monitoring the events of this example with the help of a PC connecting the PIC
to a PC, NOT directly but through a signal level adaptor device that adapt the +5V used by the PIC and its asociated
circuits and +/- 12V present in a RS232 Comm PC port.
http://www.dataproductsplus.com/images/RS232data.gif

To connect a PIC to a PC, you need to adapt those voltage levels in order to not burn your PIC, using a dedicated
device namely RS232 Transceiver, like a MAX232 or similar:
http://www.sharps.lv/Informacija/PIC%20MCU/PIC/09_files/rs232.gif

A unique C Compiler canĀ“t afford to run the wide range of PIC MCU architectures, hence CCS was designed
compilers to fit according to each PIC family devices:
For 12-Bit PIC devices ( PIC16C55, PIC10F200, PIC12F509, RFPIC12C509,etc) you need a PCB Compiler
For 14-Bit PIC devices ( PIC16F887, PIC16F877A, PIC16F88, PIC16C66, etc) you need a PCM Compiler
For 18-Bit PIC devices ( PIC18F4520, PIC18F8722, PIC18F4550, PIC18F67J20, etc) you need a PCH Compiler.

Quote:

2) Can the PC send the command to and retrieve data from the PICs thru RS232?

Yes, connect your PIC according to the instructions in the begining of the example code, note that PCB, PCM, PCH
refer to compiler used according to the PIC family as explained previously:
Code:

////     PCB        pin A2 to RS232 RX, pin A3 to RS232 TX           ////
////     PCM,PCH    pin C7 to RS232 RX, pin C6 to RS232 TX           ////
////                                                                 ////


The program also shows how to handle two serial ports within one program using a single "protocol like" commands.
Note that for this are used hexadecimal values > 0x7F (dec 127)because they are out of the range of the ASCII printable/readable characters:
Code:

enum pbus_states {PBUS_IDLE=0x80,PBUS_NEED_LEN=0x81,PBUS_NEED_TO=0x82,
                  PBUS_NEED_FROM=0x83,PBUS_NEED_CS=0x84};


Humberto
neverlog



Joined: 02 May 2010
Posts: 36

View user's profile Send private message

PostPosted: Mon Jul 26, 2010 5:29 am     Reply with quote

Thanks! Humberto.

I am worry about frying my PIC, thats why I ask question before I on my PIC.

Thank you very much.

regards,
neverlog
neverlog



Joined: 02 May 2010
Posts: 36

View user's profile Send private message

PostPosted: Tue Jul 27, 2010 5:21 am     Reply with quote

Dear All,

Today I have tested out the single wire PIC-PIC communication. Everything is running fine, but I found some notebook with using RS232 to USB converter may somehow interfere the B0 signal.

I observed from the -scope. The signal was distort, and the data was unable to receive. Does any one have this experience?

It also happen when I am trying to use a RS232 to RJ45 convert from TIBBO(Taiwan). As I plug the Serial from PIC to Com port(TIBBO), the signal(B0) change from constant(Straight line) to distort line(Line become unstable)Actually I want to use the RS232 to RJ45 Adapter to remotely send command to PIC.

Feel free to comment. Thanks!!
jbmiller



Joined: 07 Oct 2006
Posts: 73
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Jul 27, 2010 6:06 am     Reply with quote

Sounds like bad grounds, either open or high resistance.

All USB converters have a CPU in them, can generate EMI (noise), so your circuits must have great grounds and shielding (even small value caps can help).
neverlog



Joined: 02 May 2010
Posts: 36

View user's profile Send private message

PostPosted: Tue Jul 27, 2010 9:02 am     Reply with quote

jbmiller wrote:
Sounds like bad grounds, either open or high resistance.

All USB converters have a CPU in them, can generate EMI (noise), so your circuits must have great grounds and shielding (even small value caps can help).


Thanks! jbmiller.

I am sorry and I am quite new to electronics as well. Since I am doing multiple PIC communication, do you mean I should ground all the PICs togather?

Please advise. Thanks in advance. I would appreciate helps from others as well.
jbmiller



Joined: 07 Oct 2006
Posts: 73
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Jul 27, 2010 9:06 am     Reply with quote

yes... electrons need a complete path to flow !

hope this helps

Jay
neverlog



Joined: 02 May 2010
Posts: 36

View user's profile Send private message

PostPosted: Wed Jul 28, 2010 9:08 am     Reply with quote

I have tested the program PBUSM.c today.

It works fine but only can send 8 bytes data.

Can anyone confirm that?

Thanks!
jbmiller



Joined: 07 Oct 2006
Posts: 73
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Jul 28, 2010 9:53 am     Reply with quote

In the defines area, close to the beginning this was found..

#define MAX_LENGTH 7

Haven't used the code but it looks like you can change this to anything reasonable for your purpose.

No harm in editing a copy of it and trying !

Jay
neverlog



Joined: 02 May 2010
Posts: 36

View user's profile Send private message

PostPosted: Thu Jul 29, 2010 8:06 am     Reply with quote

oppss...... sorry
neverlog



Joined: 02 May 2010
Posts: 36

View user's profile Send private message

PostPosted: Thu Aug 12, 2010 4:30 am     Reply with quote

Dear All,

Humberto wrote:
Code:

enum pbus_states {PBUS_IDLE=0x80,PBUS_NEED_LEN=0x81,PBUS_NEED_TO=0x82,
                  PBUS_NEED_FROM=0x83,PBUS_NEED_CS=0x84};


Humberto


Does anyone know what is PBUS_NEED_CS=0x84 using for?

I am trying to studying the code.

Thanks in advance!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
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