how to buffer serial data on pic?


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1
    Join Date
    Jan 2009
    Location
    LECCE - ITALY
    Posts
    7

    Default how to buffer serial data on pic?

    Hi,
    in my system with pic18f2620 (20Mhz) I must transfer serial data from serial camera to gprs modem. The camera send data with packets of 61434 bytes at 115200 baud.
    My problem is to buffer data in array example .... data var byte[xxxx]
    because the array is too big for a pic memory
    When I receive datas in a buffer I can send it to gprs module (115200 baud)
    Can someone help me to suggest an other solution to store and send?
    Thankyou

    Roberto

  2. #2
    Join Date
    Nov 2005
    Location
    Perth, Australia
    Posts
    429


    Did you find this post helpful? Yes | No

    Default

    With that much data, you may want to consider an EEPROM chip as your buffer.

    For example, the Microchip 24FC512 can store 65536 bytes so it could only just fit one of your packets.

    They are pretty easy to use with the I2CREAD and I2CWRITE PBP commands.
    "I think fish is nice, but then I think that rain is wet, so who am I to judge?" - Douglas Adams

  3. #3
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    I would be inclined to use an SRAM chip and use an entire 8 bit port to write the data to it. EEPROM would be a lot slower and unless there is a need to retain the info permanently then static ram would be the fastest way to do it IMHO
    Keith

    www.diyha.co.uk
    www.kat5.tv

  4. #4
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    967


    Did you find this post helpful? Yes | No

    Default

    Serial or even Parallel eeprom is definitely slowww. SRAM is definitely the way to do this. The modem transfer part is bound to be intermittent and anything short of buffering the entire image before sending will cause trouble. One moment I was hoping I could suggest a MiniSD card storage; however, that too is flash memory and is slow.

    If you can start and stop the camera data transfer via some protocol on your PIC device, maybe like a simple xon/xoff handshake too might help to slow down the camera side transfer to what your PIC can manage and then stream out the data on the fly.

  5. #5
    Join Date
    Jan 2009
    Location
    LECCE - ITALY
    Posts
    7


    Did you find this post helpful? Yes | No

    Default

    Thankyou for reply at all,
    I think to transfer the data byte to byte at 115200 baud (or 57600 baud) to external memory ram, eeprom or sd card is too slowly operation in data stream. Time to write is too long betwen bytes
    The camera sends the packet after a comand and I can't stop it (use tx and rx only)



    Quote Originally Posted by Jerson View Post
    Serial or even Parallel eeprom is definitely slowww. SRAM is definitely the way to do this. The modem transfer part is bound to be intermittent and anything short of buffering the entire image before sending will cause trouble. One moment I was hoping I could suggest a MiniSD card storage; however, that too is flash memory and is slow.
    If you can start and stop the camera data transfer via some protocol on your PIC device, maybe like a simple xon/xoff handshake too might help to slow down the camera side transfer to what your PIC can manage and then stream out the data on the fly.

  6. #6
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    Writing to external RAM (static) will be plenty fast. You have 87uSec betwen bytes. That is over 400 processor cycles.

    But the problem you will have with a simple parallel device is you probably don't have enough pins to do the addressing directly. If you had 3.5 free ports, you could use two for the address, one for the data, and 2 or 3 bits for the handshaking. An address latch scheme would allow you do do everything with 14 bits or so, but that would take some '374s (or equiv).

    Or you could set up the address with a shift register.
    Charles Linquist

Members who have read this thread : 1

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