How to reed data from 18F4550 EEPROM into EXCEL via PC USB interface?


Closed Thread
Results 1 to 24 of 24

Hybrid View

  1. #1
    Join Date
    Mar 2009
    Location
    Colorado
    Posts
    378

    Default How to reed data from 18F4550 EEPROM into EXCEL via PC USB interface?

    I have spent the last hour searching the forums for an answer to this question and have finally given up and decided to post this new thread. Lots of discussion about such a datalogging application using RS232 or serial but very little if any on how to do this with USB. Here is what I want to do...any referralls to threads or WEB tutorials on any of the pieces of this application would be appreicated:
    1) Data measurements (one word, once per day) are stored with the date value are stored by an 18F4550 based microcontroller into the MCU's EPROM memory for 31 days.
    2) On monthly cycle a USB cable is connected to the 18F4550 based microcontroller to download the data to a laptop.
    3) Need a VB6 program on the laptop as the PC side of the USB interface and to insert the collected data into 31 rows of three columns each (date, Data_LSB, Data_MSB) on an Excel spreadsheet.
    4) Need to also read the RTC date/time (DS1337) from the microcontroller into the VB6 program at time of USB connection where user can reset the RTC time from the VB6 program if the read time isn't within timing tolerances.

    Would prefer to do this with PBPro and not assembly. I have Darrel Taylor's and Mister-E's VB6 HIDs and have attempted to adapt them to provide the PC side of the USB interface, but still stuggling with how to have it read the 31 days of EEPROM data in a sequence that can easily be inserted into an EXCEL spreadsheet in the format desired.

    Any help on this would be greatly appreciated and I will share back the results when finished.
    Last edited by jellis00; - 26th May 2010 at 23:11.

  2. #2
    Join Date
    Mar 2010
    Location
    Minnesota, USA
    Posts
    41


    Did you find this post helpful? Yes | No

    Default

    1st question...Why does it have to be USB? 2nd...Can it be USB to Serial? If so then you should use a FT232R USB to serial converter IC then goto this link and figure out the rest http://www.lvr.com/serial_ports_dotnet.htm

    This way you communicate to the Microcontroller through a serial Com port and dont have to dink with the USB mumbo jumbo.

    This method works well for me and its fairly easy to understand.

    What you are asking for it to do is not hard if you break it apart into parts:

    1) Read data from EEPROM Byte by Byte and send it serially to VB and buffer it there in a variable
    2) Take the Variable in your VB Prog and format it however you want and dump it to Excel
    Last edited by wolwil; - 27th May 2010 at 05:53.

  3. #3
    Join Date
    Mar 2009
    Location
    Colorado
    Posts
    378


    Did you find this post helpful? Yes | No

    Default Must be USB!

    Quote Originally Posted by wolwil View Post
    1st question...Why does it have to be USB?
    Unfortunately the answer to this question is yes. I am doing this for a potential customer and he wants USB not serial. I have the USB interface between my MCU and an adaptation of Mister-Es HID and DT's HID working to a point....data is showing but it is not showing the correct values that I know the PIC is putting into its BufferOut array. The HID is all in VB6 and I don't understand it to even be able to trouble shoot it. What I need is some way to see what variables are showing up on the PC side of the USB to verify that everything is being sent correctly from the PIC. Once I have that verified then I will attack the problem of troube shooting the output of the VB6 to the PIC.

    I was hoping someone had some ideas as to an HID I could use that is easier to understand and troubleshoot with the USB interface from the PIC.

  4. #4
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default

    jellis00, I do exactly that, I have 4, 24F1025's that I save data to and when requested by the host (PC) thru a terminal program. I dump the contents of the eeproms to it in CSV format (Comma Seperated Variable) which Excel will accept without any problems. I then use this data for presentation in Excel. The data is dumped at 57,600 baud thru a FTDI SERIAL to USB converter. It works for me as I hate to write more programs for the PC as well....

    Dave Purola,
    N8NTA

  5. #5
    Join Date
    Mar 2009
    Location
    Colorado
    Posts
    378


    Did you find this post helpful? Yes | No

    Default How does your terminal program dump into Excel??

    Quote Originally Posted by Dave View Post
    jellis00, I do exactly that, I have 4, 24F1025's that I save data to and when requested by the host (PC) thru a terminal program. I dump the contents of the eeproms to it in CSV format (Comma Seperated Variable) which Excel will accept without any problems. I then use this data for presentation in Excel.
    Dave, I would very much appreciate learning moe about how you implemented the PC side of your interface to receive and dump the data to Excel. Can you elaborate? Sounds like you use some kind of teerminal program rather than VB6 and I am curious as to how you get the terminal program to parse the BufferIn() contents from the PIC sent array and store it into Excel.

  6. #6
    Join Date
    Sep 2007
    Location
    USA, CA
    Posts
    271


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by jellis00 View Post
    Dave, I would very much appreciate learning moe about how you implemented the PC side of your interface to receive and dump the data to Excel. Can you elaborate? Sounds like you use some kind of teerminal program rather than VB6 and I am curious as to how you get the terminal program to parse the BufferIn() contents from the PIC sent array and store it into Excel.
    I haven't done this myself recently..it's been a while. I did it many years ago using the windows api calls or something like that. It was with Win3.11, if that gives you any idea of how long it's been. It was very easy.

    Recently I had a friend do it for me, and he formatted it with html and put it on the clipboard. It pasted perfectly formatted into excel. That may not be product worthy, though, if you need a "click to appear in excel" solution...but you could do that with autohotkey. It will let you save the clipboard, get it with the new data, paste it, then restore the clipboard.

  7. #7
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by jellis00 View Post
    Dave, I would very much appreciate learning moe about how you implemented the PC side of your interface to receive and dump the data to Excel. Can you elaborate? Sounds like you use some kind of teerminal program rather than VB6 and I am curious as to how you get the terminal program to parse the BufferIn() contents from the PIC sent array and store it into Excel.
    jellis00, The comma separated variables are generated in the 18F2620. The terminal program I use for all of my communications is TeraTermPro.exe. It is free ware and the BEST terminal program I have found. It allows you to open multiple instances and has all of the features to emulate VT-100 and ANSI commands. I mearly turn on the log function and then send the 18F2620 the command to dump the array data. After the data is downloaded I close the log file and the file is then ready to be inported into Excel...

    Dave Purola,
    N8NTA

  8. #8
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    699


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by jellis00 View Post
    I have the USB interface between my MCU and an adaptation of Mister-Es HID and DT's HID working to a point....data is showing but it is not showing the correct values that I know the PIC is putting into its BufferOut array.
    I am not familiar with Mister_E or DT's HID programs. I use EasyHID VB6 interface to talk to my 18F4550 with a USB connection. You need to send the whole array of data from the PIC to the PC. This array of data is defined in the HID descriptor. For EasyHID the array size is 8 bytes at a time.

    Quote Originally Posted by jellis00 View Post
    The HID is all in VB6 and I don't understand it to even be able to trouble shoot it.
    Hmmm, you are in trouble . You need to know at least the basics to be able to display the incomming data in a Label window. About sending the data to Excel, I haven't done it yet, but there is a way to do it using APIs in VB6.

    Robert

  9. #9
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Have a look at the VB6 code in this project; http://www.rentron.com/PicBasic/PIC_USB.htm

    It shows how to display data coming from the USB PIC on labels, in a text box, log data to file with time/date stamp, etc..

    I never got around to completing the project page, but all VB & PBP code is in a .zip file for download.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  10. #10
    Join Date
    Mar 2009
    Location
    Colorado
    Posts
    378


    Did you find this post helpful? Yes | No

    Default Looks like a good approach to avoid having to learn details of VB6

    Quote Originally Posted by Bruce View Post
    Have a look at the VB6 code in this project; http://www.rentron.com/PicBasic/PIC_USB.htm

    It shows how to display data coming from the USB PIC on labels, in a text box, log data to file with time/date stamp, etc..

    I never got around to completing the project page, but all VB & PBP code is in a .zip file for download.
    Thanks so much for this, Bruce. I downloaded the zip and installed the files per the readme.txt. The readme was pretty explicit except it didn't say where in my file folders to place the vbskfr2.DEP file....can you tell me??
    I notice the LABXUSB.pbp and LABXUSB.hex files are for 18F4450. I am using 18F4550. I also notice in the .pbp code that no CONFIGS are set for the 18F4450, so I presume it is using default CONFIGS for a 18F4450. Besides the CONFIGS, are there any other differences in the .pbp code I should be aware of while I attempt to convert it to compile/assemble on 18F4550? I would just use a 18F4450 except it has no on chip EEPROM which I need for the data logging I am doing. Really appreciate your advice on this.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts