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 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 06:53.

  2. #2
    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.

  3. #3
    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

  4. #4
    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.

  5. #5
    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.

  6. #6
    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

  7. #7
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    704


    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

  8. #8
    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

  9. #9
    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.

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


    Did you find this post helpful? Yes | No

    Default Replace my previous post with this one...more detail/different questions for Bruce.

    Thanks so much for this, Bruce. I downloaded the zip and installed the files per the readme.txt, but in the process I have some questions:

    1) 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??
    2) As I understand it, the code in the zipped files is for an 18F4550, yet I see an 18F4450.INC file included in the zip.....how come? I would just use a 18F4450 except it has no on chip EEPROM which I need for the data logging I am doing. It is also a very old file (6/5/06) for version 2.47 so I presume I shouldn't replace the one in my PBP folder that is 09/12/08 Version 2.60 which I am using.
    3) I notice in the LABXUSB.inc file that the CONFIGS for an 18F4550 are listed for use with the bootloader but are commented out, so I presume it is using default CONFIGS for a 18F4550???
    4) I am programming my chips with a PICKIT2 rather than bootloader, so not sure what I have to do to the CONFIGS that are listed????
    5) I also notice that the 18F4550.bas file included in the zip is an older version for 2.46 (12/31/04) than the one in my PBP folder that is dated 9/12/08 for 2.6, ....and the older version has following files commented out:
    BANKA $0000, $005F
    BANK0 $0060, $00FF
    BANK1 $0100, $01FF
    BANK2 $0200, $02FF
    BANK3 $0300, $03FF
    'BANK4 $0400, $04FF
    'BANK5 $0500, $05FF
    'BANK6 $0600, $06FF
    'BANK7 $0700, $07FF
    'EEPROM $F00000, $F000FF
    'LIBRARY "PBPPIC18"
    LIBRARY "PBPUSB18"
    include "PIC18EXT.BAS"
    PORTL VAR PORTB
    PORTH VAR PORTC
    TRISL VAR TRISB
    TRISH VAR TRISC
    include "PBPPIC18.RAM"

    In the newer version this is the equivalent list and nothing is commented out:
    BANKA $0000, $005F
    BANK0 $0060, $00FF
    BANK1 $0100, $01FF
    BANK4 $0400, $04FF
    LIBRARY "PBPPIC18"
    include "PIC18EXT.BAS"
    PORTL VAR PORTB
    PORTH VAR PORTC
    TRISL VAR TRISB
    TRISH VAR TRISC
    include "PBPPIC18.RAM"
    USBMEMORYADDRESS Con $400 ' USB RAM starts here

    I presume since I am using PBP v2.6 compiler that I should not replace the 18F4550.bas file in my PBP folder with the one from the zip?? Should I comment out and of the BANK statements or change the LIBRARY to the one listed in the old file?

    Really appreciate your advice on this.
    Last edited by jellis00; - 27th May 2010 at 22:08. Reason: Delete one sentence

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


    Did you find this post helpful? Yes | No

    Default

    Hi Jellis00,

    This was done on a 4550 and compiled with PBP v2.47. Look in LABXUSB.INC for config fuse settings. I had these commented because I used Microchips USB boot-loader. You can get rid of the DEFINE RESET_ORG 800h since you're not using the USB loader. Note there are a few routines in the PBP code that were just experimental also.

    The 18F4450.INC was in there because someone requested it way back when I first put this together, and I compiled the Microchip USB loader for an 18F4450 for them.

    Just use the 18F4550.INC file you have, and set config fuses to the same as in the LABXUSB.INC file.

    The Readme.txt file has instructions for the vbskfr2.DEP and other related files. This is a VB skin program that gives the form the look it has.

    It's a lot of reading, but it's all there. If you're using PBP 2.6 look for the changes Darrel mentioned, and make sure you use whatever include files are with 2.6.
    Regards,

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

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