+ Reply to Thread
Page 1 of 2
1 2 Last
Results 1 to 15 of 18

Thread: Sending Data to PC using PIC18F4550 through USB

  1. #1
    aforadi Newbie
    Join Date
    Mar 2009
    Posts
    23

    Default Sending Data to PC using PIC18F4550 through USB

    Right so my first post...What I am doing in my project is as follows:
    1. I am using the LM35 temperature sensor and converting the analog output into digital using PIC's A/D
    2. Then I want to send this output to the PC

    Now here are my series of doubts after making lots of efforts on the internet and google.
    1. How do I transfer the bits of the digital output which is produced by the A/D and stored in the ADRESH and ADDRESL registers?
    2. Will it come out of a port serially?(Do I have to code it that way?)
    3.How do I get the readings on the PC side in Hyper Terminal?


  2. #2
    Super Moderator Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent
    Join Date
    Nov 2003
    Location
    Derbyshire, UK
    Posts
    29,736

    Default

    If you care to read my PIC tutorials (based on the 16F series) they show how to read the analogue inputs and transfer the data to a PC via serial and Hyperterminal.
    PIC programmer software, and PIC Tutorials at:
    http://www.winpicprog.co.uk

  3. #3
    Russ Hensel Okay
    Join Date
    Sep 2007
    Location
    South Dartmouth
    Posts
    125

    Default

    break the project into subsections and get each working one at a time.
    for example *test the temp sensor with a multimeter.
    *get the serial comm working by its self.....

  4. #4
    aforadi Newbie
    Join Date
    Mar 2009
    Posts
    23

    Default

    Will these be valid for USB also?The problem is that I don't want to use RS 232 mode...I have installed a USB connector on the PCB and am using that to connect to the PC
    Last edited by aforadi; 28th March 2009 at 04:31 PM.

  5. #5
    aforadi Newbie
    Join Date
    Mar 2009
    Posts
    23

    Default

    Quote Originally Posted by Russ Hensel View Post
    break the project into subsections and get each working one at a time.
    for example *test the temp sensor with a multimeter.
    *get the serial comm working by its self.....
    I have done the temp. sensor part...The problem is coming is the serial communication part via USB

  6. #6
    Super Moderator Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent
    Join Date
    Nov 2003
    Location
    Derbyshire, UK
    Posts
    29,736

    Default

    There are various USB examples in the MicroChip application notes, plus various ones on the net - however, the USB side is going to be many times more complicated than the rest of the project added together.
    PIC programmer software, and PIC Tutorials at:
    http://www.winpicprog.co.uk

  7. #7
    aforadi Newbie
    Join Date
    Mar 2009
    Posts
    23

    Default

    I am not too sure...Because I tried implementing their CDC files on my PIC and that gave me an output on the terminal window...I am just finding it hard to figure out what they they did to produce that text on HyperTerminal

  8. #8
    aforadi Newbie
    Join Date
    Mar 2009
    Posts
    23

    Default

    I know it's simple using the 16F877A using RS 232 serial commn.

  9. #9
    Super Moderator Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent
    Join Date
    Nov 2003
    Location
    Derbyshire, UK
    Posts
    29,736

    Default

    It's just as simple using the 18F4550, it's only the USB part which is complicated - you might try the 'USB bit whacker' which is a good starting point for USB.
    PIC programmer software, and PIC Tutorials at:
    http://www.winpicprog.co.uk

  10. #10
    Someone Electro Newbie
    Join Date
    Sep 2003
    Location
    A boring village in Europe (slovene)
    Posts
    2,601

    Default

    Yes microchip gives you something called a USB framework, Its a big pile of C code librarys, some of it takes care of transfering the bits over USB and responding to the PC corectly. That pice of code you dont realy need to understand.

    Then there is the code that makes the USB acualy do something useful like for exsample the CDC driver that makes a com port and the file that contains the USB identifier. The idenditifer file is a pile of strings that the PIC sends to the PC when its pluged in. They tell the PC everythyng about that device from the manufacruter to its name and to what it is and what the device can do.

    You can look trough the CDC exsamples main to see what its doing, that file also has a pile of callback subrutines that get called by the USB library on certan events like standby or initalization complete and such.

    One thing to watch out is that you need to call a rutine to service USB reqests from the PC every few ms or the USB device becomes unresponsive.
    Il give you shocking experience.

  11. #11
    Russ Hensel Okay
    Join Date
    Sep 2007
    Location
    South Dartmouth
    Posts
    125

    Default

    The PicPac has usb code for 18F in BoostC. Google to find it ( Embedded Adventures )

  12. #12
    superbrew Okay
    Join Date
    Oct 2007
    Location
    Nashua, NH
    Posts
    101

    Default

    I think that the easiest way is what Nigel had suggested: UBW
    This will show up as COM port on the PC, so interfacing should be pretty easy.

  13. #13
    aforadi Newbie
    Join Date
    Mar 2009
    Posts
    23

    Default

    Thnks a lot for the info...Having completed this I now want to run this using bluetooth...So is it as simple as replacing the usb cable with usb bluetooth?

  14. #14
    Someone Electro Newbie
    Join Date
    Sep 2003
    Location
    A boring village in Europe (slovene)
    Posts
    2,601

    Default

    Well your in luck if you did CDC USB, Because by coincidence bluetooth also acts as a ordinary COM port. But there is no USB over bluetooth thingy.
    Il give you shocking experience.

  15. #15
    aforadi Newbie
    Join Date
    Mar 2009
    Posts
    23

    Default

    So I cant use it right?
    Ok...Then
    Can anyone suggest me a tutorial for RS232 communication with PC for 18F4500?

+ Reply to Thread
Page 1 of 2
1 2 Last

Similar Threads

  1. Sending data over DC power lines
    By m2pc in forum Electronic Projects Design/Ideas/Reviews
    Replies: 4
    Latest: 3rd November 2008, 11:34 PM
  2. sending RS-232 or RS-485 data via 2-wire
    By wakanga in forum Micro Controllers
    Replies: 3
    Latest: 25th October 2008, 04:45 AM
  3. Sending data to pc from the PIC
    By cheef in forum Robotics Chat
    Replies: 1
    Latest: 6th October 2006, 09:35 AM
  4. Sending Data Through Cell Phone
    By DigiTan in forum Electronic Projects Design/Ideas/Reviews
    Replies: 1
    Latest: 2nd May 2006, 06:07 AM
  5. sending data via infrared
    By jijita in forum General Electronics Chat
    Replies: 3
    Latest: 18th June 2004, 03:36 PM

Tags for this Thread