• AVR Freaks

Hot!Read .txt file PIC16F18877

Author
deelbug
New Member
  • Total Posts : 8
  • Reward points : 0
  • Joined: 2019/04/19 06:42:57
  • Location: 0
  • Status: offline
2020/01/21 13:14:12 (permalink)
0

Read .txt file PIC16F18877

Is it possible to use a PIC16F18877 to read a .txt file (size 260 KB)? Using XC8 v2.05 + MPLAB X v5.15. File has ~262k characters, as characters are read they'd be written to an external EEPROM.
#1

8 Replies Related Threads

    jtemples
    عُضْوٌ جَدِيد
    • Total Posts : 11982
    • Reward points : 0
    • Joined: 2004/02/13 12:31:19
    • Location: Southern California
    • Status: offline
    Re: Read .txt file PIC16F18877 2020/01/21 14:01:37 (permalink)
    +1 (1)
    Read it from where?
    #2
    deelbug
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2019/04/19 06:42:57
    • Location: 0
    • Status: offline
    Re: Read .txt file PIC16F18877 2020/01/21 14:28:29 (permalink)
    0
    File currently located just on the PC. The stdio.h functions fopen, fclose, etc are not applicable here since the uC doesn't have a means to see it on the PC? Would need to use a micro SD/USB perhaps?  If still trying to read from the PC is it some form of serial/i2c?
    #3
    katela
    Super Member
    • Total Posts : 1861
    • Reward points : 0
    • Joined: 2013/06/11 05:25:18
    • Location: South Africa
    • Status: offline
    Re: Read .txt file PIC16F18877 2020/01/21 14:33:34 (permalink)
    0
    Do you want to read it from something like an sd card? Is your text line separated? Or you just want to read the whole text at once?

    Free online Microcontroller Tutorials and Projects for Hobbyists and students. From beginners to advanced. Website: www.studentcompanion.co.za
    YouTube Tutorials: https://www.youtube.com/StudentCompanionSA
    #4
    deelbug
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2019/04/19 06:42:57
    • Location: 0
    • Status: offline
    Re: Read .txt file PIC16F18877 2020/01/21 14:40:19 (permalink)
    0
    Ideally straight from the PC, but realize I may have to switch to a medium like an SD card. It's line separated, yes.
    #5
    ric
    Super Member
    • Total Posts : 28363
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: Read .txt file PIC16F18877 2020/01/21 15:06:03 (permalink)
    0
    It can't be "straight from the PC" until you arrange some communication path to the PC.
    The programming connection does NOT count.
    A serial connection would be simplest, but YOU have to arrange the software to manage it at both ends.
    SD card reading means you need support for a file system in the PIC, which is a lot of software.

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #6
    RandomWeirdo
    Starting Member
    • Total Posts : 7
    • Reward points : 0
    • Status: offline
    Re: Read .txt file PIC16F18877 2020/01/21 15:42:31 (permalink)
    0
    Since you mentioned USB, I would suggest a USB to UART bridge like the MCP2221A, which is a very easy way to get a USB serial port to communicate with the uC.
     
    Then you will need some software on the PC side to either initiate the transfer, or wait for the uC to request the file over the serial connection.
    On the uC side, you can then just read the contents using a UART.
    #7
    jtemples
    عُضْوٌ جَدِيد
    • Total Posts : 11982
    • Reward points : 0
    • Joined: 2004/02/13 12:31:19
    • Location: Southern California
    • Status: offline
    Re: Read .txt file PIC16F18877 2020/01/21 15:42:55 (permalink)
    0
    Assuming you find the appropriate connection from your PIC to the PC, what is your PIC software going to do with 260 KB of data?  You won't be able to process more than about 2% of that file at a time.
    #8
    NorthGuy
    Super Member
    • Total Posts : 6288
    • Reward points : 0
    • Joined: 2014/02/23 14:23:23
    • Location: Northern Canada
    • Status: offline
    Re: Read .txt file PIC16F18877 2020/01/21 16:32:30 (permalink)
    +1 (1)
    ric
    The programming connection does NOT count.



    It might be possible to re-purpose the programming connection. PICkit2 can use scripting which you can use to bit-bang communications through the PGC/PGD pair while the PIC is running. My programmer can do this too, and even can do SPI, so if the PIC can PPS an SPI module to PGC/PGD you can even get to decent speeds. I've heard CCS compiler has bult-in functions for communicating on PGC/PGD, but I may be wrong here.
    #9
    Jump to:
    © 2020 APG vNext Commercial Version 4.5