CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

USB - where to start

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
edi



Joined: 22 Dec 2003
Posts: 82

View user's profile Send private message

USB - where to start
PostPosted: Mon Nov 10, 2014 1:48 am     Reply with quote

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: 19492

View user's profile Send private message

PostPosted: Mon Nov 10, 2014 2:31 am     Reply with quote

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: 9220
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Nov 10, 2014 6:25 am     Reply with quote

? 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

View user's profile Send private message

PostPosted: Mon Nov 10, 2014 9:25 am     Reply with quote

Thanks for your reply.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group