Questions on PIC's and connectors

For tech wizards and n00bs alike. Questions, answers, or just general hoo-haa.

Moderator: Moderators

Post Reply
Message
Author
User avatar
Symphona
Apprentice
Posts: 102
Joined: Sat Jan 24, 2009 8:29 pm
Location: England

Questions on PIC's and connectors

#1 Post by Symphona »

My question really is: I know how to play with PIC's, I know how to mess with the PC software side (or at least what to google etc, which is basically the same thing given time) BUT I have no idea how to connect the two. I'm not afraid of using a soldering iron, and I know you can get small LAN or USB board that I'm sure I can wire to a PIC. So, I need to know what to program that will let me send signals to and from a PIC and a desktop.

I'm sorry if I'm not being very useful with my description, but thats the main problem; I don't know quite what to do, so I don't even know which manual to rtfm. If I'm barking up the wrong tree, I'm all ears, as I say I just need some easy, preferably cheap protocol to send signals between a PIC and desktop

Cheers, ~Sym~
Linux is hard...

User avatar
avwolf
Templar Inner Circle
Posts: 7006
Joined: Wed Jan 17, 2007 5:33 pm
Location: Nebraska, USA
Contact:

Re: Questions on PIC's and connectors

#2 Post by avwolf »

Easiest thing to do is get a USB FIFO device. The one I've used is by DLP Design. It's got a driver that lets you treat the USB device as a standard serial port, which is much easier to write code that talks to. Then you can wire it up on your embedded device as either a parallel or serial data source. It's really straightforward. I've tried getting a PIC with a built in USB controller and wiring a USB port to it, but I couldn't get it to work properly (I was having trouble figuring out how to make anything work without rewriting the USB stack, and there was no way in hell that I was about to do that).
Image

RobbieThe1st
Templar GrandMaster
Posts: 706
Joined: Fri Dec 08, 2006 7:06 am
Location: Behind my computer.
Contact:

Re: Questions on PIC's and connectors

#3 Post by RobbieThe1st »

Go with a very cheap USB -> Serial adapter. You can do this one of two ways:
1. Get a standard USB->RS232 adaptor off Ebay(China Inc sells loads for extremely cheap), and grab a Maxim IC MAX232 level-converter to transform the serial-voltages to the lower voltage we need for the pic.
I've done this before with a PIC16F684, and it worked fine. I used HyperTerminal(on windows) for sending/recieving raw data.
2. Get a USB-TTL serial adaptor - Like This one for $6. It can be configured to output 3.5 or 5V, just what you need. This'd probably be the better option, but I haven't tried it myself.

Software side, you've got a UART on your pic that can be used to send and receive serial bytes simply by moving/reading a couple of registers. Note that it's slightly tricky; one of the timer modules may interfere with it and need special configuration on your pic - My 16f684 needed a couple of extra registers; the 16f690 didn't.

As far as reading/writing to the serial port, there's all sorts of things to do PC side - Easiest is a terminal emulator. Above that, I'd look into PySerial for using Python to acquire/send data to your device, and then use something like PyQt to give you a nice GUI.

User avatar
Symphona
Apprentice
Posts: 102
Joined: Sat Jan 24, 2009 8:29 pm
Location: England

Re: Questions on PIC's and connectors

#4 Post by Symphona »

Ok, thanks for that, I think I'll probably go with the USB-TTL if only to see how it does, I'll have to work out how to wire it and what parts to get, but since I haven't actually bought anything yet, that won't be hard. So, now I can look up PySerial on the recieving end, the only thing left is to learn assembly...which is a pain. Don't get me wrong, I know its an annoying language to learn, I'm prepared for that, but I can't seem to find much literature on it...

I'm probably missing a few large and vital steps, but I normally do, I appreciate your help nonetheless!

~Sym~

--Edit--

Having a look at some of the PIC's, the 18F series can come with a physical USB embedded (as far as I can tell, none of the photos have anything that looks like one on it(?), or at least raw support for such) as well as a USART pin. Given the price for the low end chips is still quite low (I'm considering the 18F2455), might be worth a shot?
Linux is hard...

User avatar
avwolf
Templar Inner Circle
Posts: 7006
Joined: Wed Jan 17, 2007 5:33 pm
Location: Nebraska, USA
Contact:

Re: Questions on PIC's and connectors

#5 Post by avwolf »

Find a compiler and write C. Tons, tons easier than writing assembly for the PIC.
Image

User avatar
Symphona
Apprentice
Posts: 102
Joined: Sat Jan 24, 2009 8:29 pm
Location: England

Re: Questions on PIC's and connectors

#6 Post by Symphona »

That sounds a Lot nicer. I mean, I still don't know the language, but...mmm, yes, lots nicer, Cheers.
Linux is hard...

Post Reply