Picbasic pro help please + hardware suggestions


Closed Thread
Results 1 to 9 of 9
  1. #1
    tsteele's Avatar
    tsteele Guest

    Default Picbasic pro help please + hardware suggestions

    Hi
    Can anyone give me some advice on how to go about a project I have been asked to look at please.
    I need to extract the data from a series of remote data loggers which have in their event list lines of data similar to the following:-

    1,yyyyyyy,zzzzzzzz,xxxxxxxxxxxxxxxxxxxxxx, CR,LF
    1,yyyyyyy,zzzzzzzz,xxxxxxxxxxxxxxxxxxxxxx, CR,LF
    1,yyyyyyy,zzzzzzzz,xxxxxxxxxxxxxxxxxxxxxx, CR,LF

    Depending on the logger, there can be anything from 1 up to 500 lines.
    I need to capture the zzzzzzzz and the xxxxxxxxxxxxxxxxxxxxxx bits of each line and store them in either the pic memory or some external memory.
    I can then use two buttons to scroll the data onto an lcd .
    the zzzzzzzz will be a number like 10978561 and the xxxxxxxxxxxxxxxxxxxxx will be an ascii text message up to 20 characters long terminated in a comma, followed by a CR and LF.

    The actual hardware design shouldn't be a problem, but I am uneasy about bits of the programming.
    I would like to use Picbasic Pro which I have some experience with using 16F876's and a bootloader.

    My worries are that I will not be able to read in a line up to the CR,LF, parse it and store it somehow before the next line comes in.
    There is no handshaking available on the devices, and data is transferred at 19.2k or 38.4kbaud.
    Can anyone give me some pointers on which pic would be best, and running at what speed and how and where to store the incoming strings, would I be able to use the internal program memory or an external device like a Fram?

    Any help would be appreciated.

    Regards
    Tony
    Last edited by tsteele; - 28th June 2006 at 18:56. Reason: typo correction

  2. #2
    Join Date
    Feb 2006
    Posts
    89


    Did you find this post helpful? Yes | No

    Default Data Format

    You can serial in the data into an array. Use the serin2 command. Inside the brackets, skip the number of nubers, letters, ect that you don't want. Then place the following data into an array. Example:

    here is the data stream you want to capture:
    1,yyyyyyy,zzzzzzzz,xxxxxxxxxxxxxxxxxxxx, CR,LF

    serin2,datapin,32,[wait "1",skip 9, str data/8,skip 1,str data1/20]

    Just use the pic you are comfortable with. Run it faster than 4 mhz, I like 20 mhz but thats just me.

    Travin

  3. #3
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default

    Tony,
    I am in no way an expert, but I'll just throw out a couple of thoughts I had.
    Quote Originally Posted by tsteele
    ....
    Depending on the logger, there can be anything from 1 up to 500 lines.
    ....
    the zzzzzzzz will be a number like 10978561 and the xxxxxxxxxxxxxxxxxxxxx will be an ascii text message up to 20 characters long
    That's a lot of data for a PIC to swallow in one gulp! If I understand correctly it adds up to a possible 14,000 bytes [(8 bytes+20bytes)*500 possible lines] once the extraneous data is removed. This amount of data won't fit into any current PICs ram, so it will need to be stored somewhere else as soon as it is recieved and processed. (And it will have to be processed quickly enough to keep up with the incoming data rate)

    One option is to go with some sort of external memory.

    Another possible solution may be to get a pic with a large amount of program space (lots of options) and use the WRITECODE (with READCODE & ERASECODE) to add the data to the code memory space that is not being used. I've never used these features of PBP or the PIC, but you might do a search of the forum and see what you come up with. I wouldn't be suprised if one of the real smart folks on this forum have already posted a lot of info on using these commands.

    Some other things to keep in mind:
    - Most flash and EEPROMs have limited Write cycles to consider
    - They also take a little more time to write data (some have to be erased before a write, adding to the time for each byte to be processed)
    - An external storage device will need an interface that is fast enough to keep up with the incoming data processing.
    - With enough memory, and time between data streams, you might even do the data processing/extraction after data reception is complete.

    Good Luck,
    Steve

  4. #4
    tsteele's Avatar
    tsteele Guest


    Did you find this post helpful? Yes | No

    Default

    Travin and Steve
    Thanks both for your replys, I am ok with the reading in of the data, using serin and saving it into an arary in ram, that would not be a problem if there were only one or two lines.
    What I think will be the problem is that there is much more data than the pic's ram can hold.
    Once it is read in, saved in the array, I then need to get it moved into either external ram or program memory real quickly before the next line is due in.
    This is where I think I will have big problems.

    Ffr

  5. #5
    Join Date
    Oct 2004
    Location
    Italy
    Posts
    695


    Did you find this post helpful? Yes | No

    Default

    Hi,

    Using interrupt get the byte from the hardware UART and send it
    to an Atmel AT45X Series flash memory via hardware SPI. (Data as it is).
    When you display the log, format and display the data as needed.

    http://www.atmel.com/dyn/products/de...?family_id=616

    Example the AT45DB321C (32M bit)
    Its 34,603,008 bits of memory are organized as 8192 pages of 528 bytes each. In
    addition to the 33-megabit main memory, the AT45DB321C also contains two SRAM
    buffers of 528 bytes each.
    The buffers allow the receiving of data while a page in the main page Memory
    is being reprogrammed, as well as writing a continuous data stream.

    * * *

    Hardware + Picbasic code:
    (See AT45DB Data Flash kit / 4M bit or 8M bit)
    http://www.compsys1.com/workbench/AT45DB/at45db.html
    http://www.compsys1.com/workbench/index.html

    * * *

    Best regards,


    Luciano

  6. #6
    tsteele's Avatar
    tsteele Guest


    Did you find this post helpful? Yes | No

    Default

    Hi Luciano

    Wow, this looks like a good device, I will try and find a uk supplier and get a sample ordered, Looking at the datasheet, the io to the device can be run at speed so maybe running the pic at 20mhz, there may be time to parse the data as it comes in, there is then less to write out at the end of each line.
    thansk again for the info, .

    Regards
    Ffr

  7. #7
    Join Date
    Oct 2004
    Location
    Italy
    Posts
    695


    Did you find this post helpful? Yes | No

    Default

    Hi,

    A package you can solder by hand.

    Remember that these parts need a 3V supply.
    The data lines are 5V tolerant and do not require voltage translation.

    Best regards,

    Luciano

    * * *

    Package 28R (See datasheet page 34 and 38).

    (28-lead, 0.330" Body Width, Plastic Gull Wing Small Outline Package SOIC)

    Ordering code: AT45DB321C-RU
    Operation Range: Industrial (-40C to +85C)

    * * *

    Where you can buy:
    (Note that the minimum Order is 25 euro).
    http://www.trade-shop.de/catalog/index.php?language=en

    Link to AT45DBxxx:
    http://www.trade-shop.de/catalog/ind...cPath=72_35_86
    (The SOIC package is the AT45DB321C-RU).

    Link to AT45DB321C-RU:
    http://www.trade-shop.de/catalog/pro...a7950148d6d3d8

  8. #8
    tsteele's Avatar
    tsteele Guest


    Did you find this post helpful? Yes | No

    Default

    Devices have been ordered, am away for two weeks on vacation, soon as I am back, the project will start.......
    Thanks once again for the help.

    Regards
    Tony

  9. #9
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default

    Tony and Luciano,

    Either of you get one of the ATMEL AT45DB321C to work?

    Steve B

Similar Threads

  1. Conversion from picbasic pro to hex for mplab
    By pr2don in forum Forum Requests
    Replies: 5
    Last Post: - 10th October 2010, 19:53
  2. How to configure SPI in PICBASIC PRO?
    By moogle in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 15th April 2007, 18:31
  3. ICD, ICSP and Picbasic Pro
    By mwhatley in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 30th July 2006, 19:38
  4. Question for all that use MELABS PICBASIC PRO
    By oskuro in forum Off Topic
    Replies: 2
    Last Post: - 24th March 2005, 17:15
  5. PicBasic Pro & PicBasic syntax different
    By Billyc in forum General
    Replies: 5
    Last Post: - 16th April 2004, 21:19

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