PDA

View Full Version : Picbasic pro help please + hardware suggestions



tsteele
- 28th June 2006, 18:55
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

Travin77
- 30th June 2006, 00:38
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

SteveB
- 30th June 2006, 03:29
Tony,
I am in no way an expert, but I'll just throw out a couple of thoughts I had.

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

tsteele
- 30th June 2006, 05:54
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

Luciano
- 30th June 2006, 10:53
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/devices.asp?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

tsteele
- 1st July 2006, 07:41
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

Luciano
- 1st July 2006, 09:00
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/index.php?cPath=72_35_86
(The SOIC package is the AT45DB321C-RU).

Link to AT45DB321C-RU:
http://www.trade-shop.de/catalog/product_info.php?products_id=587&osCsid=8b9a173af8188262b2a7950148d6d3d8

tsteele
- 6th July 2006, 19:23
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

SteveB
- 21st August 2006, 15:38
Tony and Luciano,

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

Steve B