Parallel Port Interface between PIC and PC

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

Reply to
Rajiv Ghanta
Loading thread data ...

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.

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

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."
Reply to
Luhan Monat

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:

formatting link

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."

Which you can do both directions.

Hope This Helps! Rich

Reply to
Rich Grise

there

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

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

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

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

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

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?

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

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! ;}

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

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

Reply to
Michael

to

mind

which

managed

now

the

i'm

know

a

details

programs

code at

This

PIC,

the

cable.

the

done.

These are

levels,

versions,

well.

spend

get a

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

formatting link
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

Reply to
Rajiv Ghanta

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. :-) ]
Reply to
Michael

"Rajiv Ghanta" wrote in message news: snipped-for-privacy@o13g2000cwo.googlegroups.com...

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

Reply to
Roger Hamlett

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.

formatting link

Luca

Reply to
Thot

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

Reply to
Roger Hamlett

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

Reply to
petrus bitbyter

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

Reply to
Roger Hamlett

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

Reply to
Roger Hamlett

there

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.

Reply to
Michael

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

formatting link
i got compile errors when i tried to install the services. i translated the russian manual, and it was not helpful at all.

rajiv

Reply to
Rajiv Ghanta

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)

formatting link
formatting link
formatting link

Reply to
Si Ballenger

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.