View previous topic :: View next topic |
Author |
Message |
edi
Joined: 22 Dec 2003 Posts: 82
|
USB - where to start |
Posted: Mon Nov 10, 2014 1:48 am |
|
|
I'm starting a new project of a simple data logger.
The PIC supposed to save some small amount of data (temperature, humidity, altitude, etc.).
Every few days need to plug to a PC via USB and download the data into the PC.
Can someone help me please with:
1. Where to start - reference or example code? USB drivers? What type of USB is recommended? (I'm using PCWHD v4.128)
2. Recommended PIC device (need ~15 I/O and I2C)?
3. Other tips?
Thanks a lot. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Mon Nov 10, 2014 2:31 am |
|
|
A step at a time.
Use the EX_USB_serial.c (and serial2.c).
These are the simplest way to make USB 'work'. Just appears as a serial port, which any serial application can talk to. Even better the drivers for this are now supplied with Windows.
On the PIC, look at the 46J50. Gives two I2C/SPI ports, two UART's, USB, Comparator, CTMU, etc. etc.. Many of the peripherals can be 'remapped' to different pins as well. Has one of the lowest list of errata for a modern chip (makes it much nicer to work with...). All the peripherals actually work.....
The key though, is to forget the project. Get yourself able to a chip working. Then some basic I/O. Then get the USB comms working. Then how are you going to store the logged data?. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Mon Nov 10, 2014 6:25 am |
|
|
? MUST the PIC have built in USB?
While the 46J50 is a powerful PIC you might consider the 18F46K22 as well. About a dollar cheaper it does NOT have USB. However USB<>TTL modules are about $2 these days and the 46K22 does come in a 40 pin DIP package, easier to 'play' with.
Also having the USB outside the PIC reduces the code size, 'offloads' ALL the USB code so the PIC can do more..faster.
You also need to decide how much data you'll be storing and how.External EEPROM is the usual route, FRAM works great however if you need a lot of space consider a Vinculum device. Thought costly they do allow gigabytes of storage and easy downloading of data into a spreadsheet(typically needed for 'data logging').
My guess is money is tight so that probably isn't an option.
Whichever PIC you choose, start off easy, get a 1Hz LED program up and running to confirm the PIC and your board work BEFORE you tackle the rest !!
hth
Jay |
|
|
edi
Joined: 22 Dec 2003 Posts: 82
|
|
Posted: Mon Nov 10, 2014 9:25 am |
|
|
Thanks for your reply. |
|
|
|