Maker Pro
Maker Pro

Parallel Port Interface between PIC and PC

R

Rajiv Ghanta

Jan 1, 1970
0
hi there,

my current project involves designing a circular sonar-sensor array to
be incorporated onto a mobile robot. the hardware design i had in mind
was simple - the sensors would communicate with a PIC via I2C, which
would then transmit the readings to the laptop on the robot. i managed
to implement the I2C interface between the PIC and the sensors. i now
need to establish communication between the PIC and the laptop on the
robot. the laptop has two ports, a USB port and a parallel port. i'm
pretty sure it's much easier to try to develop a parallel port
interface. could somebody guide me through this process? i don't know
if this complicates matters, but the laptop on the robot is running a
real-time operating system called QNX. if there are any other details
i can provide, please let me know.

any help would be appreciated. thanks,

rajiv
 
L

Luhan Monat

Jan 1, 1970
0
Rajiv said:
hi there,

my current project involves designing a circular sonar-sensor array to
be incorporated onto a mobile robot. the hardware design i had in mind
was simple - the sensors would communicate with a PIC via I2C, which
would then transmit the readings to the laptop on the robot. i managed
to implement the I2C interface between the PIC and the sensors. i now
need to establish communication between the PIC and the laptop on the
robot. the laptop has two ports, a USB port and a parallel port. i'm
pretty sure it's much easier to try to develop a parallel port
interface. could somebody guide me through this process? i don't know
if this complicates matters, but the laptop on the robot is running a
real-time operating system called QNX. if there are any other details
i can provide, please let me know.

any help would be appreciated. thanks,

rajiv
Unfortunately, the usual and easy way to do this is with the computer's
com (serial) port. I would suggest a serial card be added to the
computer if possible. You may have to do either the i2c or uart
function in software in the PIC - I'm not sure if any of them do both.
 
L

Luhan Monat

Jan 1, 1970
0
Luhan Monat wrote:

Unfortunately, the usual and easy way to do this is with the computer's
com (serial) port. I would suggest a serial card be added to the
computer if possible. You may have to do either the i2c or uart
function in software in the PIC - I'm not sure if any of them do both.

I checked my PIC documentation - several have uarts, none have i2c --
that is always done in software. Microchips web site has lots of
documentation on this.
 
M

Michael

Jan 1, 1970
0
Rajiv said:
hi there,

my current project involves designing a circular sonar-sensor array to
be incorporated onto a mobile robot. the hardware design i had in mind
was simple - the sensors would communicate with a PIC via I2C, which
would then transmit the readings to the laptop on the robot. i managed
to implement the I2C interface between the PIC and the sensors. i now
need to establish communication between the PIC and the laptop on the
robot. the laptop has two ports, a USB port and a parallel port. i'm
pretty sure it's much easier to try to develop a parallel port
interface. could somebody guide me through this process? i don't know
if this complicates matters, but the laptop on the robot is running a
real-time operating system called QNX. if there are any other details
i can provide, please let me know.

any help would be appreciated. thanks,

rajiv


For info. on interfacing comm and parallel ports, check out Jan Axelson's site.
I've found her stuff very helpful.
 
R

Rich Grise

Jan 1, 1970
0
hi there,

my current project involves designing a circular sonar-sensor array to be
incorporated onto a mobile robot. the hardware design i had in mind was
simple - the sensors would communicate with a PIC via I2C, which would
then transmit the readings to the laptop on the robot. i managed to
implement the I2C interface between the PIC and the sensors. i now need
to establish communication between the PIC and the laptop on the robot.
the laptop has two ports, a USB port and a parallel port. i'm pretty sure
it's much easier to try to develop a parallel port interface. could
somebody guide me through this process? i don't know if this complicates
matters, but the laptop on the robot is running a real-time operating
system called QNX. if there are any other details i can provide, please
let me know.

I'm not at all familiar with QNX - you'd have to look up parallel port
drivers, but implementing a parallel interface is almost trivial. Heck,
it might even let you talk directly to the hardware, albeit you'd still
need a device that you can take ownership of, if you're multitasking.

Check some of these references:
http://www.google.com/search?q=PC+parallel+port+interface

That should tell you everything you need to know on the PC/hardware side.
In a nutshell, you need one 8-bit bidirectional port on the PIC - I
haven't actually used a PIC, but I'm sure they have at least 8 parallel
lines, and at least one handshaking input and one handshaking output.
There are five handshaking lines on the PC, so you can do pretty much
anything you want to, like,

"I have data"
"I'm ready for data"
"OK, here's the data"
"Got it!"
"OK, got your ack."
<idle>

Which you can do both directions.

Hope This Helps!
Rich
 
M

Michael

Jan 1, 1970
0
Rich said:
I'm not at all familiar with QNX - you'd have to look up parallel port
drivers, but implementing a parallel interface is almost trivial. Heck,
it might even let you talk directly to the hardware, albeit you'd still
need a device that you can take ownership of, if you're multitasking.

Check some of these references:
http://www.google.com/search?q=PC+parallel+port+interface

That should tell you everything you need to know on the PC/hardware side.
In a nutshell, you need one 8-bit bidirectional port on the PIC - I
haven't actually used a PIC, but I'm sure they have at least 8 parallel
lines, and at least one handshaking input and one handshaking output.
There are five handshaking lines on the PC, so you can do pretty much
anything you want to, like,

"I have data"
"I'm ready for data"
"OK, here's the data"
"Got it!"
"OK, got your ack."
<idle>

Which you can do both directions.

Hope This Helps!
Rich


Good ol' "DC interlock". Near and dear to my heart. Any other fossel out there
recognize the following?

Addr-Out
Select-Out + Hold-Out
Op-In
Adr-In
Cmd-Out
.....
Svc-In
Svc-Out
....
Status-In
Svc-Out

DONE

[I *think* I got the sequence right. It's been a long time. :) ]
 
L

Luhan Monat

Jan 1, 1970
0
Michael said:
Rich said:
I'm not at all familiar with QNX - you'd have to look up parallel port
drivers, but implementing a parallel interface is almost trivial. Heck,
it might even let you talk directly to the hardware, albeit you'd still
need a device that you can take ownership of, if you're multitasking.

Check some of these references:
http://www.google.com/search?q=PC+parallel+port+interface

That should tell you everything you need to know on the PC/hardware side.
In a nutshell, you need one 8-bit bidirectional port on the PIC - I
haven't actually used a PIC, but I'm sure they have at least 8 parallel
lines, and at least one handshaking input and one handshaking output.
There are five handshaking lines on the PC, so you can do pretty much
anything you want to, like,

"I have data"
"I'm ready for data"
"OK, here's the data"
"Got it!"
"OK, got your ack."
<idle>

Which you can do both directions.

Hope This Helps!
Rich



Good ol' "DC interlock". Near and dear to my heart. Any other fossel out there
recognize the following?

Addr-Out
Select-Out + Hold-Out
Op-In
Adr-In
Cmd-Out
....
Svc-In
Svc-Out
...
Status-In
Svc-Out

DONE

[I *think* I got the sequence right. It's been a long time. :) ]

Thats why I like to do it in serial....

Data Ready?
Yes - read data.
No - go away.
 
R

Roger Hamlett

Jan 1, 1970
0
Rajiv Ghanta said:
hi there,

my current project involves designing a circular sonar-sensor array to
be incorporated onto a mobile robot. the hardware design i had in mind
was simple - the sensors would communicate with a PIC via I2C, which
would then transmit the readings to the laptop on the robot. i managed
to implement the I2C interface between the PIC and the sensors. i now
need to establish communication between the PIC and the laptop on the
robot. the laptop has two ports, a USB port and a parallel port. i'm
pretty sure it's much easier to try to develop a parallel port
interface. could somebody guide me through this process? i don't know
if this complicates matters, but the laptop on the robot is running a
real-time operating system called QNX. if there are any other details
i can provide, please let me know.

any help would be appreciated. thanks,
The problem is that if the laptop runs a modern OS (W2K, or WXP), programs
are prevented from directly accessing the parallel port. Hence the code at
the laptop end, will need either A 'kludge' driver to override the
protection, or a full driver to handle the port for your I/O.
The easiest way to talk at the laptop 'end', is definately serial. This
also has the advantage that most serial hardware has better protected
inputs, than the parallel port, and only requires two pins at the PIC,
while trying to talk to the parallel port could involve using most of the
available chip pins.
The easiest way to get serial, is to use a USB->serial converter cable.
These are cheap, readily available, and while some are of 'dubious'
quality, most now work well. At the PIC end, add a MAX232 to convert the
logic signalling to the required voltage and polarity, and you are done.
The alternative that is almost equally easy, is to get one of the DLP
modules based on the FTDI chips. Do a web search on DLP-USB232M. These are
small modules that fit on a 0.6" 24pin DIL socket, and implement a
complete USB serial port, with the signals bought out as logic levels,
designed for direct interfacing to processors like the PIC. Some versions,
also include parallel pins that can be operated from the software as well.
These are designed as 'demo' modules, for people who don't want to spend
the time and money, to implement the suface mount FTDI chip, and the
connections for USB etc., but are a great way for small projects to get a
reliable USB interface, without any development time.

Best Wishes
 
P

petrus bitbyter

Jan 1, 1970
0
Luhan Monat said:
Luhan Monat wrote:



I checked my PIC documentation - several have uarts, none have i2c --
that is always done in software. Microchips web site has lots of
documentation on this.

--
Luhan Monat: luhanis(at)yahoo(dot)com
http://members.cox.net/berniekm
"Any sufficiently advanced magick is
indistinguishable from technology."

Luhan,

Guess you did not check your PIC documentation very well. I ever used a
PIC16F7x for an I2C to RS232 interface. The hardware of this one supported
I2C-slave mode only. Master could be done in software which I did not need.
The newer PIC16F87x (to be more precise PIC16F873,4,6,7) support both master
and slave functionallity. Other PICs may support I2C as well. I did not
check. Otherwise Atmel also has micros that support I2C.

petrus bitbyter
 
L

Luhan Monat

Jan 1, 1970
0
petrus said:
Luhan,

Guess you did not check your PIC documentation very well. I ever used a
PIC16F7x for an I2C to RS232 interface. The hardware of this one supported
I2C-slave mode only. Master could be done in software which I did not need.
The newer PIC16F87x (to be more precise PIC16F873,4,6,7) support both master
and slave functionallity. Other PICs may support I2C as well. I did not
check. Otherwise Atmel also has micros that support I2C.

petrus bitbyter
Using the slave mode is not very useful. You want the PIC to master the
I2C. Master mode is not supported in hardware.
 
R

Roger Hamlett

Jan 1, 1970
0
Luhan Monat said:
Using the slave mode is not very useful. You want the PIC to master the
I2C. Master mode is not supported in hardware.
It most definately is supported in hardware. Any PIC with the MSSP module
(perhaps one third the 16 series, and 80% of the 18 series), have this
module. Quote from data sheet:
"The I2C interface supports the following modes in hardware:
Master Mode.
Multi-Master mode.
Slave Mode."
If you look in the Microchip device 'selector', and look for 'MI2C',
rather than for 'I2C', you will find the list with this feature.
I have chips over eight years old, with this ability...

Best Wishes
 
L

Luhan Monat

Jan 1, 1970
0
Roger said:
It most definately is supported in hardware. Any PIC with the MSSP module
(perhaps one third the 16 series, and 80% of the 18 series), have this
module. Quote from data sheet:
"The I2C interface supports the following modes in hardware:
Master Mode.
Multi-Master mode.
Slave Mode."
If you look in the Microchip device 'selector', and look for 'MI2C',
rather than for 'I2C', you will find the list with this feature.
I have chips over eight years old, with this ability...

Best Wishes
I did that search, and came up only with dsPIC devices. I have about 10
different (16 series) PICs in stock w/docs. What part numbers of the 16
series are you refering to?
 
L

Luhan Monat

Jan 1, 1970
0
Roger said:
It most definately is supported in hardware. Any PIC with the MSSP module
(perhaps one third the 16 series, and 80% of the 18 series), have this
module. Quote from data sheet:
"The I2C interface supports the following modes in hardware:
Master Mode.
Multi-Master mode.
Slave Mode."
If you look in the Microchip device 'selector', and look for 'MI2C',
rather than for 'I2C', you will find the list with this feature.
I have chips over eight years old, with this ability...

Best Wishes
Hi,

Further searching turned up 16F7x7 (same chip, 3 packages). This does
actually support i2c mastering. But seems to be the only one in the 16
series.

Learn sumptin' new evey day! ;}
 
R

Rajiv Ghanta

Jan 1, 1970
0
Roger said:
The problem is that if the laptop runs a modern OS (W2K, or WXP), programs
are prevented from directly accessing the parallel port. Hence the code at
the laptop end, will need either A 'kludge' driver to override the
protection, or a full driver to handle the port for your I/O.
The easiest way to talk at the laptop 'end', is definately serial. This
also has the advantage that most serial hardware has better protected
inputs, than the parallel port, and only requires two pins at the PIC,
while trying to talk to the parallel port could involve using most of the
available chip pins.
The easiest way to get serial, is to use a USB->serial converter cable.
These are cheap, readily available, and while some are of 'dubious'
quality, most now work well. At the PIC end, add a MAX232 to convert the
logic signalling to the required voltage and polarity, and you are done.
The alternative that is almost equally easy, is to get one of the DLP
modules based on the FTDI chips. Do a web search on DLP-USB232M. These are
small modules that fit on a 0.6" 24pin DIL socket, and implement a
complete USB serial port, with the signals bought out as logic levels,
designed for direct interfacing to processors like the PIC. Some versions,
also include parallel pins that can be operated from the software as well.
These are designed as 'demo' modules, for people who don't want to spend
the time and money, to implement the suface mount FTDI chip, and the
connections for USB etc., but are a great way for small projects to get a
reliable USB interface, without any development time.

Best Wishes


hi roger,

it is interesting that you brought this up. as i mentioned, the robot
does have a usb port, and in fact i did try to use FTDI's FT8U245AM
chip (packaged in a module similar to the one you described). using
this chip, i was able to easily transmit data via parallel from the PIC
to the FTDI chip. i plugged the device into my windows xp machine, and
downloaded the virtual com port drivers off of the ftdi website, and
everything worked like a charm. however, the laptop on the robot uses
qnx. there are third party drivers listed on the ftdi website for qnx
(http://gleb.qnx.org.ru/index_en.html), but i had serious problems
trying to install these drivers, which led me to give up on that route.

my attempt to interface my sonar array with the robot through the
parallel port is a last ditch effort. i know this might sound
ridiculous, but are there any serial-to-parallel converter chips, by
any chance? or maybe i could use the ethernet port? is there
something else i haven't thought of?

thanks,

rajiv
 
T

Thot

Jan 1, 1970
0
Rajiv,

sounds like interfacing you project with the parallel port should be the
easiest part.
Here you will find a lot of useful information that should be plenty to get
you going.

http://www.lvr.com/parport.htm

Luca
 
R

Roger Hamlett

Jan 1, 1970
0
I did that search, and came up only with dsPIC devices. I have about 10
different (16 series) PICs in stock w/docs. What part numbers of the 16
series are you refering to?
No. You are being misled by the search engine...
Try loading some data sheets. For instance, the old 'workhorse'
18F872,3,4/6/7A chips, all have this ability, as has the 16C74, the
16C771,2,3,4, and the 16F767,777.
The search engine has a nasty habit of not finding features that you know
are there. I have found myself 'snarling' at it, after it denied they did
any chips with a set of features, that I was already using!...
Use the 'selector' page, rather than the search (which is why I mentioned
the selector), and just look down the interface column for MI2C.

Best Wishes
 
R

Roger Hamlett

Jan 1, 1970
0
Rajiv Ghanta said:
hi roger,

it is interesting that you brought this up. as i mentioned, the robot
does have a usb port, and in fact i did try to use FTDI's FT8U245AM
chip (packaged in a module similar to the one you described). using
this chip, i was able to easily transmit data via parallel from the PIC
to the FTDI chip. i plugged the device into my windows xp machine, and
downloaded the virtual com port drivers off of the ftdi website, and
everything worked like a charm. however, the laptop on the robot uses
qnx. there are third party drivers listed on the ftdi website for qnx
(http://gleb.qnx.org.ru/index_en.html), but i had serious problems
trying to install these drivers, which led me to give up on that route.

my attempt to interface my sonar array with the robot through the
parallel port is a last ditch effort. i know this might sound
ridiculous, but are there any serial-to-parallel converter chips, by
any chance? or maybe i could use the ethernet port? is there
something else i haven't thought of?

thanks,

rajiv
At the moment, it is difficult to answer, without knowing what you really
'need' to do. One thought, that would be simple, would be to add a PCMCIA
serial card to the laptop. QNX, should have serial drivers, without having
to get involved in loading any extras, and then the same answer applies,
of adding a MAX232 to the PIC, and using the serial I/O pins on this chip.
I have heard of people getting the FTDI chips to run under QNX. I suspect
the difficulty, is in getting the Neutrino services loaded right. It might
be worth running a Google translation on the Russian manual, and seeing if
anything leaps out.

Best Wishes
 
M

Michael

Jan 1, 1970
0
Michael said:
Rich said:
I'm not at all familiar with QNX - you'd have to look up parallel port
drivers, but implementing a parallel interface is almost trivial. Heck,
it might even let you talk directly to the hardware, albeit you'd still
need a device that you can take ownership of, if you're multitasking.

Check some of these references:
http://www.google.com/search?q=PC+parallel+port+interface

That should tell you everything you need to know on the PC/hardware side.
In a nutshell, you need one 8-bit bidirectional port on the PIC - I
haven't actually used a PIC, but I'm sure they have at least 8 parallel
lines, and at least one handshaking input and one handshaking output.
There are five handshaking lines on the PC, so you can do pretty much
anything you want to, like,

"I have data"
"I'm ready for data"
"OK, here's the data"
"Got it!"
"OK, got your ack."
<idle>

Which you can do both directions.

Hope This Helps!
Rich

Good ol' "DC interlock". Near and dear to my heart. Any other fossel out there
recognize the following?

Addr-Out
Select-Out + Hold-Out
Op-In
Adr-In
Cmd-Out
....
Svc-In
Svc-Out
...
Status-In
Svc-Out

DONE

[I *think* I got the sequence right. It's been a long time. :) ]


No takers? It describes a data xfr sequence on a IBM S/370 channel (high speed
parallel interface). One byte transferred for each Svc-In/Svc-Out pair.
 
S

Si Ballenger

Jan 1, 1970
0
my attempt to interface my sonar array with the robot through the
parallel port is a last ditch effort. i know this might sound
ridiculous, but are there any serial-to-parallel converter chips, by
any chance? or maybe i could use the ethernet port? is there
something else i haven't thought of?

Don't know if it would be of any help, but I've got a page below
with some simple parallel port I/O stuff. There are a number of
chips/boards that are controlled via the serial and have parallel
I/O (bottom links)

http://www.geocities.com/zoomkat/status.htm
http://www.futurlec.com/RS232DevBoard.shtml
http://www.controlanything.com
 
R

Rajiv Ghanta

Jan 1, 1970
0
hey roger,

sorry, but what do you mean by 'what you really need to do'? i need to
transfer ranging information from the sensor array to the laptop. the
PCMCIA slot is currently inhabited by a wireless card that the robot
needs to receive commands from the master control computer (basically
all i'm trying to say is the only PCMCIA slot on the laptop is not
available for use). there is no serial port on the laptop, otherwise
that would have been the first thing i would have looked into. you say
you heard of people getting the FTDI chips to work under QNX - any
chance i can get in touch with them? you are absolutely right about
the difficulty lying in the Neutrino Standard Services C++ Library
provided on the same website (http://gleb.qnx.org.ru/index_en.html). i
got compile errors when i tried to install the services. i translated
the russian manual, and it was not helpful at all.

rajiv
 
Top