sd card and labview

7
1 Table of Contents 1. SD card...........................................................2 1.1 Need...........................................................2 1.2 Protocol.......................................................2 1.3 FAT16 file system..............................................2 1.4 Connection with the PIC18F4620.................................2 1.5 Library function used..........................................3 1.5.1 Mmc_Fat_Init............................................... 3 1.5.2 Mmc_Fat_QuickFormat........................................3 1.5.3 Mmc_Fat_Assign............................................. 3 1.6 Data in .txt file..............................................3 2 LABVIEW Application...............................................4 2.1 Advantage......................................................4 2.2 Simplicity but still attractive................................4 2.3 Main interface.................................................4 2.3.1 Programming and blocks used................................5

Upload: bilal-abid-butt

Post on 27-Dec-2015

69 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Sd Card and Labview

1 Table of Contents1. SD card.................................................................................................................................................2

1.1 Need............................................................................................................................................2

1.2 Protocol.......................................................................................................................................2

1.3 FAT16 file system.........................................................................................................................2

1.4 Connection with the PIC18F4620.................................................................................................2

1.5 Library function used...................................................................................................................3

1.5.1 Mmc_Fat_Init.......................................................................................................................3

1.5.2 Mmc_Fat_QuickFormat.......................................................................................................3

1.5.3 Mmc_Fat_Assign..................................................................................................................3

1.6 Data in .txt file.............................................................................................................................3

2 LABVIEW Application...........................................................................................................................4

2.1 Advantage....................................................................................................................................4

2.2 Simplicity but still attractive.........................................................................................................4

2.3 Main interface.............................................................................................................................4

2.3.1 Programming and blocks used.............................................................................................5

Page 2: Sd Card and Labview

1. SD card

1.1 NeedIt was one of our deliver to store data in some storage device. Storage on remote side was a challenge for us because first we were advised to store data in USB stick. It was complete project itself because it required complex routines to store data in it. Then to simplify the task we ordered SD card modules.

1.2 ProtocolIt works on SPI protocol. It consists of 4 data pins and 2 power up pin.

1.3 FAT16 file system At first we thought to store data in raw form. But then we had to make an application in computer to retrieve data from the card which could be hectic. Therefore we implemented FAT16 file system using the MikroC compiler MMC_FAT16 library.

1.4 Connection with the PIC18F4620SD card module MicrocontrollerMOSI SDOMISO SDASCK SCLCS To any digital pin for enabling the module

Page 3: Sd Card and Labview

1.5 Library function used

1.5.1 Mmc_Fat_Init

1.5.2 Mmc_Fat_QuickFormatTo format with FAT16 file system. This should be done once in coding.

1.5.3 Mmc_Fat_Assign

This is the main function. As it created file, open it, keep on appending the input data. ‘\n’ can be used to move to the next line.

1.6 Data in .txt fileData is being stored in the card in the following format.*temperature,humidity,barometric pressure, seconds, minutes, hours, gas threshold *30,65,18824, 7, 4, 4,203,*30,67,93493, 7,10, 4,110,*30,66,93474, 7,11, 4,110,*30,65,93472, 7,12, 4,0 ,*30,65,93476, 7,13, 4,1 ,*30,60,93466, 7,14, 4,0 ,*27,83,93463, 7,37, 4,1 ,*27,81,93460, 7,38, 4,0 ,

Time in above data is the time stamp when the data was taken at remote site from the RTC at the remote site.

Page 4: Sd Card and Labview

2 LABVIEW ApplicationData coming from the remote station and the coordinated coming from the GPS part are shown on an application in LABVIEW.

2.1 AdvantageIf our client is buying our product, he has no need to buy LABVIEW with it. We will be giving the client an executable file of LABVIEW application. There is no need to LABVIEW in the client’s machine. They just need a freely available runtime environment from the official website of LABVIEW to help the executable to be executed.

2.2 Simplicity but still attractiveIt is easy to do graphical programming in LABVIEW for the beginners in GUI fields. It has attractive blocks to perform different functions.

2.3 Main interface

Raw strings coming from the remote module and GPS part are shown in the top left corner. GPS data raw string starts from ‘@’ and sensors data raw string starts from ‘*’. This is just to differentiate between the two coming string and make the programming simple. Then there are different numerical indicators and graphs showing the behavior of the coming data over a period of time. You can also see a map showing the location of the remote module using the data coming from the GPS.

Page 5: Sd Card and Labview

2.3.1 Programming and blocks used

2.3.1.1 Serial communication and strings start detection

Left side blocks are for serial configuration and serial read, a MATLAB script to keep showing data on screen while switching from one message to other, and the blocks on the right side are for ‘@’ and ‘*’ detection with some ‘string indicator’ blocks. Then the same blocks on right side named ‘SCAN STRINGS FOR TOKENS’ are used to separate the each sensor data from the both strings.

2.3.1.2 Google URL for mapGoogle provide us with a URL, most of the things in that URL are constant; mean no need to change, but we can change coordinates, dimensions of the map, zoom etc. Two main blocks of the LABVIEW were used to pin point the location of the remote module on the map

Data coming from the user (like zoom), data coming from the remote module’s GPS (coordinated), and some constants like ‘www’ etc were concatenated using the block in above figure on left side and then that string representing a URL was displayed on in-built webBrowser window.

Page 6: Sd Card and Labview

2.3.1.3 Graphs

Data coming in the form of humidity, temperature, barometric pressure sensors is plotted continuously using the above blocks.