Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
LinkBack Thread Tools Display Modes
Old 4th March 2006, 10:02 PM   (permalink)
Default comm between 2 pics

Well offcourse it should be possible.

I have only one Line / Pin.
It Should be 2 way communication.
With out an clockline....
anyone ideas how to do the job??
One side is 4Mhz the other side is 20Mhz.
Speed isn't important.

Is it true that i just can hook up the pins to each other??

I'm debugging the 2 pics with both one debug pin connected to the comport of my pc...

but the problem i have is that how do i switch from sending to recieving on one pin.. because the other side will see this as one bit/byte not??

Tks
TKS is offline  
Old 4th March 2006, 10:19 PM   (permalink)
Default

Manchester or "1 wire"
__________________
Il give you shocking experience.
Someone Electro is offline  
Old 4th March 2006, 10:51 PM   (permalink)
Default

All you need is simple serial comms, simply connect the pins together and connect them to a pull-up resistor. Set both pins as inputs, the pull-up resistor will cause them both to read HIGH.

In order to send data make one PIC an output, and set the pin LOW, this is the start bit for the serial comms - carry on as normal sending the byte just like RS232, ending with a stop bit (setting the pin HIGH again, then TRIS'ing back to an input).

The receiving side simply waits until it gets a start bit, then does the normal serial receive routine.

To transmit the other way, simply reverse the process!.

There's no need for Manchester coding, it would provide no functionality whatsoever, and would slow things down.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now  
Old 4th March 2006, 11:08 PM   (permalink)
Default mhh...

The true is nigel that i use

an compiler, would the hardware requirements change??

I now don't use the pullup, and it works sometimes, but not always..

also many times one of the devies keep reading the pin..(waiting for data,)

with as an result the other also start waiting because he just sended the data.

Will try the pull up.. (4K res to 5volt rails)

maybe i could do something witht he dallas 1 wire wich is also built in...

but serial is already ready..

when i dont use the wait for char command also the devices keep seeing bytes etc.. sow maybe the pins are then floating arround????



Tks
TKS is offline  
Old 4th March 2006, 11:11 PM   (permalink)
Default

If you're using a high level compiler you're severely restricting your options - I'm presuming you're trying to use the in-built comms routines?. However, there's nothing to stop you writing your own routines in C (assuming it's a C compiler you're using?).
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now  
Old 4th March 2006, 11:14 PM   (permalink)
Default well

it works perfectly, its just this problem wich
every time comes up!

The crystal problem with the smartcard is now just like you said.
The mod i did was, i now use as clock source the same chip.
with a 4mhz external OSC.

Sow the impedance and every other param are more the same..

and the chips will be exactly doing the same.

TKs
TKS is offline  
Old 4th March 2006, 11:18 PM   (permalink)
Default Re: well

Quote:
Originally Posted by TKS
it works perfectly, its just this problem wich
every time comes up!

The crystal problem with the smartcard is now just like you said.
The mod i did was, i now use as clock source the same chip.
with a 4mhz external OSC.

Sow the impedance and every other param are more the same..

and the chips will be exactly doing the same.

TKs
So this is for communication between a PIC and a smartcard (which contains a PIC)?.

Why have you only got one pin available for the communication?, smartcards give at least three - MCLR, and the data and clock pins so that you can program it.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now  
Old 5th March 2006, 03:47 PM   (permalink)
Default SmartCards

Have MCLR,Clock,Data pin..

(and VDD, VSS)

Clock you will need to startup the device in that matter that it works..and processes your programm.

MCLR you will need to put it high sow it starts processing to.(reset pin)..

And Data Pin is then the only one wich is free available for communication / verication purposes....

Because of the fact that it would be very insecure to not make it 2way comm. You will need to switch input / ouput many times.

The problem i had nigel was just the pullup resistor.
Big Fault/ Big consequences the problem was that it worked a few times...

But now its reliable.

Tks
TKS is offline  
Old 5th March 2006, 04:30 PM   (permalink)
Default

You're missing a pin that has to be there!.

Assuming it's a PIC on the smartcard?.

To program the PIC it requires:

Vdd
Vss
MCLR
RB6 (programming clock)
RB7 (programming data)

For the smartcard to run a program it require:

Vdd
Vss
MCLR
Oscillator input (pin 16 on a 16x84)

This gives a total of six connections to the PIC on the card, two of which (RB6 and RB7) are general purpose I/O pins.

Are you perhaps confusing the programming clock input with the main oscillator input?.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now  
Old 5th March 2006, 05:35 PM   (permalink)
Default ahhhh

sorry to mention!!!

but the RB6 is internally connected to the clock line.

So while programming you use the clock line for the RB6 pin..

while normally use you just use clock..

sow only RB7 is there for the outside world.

I was lucky that i had some PCB smartcards with the same pics sow i just made an serial debugpin on them..
etc..

Sow i could test with an unlimitted pic...and in real life i just use the wafer edition.
Attached Images
File Type: gif waferpinoutiso7816pinout.gif (11.4 KB, 532 views)
TKS is offline  
Old 5th March 2006, 05:36 PM   (permalink)
Default

Clock Source!!

use same pic model for best performance..
Attached Images
File Type: gif cardclock_699.gif (9.5 KB, 531 views)
TKS is offline  
Old 5th March 2006, 05:37 PM   (permalink)
Default Goldcard / Wafer NAKED!!

Attached Images
File Type: gif goldcardinfo_167.gif (14.0 KB, 527 views)
TKS is offline  
Old 7th March 2006, 10:10 PM   (permalink)
Default Nigellll

I now have the situation

that i have 2 lines available and i wanted to do the same trick.

Sow i hooked u Rx with Tx and Tx with Rx this is correct i asume??

Is here also the need of the 4,7K pullups????

If sow wy not when using an MAX232???

Regards,

Tks
TKS is offline  
Old 8th March 2006, 09:17 AM   (permalink)
Default Re: Nigellll

Quote:
Originally Posted by TKS
I now have the situation

that i have 2 lines available and i wanted to do the same trick.

Sow i hooked u Rx with Tx and Tx with Rx this is correct i asume??
Yes.

Quote:

Is here also the need of the 4,7K pullups????

If sow wy not when using an MAX232???
No, you don't need any pullups - because the inputs and outputs don't change over.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now  
Old 8th March 2006, 09:05 PM   (permalink)
Default

Quote:
Originally Posted by Nigel Goodwin
If you're using a high level compiler you're severely restricting your options - I'm presuming you're trying to use the in-built comms routines?. However, there's nothing to stop you writing your own routines in C (assuming it's a C compiler you're using?).
TKS, which compiler are you using? And does your PIC have a USART?

Most C programmers do not use built-in compiler routines and do not recommend them. They are not versatile or portable and it's simply more direct to write to the registers in a way similar to assembly. The difficulty is in time-critical bit-banged routines; that is, those not using hardware modules and not timed by timer interrupts. The problem is still resolvable.
__________________
I thought what I'd do was I'd pretend I was one of those deaf-mutes.
Oznog is offline  
Reply

Bookmarks

Thread Tools
Display Modes





All times are GMT. The time now is 05:49 PM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

eXTReMe Tracker