![]() |
Forum Index : Microcontroller and PC projects : MM-V5.0 SDcard driver for 28 and 44-pin
Author | Message | ||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10180 |
I've implemented basic SDcard functionality for the 28 and 44-pin Micromites that is fully compatible with V5.0 and, of course, make the "C" source openly available: 2015-12-01_195655_SDCard.zip This is a first beta so may have bugs. It has been tested on 44-pin MX170 but should work without changes on a 28-pin chip - feedback appreciated. This is based on ChaN's PetitFAT library with the code modified to work in a CFunction and with hardware drivers I have developed to work on the Micromite. The code ONLY supports SDHC cards formatted in FAT32. It is important to understand the major limitations of the PetitFAT system. Data can only be written into pre-existing files. So to use the code for logging, a large empty file should be created and stored on the SD card. This can then be written into by the PetitFAT code. Files and/or directories cannot be created or deleted. When stored as a "library" the code takes 8k. The code uses the second SPI channel on the Micromite to connect to the SD card, pins are: 28-pin: SPI2OUT-24, SPI2IN-6, SPI2CLK-26 44-pin: SPI2OUT-11, SPI2IN-23, SPI2CLK-15 In addition a chip-select pin is needed, this is user selectable. Write-protect and Card-detect are not supported. There is one Cfunction that supports all access to the SD card and it has 4 modes of operation. In all cases the Cfunction returns 0 for success and a non-zero value in the event of an error. The four functions are: initialise and mount the disk open a file read from a file write to a file These should be defined as constants in the program: [code] const mount=0 const fileopen=1 const readfile=2 const writefile=3 [/code] The program maintains the SD-card/file header information in a 6-element Basic Integer array and this must be included in all calls to the CFunction. dim integer fileheader(5)
The full parameter specifications for the 4 modes are as follows: ret%=SDcard(fileheader(),mount,SD_CS_pin_number) This initialises and mounts the SD card using the defined pin number for the chip-select ret%=SDCard(fileheader(),fileopen,filename$) This opens the file defined by the string literal or variable "filename$". ret%=SDcard(fileheader(),readfile,buff$ or buff(),start_byte,#_of_bytes_requested,#_of_bytes_read) This reads a specified number of bytes into a Basic variable "buff" defines where the bytes read will be put. For 255 bytes or less this should be a string variable e.g. buff$. For greater than 255 bytes it should be an integer array dimensioned such that the number of bytes requested divided by 8 should be less than or equal to the array size e.g. DIM INTEGER buff(127) can receive 1024 bytes "start_byte" defines the number of bytes from the start of the file to start the read. Use zero to position at the beginning of the file. Use any negative number to read from the current file location "#_of_bytes_requested" defines the number of bytes you wish to read. "#_of_bytes_read" returns the number of bytes actually read. This should be the same as the number requested unless the end-of-file has been reached so it provides an easy test for end-of-file ret%=SDcard(fileheader(),writefile,buff$ or buff(),start_byte,#_of_bytes_to_be_written,#_of_bytes_written) This writes a specified number of bytes from a Basic variable "buff" defines where the bytes to be written are stored. For 255 bytes or less this should be a string variable e.g. buff$. For greater than 255 bytes it should be an integer array dimensioned such that the number of bytes to be writen divided by 8 should be less than or equal to the array size e.g. DIM INTEGER buff(127) can store 1024 bytes for output to the SDcard. "start_byte" defines the number of bytes from the start of the file to start the write. Use zero to position at the beginning of the file. Use any negative number to write from the current file location "#_of_bytes_to_be_written" defines the number of bytes you wish to write. "#_of_bytes_written" returns the number of bytes actually written. This should be the same as the number requested unless the end-of-file has been reached so it provides an easy test for attempting to write past the end-of-file The first demo program contains the code to write an image saved as a binary .PPM file to a ILI9341, ILI9163 or ST7735 display. The tiger image saved as a .PPM is included in the ZIP. 2015-12-01_200228_sdpics.zip The second demo program shows a complete text file being read with a single read operation into a large buffer defined as an integer array and includes an example text file 2015-12-01_200438_fileread.zip I will also post a logging demo once tidy/working. |
||||
Frank N. Furter Guru ![]() Joined: 28/05/2012 Location: GermanyPosts: 946 |
![]() ![]() ![]() ![]() ![]() THANK YOU VERY, VERY MUCH!!!! Frank ![]() |
||||
twofingers![]() Guru ![]() Joined: 02/06/2014 Location: GermanyPosts: 1566 |
Yes, it's quite delightful! ![]() It opens the way to very BIG (and cheap) logging files. (not tested yet) Michael causality ≠ correlation ≠ coincidence |
||||
MicroBlocks![]() Guru ![]() Joined: 12/05/2012 Location: ThailandPosts: 2209 |
How is the sector boundary handled. If you write something that is not on a sector boundary, does it fix this by reading the current values first before writing it? Specific for logging i am working on using a small FRAM chip to collect at least 512 bytes of data to be written to the SD card. The FRAM can then also hold the position for the next write to SD, this will then not be lost when power fails or a reset occur4s. Microblocks. Build with logic. |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10180 |
That will be in the next version. At the moment writes only work properly on sector boundaries which is why I didn't include a write demo in the original post |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10180 |
I've now got the writing working as I want. New C code attached: 2015-12-02_194734_SDCard.zip The demo code and a sample empty file are also attached: 2015-12-02_194820_logdemo.zip The Cfunction in this example should be copied into the other examples above to keep them up-to-date. It doesn't change the read functionality but there is a small optimisation on read in the new code. There is a minor change to the specification of the write call ret%=SDcard(fileheader(),writefile,buff$ or buff(),start_byte,#_of_bytes_to_be_written,#_of_bytes_written) This writes a specified number of bytes from a Basic variable "buff" defines where the bytes to be written are stored. For 255 bytes or less this should be a string variable e.g. buff$. For greater than 255 bytes it should be an integer array dimensioned such that the number of bytes to be written divided by 8 should be less than or equal to the array size e.g. DIM INTEGER buff(127) can store 1024 bytes for output to the SDcard. "start_byte" defines the number of bytes from the start of the file to start the write. Use zero to position at the beginning of the file. This is now a mandatory parameter and it is up to the Basic program to maintain the position with each write "#_of_bytes_to_be_written" defines the number of bytes you wish to write. "#_of_bytes_written" returns the number of bytes actually written. This should be the same as the number requested unless the end-of-file has been reached so it provides an easy test for attempting to write past the end of the physical file Looking at the Basic example, the usage should be obvious. First the disk is mounted and then the file opened. There is no difference between opening a file for read or write access. Then a title line is written to the file. Note how the variable "filepos" is used to maintain the position in the file for the next write. 500 records are then written out. In the example these are CR terminated variable length but in another application they could be fixed length allowing easy file positioning (record length * record number) Finally an end-of-file marker is output (in this case the ASCII code for control-Z). This could be anything and just marks the end of the logical file within the physical file we are using to write ("empty.txt") The rest of the program then just reads the file from the beginning until it finds the end-of-file marker to prove the the write was successful Subject to any bugs being found, this version should be final. option explicit
option default none const mount=0 const fileopen=1 const readfile=2 const writefile=3 CONST CTRL_Z = 26 ' ' Demo of logging data on a Micromite using the SD card driver ' dim integer fileheader(5),i,j,filepos,num dim s$ prepnumbers() ' Mount the disk if(SDcard(fileheader(),mount,24)) THEN : Print "Unable to mount Disk" : END : ENDIF ' Open a file to use for write IF(SDCard(fileheader(),fileopen,"empty.txt")) then : print "Unable to open file" : END : ENDIF ' Write out a title line s$="Title: 73 times table "+chr$(13) IF(SDcard(fileheader(),writefile,s$,0,len(s$),j)) THEN : PRINT "Unable to write file" : END : ENDIF ' maintain the file pointer - this must be done in the Basic program filepos=len(s$) num=0 ' write out 500 lines of output updating the file pointer as we go for i=1 to 500 s$=int2text$(num)+chr$(13) num=num+73 IF(SDcard(fileheader(),writefile,s$,filepos,len(s$),j)) THEN : PRINT "Unable to write file" : END : ENDIF filepos=filepos+len(s$) next i ' write something we can recognise as the end of file s$=chr$(CTRL_Z) 'end of file marker CTRL-Z IF(SDcard(fileheader(),writefile,s$,filepos,len(s$),j)) THEN : PRINT "Unable to write file" : END : ENDIF ' ' Now lets read back the file to check it ' ' Read in the first 240 characters positioning the filemarker to the beginning of the file if(SDcard(fileheader(),readfile,s$,0,240,j)) THEN : PRINT "Unable to read file" : END : ENDIF print s$; ' loop through the file do if(SDcard(fileheader(),readfile,s$,-1,240,j)) THEN : PRINT "Unable to read file" : END : ENDIF if instr(s$,CHR$(CTRL_Z)) THEN s$=left$(s$,instr(s$,CHR$(CTRL_Z))-1) j=0 endif print s$; loop while j<>0 'loop until the end of the physical file or our end-of-file marker print "" end |
||||
drkl![]() Senior Member ![]() Joined: 18/10/2015 Location: HungaryPosts: 102 |
Hello, It would be possible to use the default "SPI" is? Where can I set it? best regards drkl |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10180 |
Not in this version - the SPI pins are fixed. The problem with the default SPI is that it can also used for TFT and Touch and is reserved for these when it is. To avoid the code having to "behave" relative to the other uses it is simpler and more robust just to use the second SPI channel |
||||
drkl![]() Senior Member ![]() Joined: 18/10/2015 Location: HungaryPosts: 102 |
Hello, Thanks for the quick response. I would order the SPI1 because there is a display panel on which it has a micro SD slot. There are three chpselect: display, touch, sdcard. miso,mosi,clk are common. I looked at the C source. It is not enough to rewrite the relevant references, and recompile all C function? There are some who are not using the LCD panel and want to use the SPI1 interface. (eg. data collector) Thanks, drkl |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10180 |
Not quite that simple as the code must behave correctly relative to the other uses of the SPI port. Anyway I've now made the changes by including some conditional compilation in the C code 2015-12-03_175102_SDCardV102.zip This has also required making some changes to the picture drawing routines as they were previously holding TFT-CS low throughout the drawing whereas now this has to be toggled to allow interleaved SD card access to the SPI bus (C code also attached below). The complete example code for the standard SPI ports to display an image is below. drkl: Note that this code includes what you asked about in the other thread. i.e. it has a CFunction that can write out a full colour bitmap. The usage should be clear from the example. First define the screen region and then send repeated strings containing the RGB information for each pixel as 3 byte per pixel, top left to bottom right. In the example I repeatedly read 255 bytes from the SDcard (255 / 3 = 85 pixels) and then use the "DisplayBuffer" routine to write these to the display. All: The SDcard CFunction for SPI2 is unchanged from V1.01 above. However, you should use the new display routines for loading pictures as they are better "behaved". Note that the "CompleteDisplay" routine is no longer needed as TFT-CS is now released at the end of each call to "DisplayBuffer" option explicit option default none ' ' Version to use the standard SPI port on the Micromite ' const mount=0 const fileopen=1 const readfile=2 const writefile=3 const SD_CS = 24 cls displaypicture("tiger2.ppm",0,0) end '*************************************************************************************************** ' ' Display a picture from the SD card ' Code should work on any of the MM2 supported displays ILI9341, ST7735, ILI9163 ' Picture must be in binary .PPM format ' ' Parameters are: ' PIC$ = filename of the picture to be displayed ' StartX% = X coordinate of the top left of the picture ' StartY% = Y coordinate of the top left of the picture ' ' Note: the routine checks that the picture is not too big for the screen and reports an error if it is ' Sub DisplayPicture(PIC$, StartX%, StartY%) LOCAL Buffer$,addbuffer$ length 3 LOCAL Result%=-1 LOCAL NumBytes%,a% local integer fileheader(5) if(SDcardSPI1(fileheader(),mount,SD_CS)) THEN : Print "Unable to mount Disk" : END : ENDIF IF(SDcardSPI1(fileheader(),fileopen,PIC$)) then : print "Unable to open file" : END : ENDIF 'Read the first 128 bytes Buffer$=STRING$(128," ") IF(SDcardSPI1(fileheader(),readfile,buffer$,0,len(buffer$),NumBytes%)) THEN : PRINT "Unable to read file" : END : ENDIF a%=instr(buffer$,chr$(10)) ' look for the first CR if left$(buffer$,a%-1)="P6" then buffer$=right$(buffer$,len(buffer$)-a%) a%=instr(buffer$,chr$(10)) ' look for the second CR buffer$=right$(buffer$,len(buffer$)-a%) a%=instr(buffer$,chr$(32)) ' look for the space between dimensions local width%=val(left$(buffer$,a%-1)) buffer$=right$(buffer$,len(buffer$)-a%) a%=instr(buffer$,chr$(10)) ' look for the third CR LOCAL height%=val(left$(buffer$,a%-1)) buffer$=right$(buffer$,len(buffer$)-a%) a%=instr(buffer$,chr$(10)) ' look for the fourth CR buffer$=right$(buffer$,len(buffer$)-a%) a%=len(buffer$) mod 3 addBuffer$=STRING$(3-a%," ") ' we need to make sure we have a number of bytes divisible by three in the buffer Result%=SDcardSPI1(fileheader(),readfile,addbuffer$,-1,len(addbuffer$),NumBytes%) buffer$=buffer$+addbuffer$ if (StartX%+width%>MM.HRES) OR (StartY%+height%>MM.VRES) then print "Picture too big", width%," x",height% else Result%= SetRegion(StartX%, StartY%, width%, height%) Result%=DisplayBuffer(Buffer$) Buffer$=STRING$(255,chr$(0)) do Result%=SDcardSPI1(fileheader(),readfile,buffer$,-1,255,NumBytes%) if numbytes%<>0 then Result%=DisplayBuffer(Buffer$) loop while NumBytes%<>0 endif else Print "Invalid File Format" endif END sub ' CFunction SetRegion 00000000 27BDFFB8 AFBF0044 AFBE0040 AFB7003C AFB60038 AFB50034 AFB40030 AFB3002C AFB20028 AFB10024 AFB00020 8C940000 8CB50000 8CD70000 8CFE0000 3C12BF80 8E425830 AFA20010 8E425800 AFA20014 8E425840 AFA20018 34028060 AE425800 24020C00 AE425840 24020002 AE425830 3C109D00 8E020090 8053002C 8E020028 0040F809 02602021 0040B021 8E020024 02602021 0040F809 24050006 00408821 8E020024 02602021 0040F809 24050005 00409821 8E030090 8E02001C 8064002D 0040F809 24050005 24020001 02C2B004 AE760000 2402002A AE425820 3C03BF80 8C625810 30420080 1040FFFD 3C02BF80 8C435820 AE360000 00141A03 AC435820 3C03BF80 8C625810 30420080 1040FFFD 3C02BF80 8C435820 AE360000 AC545820 3C03BF80 8C625810 30420080 1040FFFD 3C02BF80 8C435820 AE360000 2694FFFF 0297B821 00171A03 AC435820 3C03BF80 8C625810 30420080 1040FFFD 3C02BF80 8C435820 AE360000 AC575820 3C03BF80 8C625810 30420080 1040FFFD 3C02BF80 8C435820 AE760000 2403002B AC435820 3C03BF80 8C625810 30420080 1040FFFD 3C02BF80 8C435820 AE360000 00151A03 AC435820 3C03BF80 8C625810 30420080 1040FFFD 3C02BF80 8C435820 AE360000 AC555820 3C03BF80 8C625810 30420080 1040FFFD 3C02BF80 8C435820 AE360000 26B5FFFF 02BEF021 001E1A03 AC435820 3C03BF80 8C625810 30420080 1040FFFD 3C02BF80 8C435820 AE360000 AC5E5820 3C03BF80 8C625810 30420080 1040FFFD 3C02BF80 8C435820 AE760000 2403002C AC435820 3C03BF80 8C625810 30420080 1040FFFD 3C12BF80 8E425820 AE360000 3C109D00 8E030090 8E02001C 8064002D 0040F809 24050006 8FA20010 AE425830 8FA20014 AE425800 8FA20018 AE425840 8E020090 8042002C 00021FC3 8FBF0044 8FBE0040 8FB7003C 8FB60038 8FB50034 8FB40030 8FB3002C 8FB20028 8FB10024 8FB00020 03E00008 27BD0048 End CFunction ' CFunction DisplayBuffer 00000000 27BDFFD8 AFBF0024 AFB40020 AFB3001C AFB20018 AFB10014 AFB00010 00808821 90900000 3C02BF80 8C525830 8C535800 8C545840 34038060 AC435800 24030C00 AC435840 24030002 AC435830 3C029D00 8C430090 8C42001C 8064002D 0040F809 24050005 1A00001D 24040001 3C02BF80 92250001 00052A00 30A5F800 92230002 000318C0 3063FFE0 00A32825 92230003 000318C2 00A32825 00051A03 AC435820 8C435810 30630080 1060FFFD 00000000 8C435820 AC455820 8C435810 30630080 1060FFFD 00000000 8C435820 24840003 0204182A 1060FFE6 26310003 3C029D00 8C430090 8C42001C 8064002D 0040F809 24050006 3C02BF80 AC525830 AC535800 AC545840 00101FC3 02001021 8FBF0024 8FB40020 8FB3001C 8FB20018 8FB10014 8FB00010 03E00008 27BD0028 End CFunction ' CFunction SDcardSPI1 0000060F 'wait_ready 3C029D00 8C420000 3C051062 8C430000 24A54DD3 00031842 70641802 00001021 00650019 00001810 00031982 40824800 3C04BF80 240700FF 240600FF AC865820 8C825810 30420080 1040FFFD 3C02BF80 8C425820 40054800 304200FF 10470005 00A3282B 14A0FFF5 00001021 03E00008 00000000 03E00008 24020001 'deselect 3C029D00 8C430090 27BDFFE8 AFBF0014 8C42001C 80640030 0040F809 24050006 240300FF 3C02BF80 AC435820 3C03BF80 8C625810 30420080 1040FFFD 8FBF0014 3C02BF80 8C425820 03E00008 27BD0018 'select 3C029D00 8C430090 27BDFFE8 AFBF0014 8C42001C 80640030 0040F809 24050005 240300FF 3C02BF80 AC435820 3C03BF80 8C625810 30420080 1040FFFD 3C02BF80 240401F4 8C425820 0411FFBA 00000000 10400004 8FBF0014 24020001 03E00008 27BD0018 0411FFD2 00000000 8FBF0014 00001021 03E00008 27BD0018 'mem_set 10C00006 7C052C20 00863021 A0850000 24840001 5486FFFE A0850000 03E00008 00000000 'mem_cmp 10000006 2407FFFF 80A20000 00621023 14400006 24840001 24A50001 24C6FFFF 54C7FFF9 80830000 00001021 03E00008 00000000 'MtoC 80870000 10E0000D 00801021 24830001 00873821 00802821 10600004 00000000 90660000 A0A60000 24A50001 10670004 24630001 1000FFF8 00000000 00802821 03E00008 A0A00000 'send_cmd 27BDFFE0 AFB00010 309000FF 7C101420 AFB10014 AFBF001C AFB20018 04400069 00A08821 3C029D00 8C430090 8C42001C 80640030 0040F809 24050006 240300FF 3C02BF80 AC435820 3C03BF80 8C625810 30420080 1040FFFD 3C12BF80 3C029D00 8C430090 8C42001C 80640030 24050005 8E435820 0040F809 00000000 240200FF AE425820 3C04BF80 8C825810 30420080 1040FFFD 3C03BF80 8C625820 3C04BF80 AC705820 8C825810 30420080 1040FFFD 3C03BF80 00111602 8C645820 3C04BF80 AC625820 8C825810 30420080 1040FFFD 3C03BF80 7E223C00 8C645820 3C04BF80 AC625820 8C825810 30420080 1040FFFD 3C03BF80 7E223A00 8C645820 3C04BF80 AC625820 8C825810 30420080 1040FFFD 3C03BF80 323100FF 8C625820 3C04BF80 AC715820 8C825810 30420080 1040FFFD 3C02BF80 8C425820 24020040 1202002A 3A100048 24020001 24030087 0070100A 3C03BF80 AC625820 8C625810 30420080 1040FFFD 3C02BF80 8C425820 2404000A 3C03BF80 240600FF AC665820 8C625810 30420080 1040FFFD 3C02BF80 8C425820 304200FF 7C022C20 04A10005 8FBF001C 2484FFFF 308400FF 1480FFF3 00000000 8FB20018 8FB10014 8FB00010 03E00008 27BD0020 24040077 00002821 0411FF8C 00000000 2C430002 1060FFF5 8FBF001C 1000FF90 3210007F 1000FFD9 24020095 'disk_readp 27BDFFE0 AFB00018 00808021 24040051 AFA60010 AFA70014 AFBF001C 0411FF7C 00000000 8FA60010 14400010 8FA70014 34049C40 3C03BF80 240800FF 240500FF AC655820 8C625810 30420080 1040FFFD 3C02BF80 8C425820 304200FF 14480015 2484FFFF 1480FFF6 00000000 24020001 AFA20010 0411FF0B 00000000 240400FF 3C03BF80 8FA20010 AC645820 3C04BF80 8C835810 30630080 1060FFFD 8FBF001C 3C03BF80 8FB00018 8C635820 03E00008 27BD0020 240300FE 1443FFED 24020001 00062023 24840202 10C0000C 00872023 3C03BF80 240500FF AC655820 8C625810 30420080 1040FFFD 3C02BF80 24C6FFFF 8C425820 14C0FFF8 00000000 02073821 3C03BF80 240500FF AC655820 8C625810 30420080 1040FFFD 3C02BF80 8C425820 A2020000 26100001 1607FFF7 00000000 3C03BF80 240500FF AC655820 8C625810 30420080 1040FFFD 3C02BF80 2484FFFF 8C425820 1480FFF8 00001021 1000FFC5 AFA20010 'clust2sect 8C830008 24A5FFFE 2463FFFE 00A3182B 50600006 00001021 90830002 8C820014 70A32002 03E00008 00821021 03E00008 00000000 'dir_rewind 27BDFFE8 AFB00010 00A08021 8CA50008 24020001 AFBF0014 10A20010 A6000000 8C820008 00A2102B 1040000D 8FBF0014 50A00001 8C850010 AE05000C 0411FFE3 00000000 8FBF0014 AE020010 00001021 8FB00010 03E00008 27BD0018 8FBF0014 24020001 8FB00010 03E00008 27BD0018 'create_name 27BDFFE0 AFB00014 8C900004 AFB10018 02002021 00A08821 2406000B 24050020 AFBF001C 0411FED0 00000000 3C029D00 8E290000 00001821 00002021 24080008 240A002F 2407002E 240B0008 244C1F9C 01241021 80450000 24840001 30A200FF 2C460021 14C00025 308400FF 504A0016 00001821 10470010 0068302B 10C0000E 00000000 04A2001B 01821021 2445FF9F 30A500FF 2CA5001A 10A00003 02032821 2442FFE0 304200FF 24630001 A0A20000 1000FFE7 306300FF 150B0003 00001821 5047000A 24030008 01242021 AE240000 A203000B 8FBF001C 00001021 8FB10018 8FB00014 03E00008 27BD0020 1000FFD8 2408000B 1000FFE5 9042FF80 1000FFF2 24030001 'get_clust 90A30015 90A60014 90A2001B 90A4001A 00031A00 00661825 00021200 00031C00 00441025 03E00008 00621025 'get_fat 27BDFFE0 2CA20002 14400005 AFBF001C 8C820008 00A2102B 54400005 8C82000C 8FBF001C 24020001 03E00008 27BD0020 30A6007F 000519C2 27A40010 00622821 00063080 24070004 0411FF1F 00000000 1440FFF3 93A20012 93A50013 93A40010 93A30011 00052E00 00021400 00A21025 00441025 00031A00 8FBF001C 00431025 7C42D800 03E00008 27BD0020 'dir_next 27BDFFE0 AFB10014 94B10000 AFB20018 26310001 3231FFFF AFB00010 AFBF001C 00A08021 12200016 00809021 8CA20010 10400013 3223000F 5460000A A6110000 8CA5000C 24420001 14A00014 AE020010 94820004 0222102B 1040000A 24020003 A6110000 00001021 8FBF001C 8FB20018 8FB10014 8FB00010 03E00008 27BD0020 24020003 8FBF001C 8FB20018 8FB10014 8FB00010 03E00008 27BD0020 90820002 00111902 2442FFFF 00621024 5440FFED A6110000 0411FFAF 00000000 2C430002 5460FFF0 24020001 8E430008 0043182B 5060FFEC 24020003 AE02000C 02402021 00402821 0411FF2E 00000000 AE020010 A6110000 1000FFDC 00001021 'dir_find 27BDFFD8 AFB30020 AFB2001C AFB10018 AFB00014 AFBF0024 00809021 00A08821 00C08021 0411FF2C 00000000 1440001D 00409821 96260000 8E250010 30C6000F 02002021 00063140 24070020 0411FEBC 00000000 02002021 14400019 2406000B 92020000 1040000F 24020003 9202000B 30420008 54400006 02402021 8E250004 0411FE14 00000000 1040000F 02402021 02202821 0411FF9B 00000000 5040FFE6 96260000 8FBF0024 8FB30020 8FB2001C 8FB10018 8FB00014 03E00008 27BD0028 1000FFF8 24020001 1000FFF6 02601021 'follow_path 27BDFFE0 AFB20018 AFB10014 AFB00010 AFBF001C AFA7002C 80E20000 24030020 00809021 00A08021 14430006 00C08821 24E70001 AFA7002C 80E20000 5043FFFD 24E70001 2403002F 10430027 24E70001 8FA7002C AE000008 90E20000 2C420020 50400014 02002021 10000026 02402021 0411FFAF 00000000 02402021 14400014 02202821 8E030004 9063000B 14600011 8FBF001C 9222000B 30420010 10400023 24020003 0411FF35 00000000 AE020008 02002021 27A5002C 0411FEEF 00000000 02402021 02002821 1040FFE9 02203021 8FBF001C 8FB20018 8FB10014 8FB00010 03E00008 27BD0020 AFA7002C AE000008 90E20000 2C420020 1040FFEE 02002021 02402021 02002821 0411FEBF 00000000 A2200000 8FBF001C 8FB20018 8FB10014 8FB00010 03E00008 27BD0020 8FB20018 8FB10014 8FB00010 03E00008 27BD0020 'pf_lseek 27BDFFD8 AFB00014 AFBF0024 AFB30020 AFB2001C AFB10018 10800063 00808021 90820001 30420001 50400036 8FBF0024 8C82001C 8C830018 0045902B 00B2100A 00409021 10400027 AC800018 90910002 14600033 00118A40 8E050020 AE050024 0232102B 1040003F 00119823 1000000B 02519023 8E030008 00A3182B 50600011 A2000001 8E030018 AE050024 02231821 10800035 AE030018 00409021 02002021 0411FEF1 00000000 00402821 02531021 00512021 2CA30002 1060FFEE 0224202B A2000001 8FBF0024 24020001 8FB30020 8FB2001C 8FB10018 8FB00014 03E00008 27BD0028 00001021 8FBF0024 8FB30020 8FB2001C 8FB10018 8FB00014 03E00008 27BD0028 24020004 8FB30020 8FB2001C 8FB10018 8FB00014 03E00008 27BD0028 2442FFFF 0051001B 022001F4 2463FFFF 00001012 0071001B 022001F4 00002012 0044102B 5440FFC5 8E050020 00111023 00431824 AE030018 02439023 1000FFC0 8E050024 8E030018 02439021 AE120018 02002021 0411FE47 00000000 5040FFD1 A2000001 92040002 8E030018 2484FFFF 00031A42 00831824 00431021 AE020028 1000FFD1 00001021 1000FFCF 24020005 'pf_read 27BDFFD0 AFB50024 AFB40020 AFB00010 AFBF002C AFB60028 AFB3001C AFB20018 AFB10014 00E0A021 00808021 00A0A821 10800061 ACE00000 90820001 30420001 50400048 8FBF002C 8C820018 8C92001C 02429023 0246182B 00C3900A 1240004B 00A09821 10000014 24160200 02C61023 0242882B 0251100B 00002021 0275200B 00403821 00408821 0411FDBD 00000000 14400028 02519023 8E020018 8E830000 02221021 00711821 AE020018 12400037 AE830000 02719821 304601FF 54C0FFEB 8E050028 92110002 00021A42 2631FFFF 00718824 323100FF 56200008 8E050024 5440000F 8E050024 8E050020 2CA20002 54400011 A2000001 AE050024 02002021 0411FDF8 00000000 1040000A 00512821 8E060018 AE050028 1000FFD4 30C601FF 02002021 0411FE64 00000000 1000FFEF 00402821 A2000001 24020001 8FBF002C 8FB60028 8FB50024 8FB40020 8FB3001C 8FB20018 8FB10014 8FB00010 03E00008 27BD0030 24020004 8FB60028 8FB50024 8FB40020 8FB3001C 8FB20018 8FB10014 8FB00010 03E00008 27BD0030 8FBF002C 00001021 8FB60028 8FB50024 8FB40020 8FB3001C 8FB20018 8FB10014 8FB00010 03E00008 27BD0030 1000FFE0 24020005 'disk_writep 27BDFFD0 AFBF002C AFB30028 AFB20024 AFB10020 10800028 AFB0001C 30A2FFFF 50400015 00001021 97868010 50C00012 00001021 00821021 3C05BF80 90830000 24840001 ACA35820 8CA35810 30630080 1060FFFD 3C03BF80 24C6FFFF 8C635820 1082000C 30C6FFFF 54C0FFF5 90830000 A7808010 00001021 8FBF002C 8FB30028 8FB20024 8FB10020 8FB0001C 03E00008 27BD0030 8FBF002C 00001021 8FB30028 8FB20024 8FB10020 8FB0001C A7868010 03E00008 27BD0030 14A0002D 3C04BF80 97858010 24A50001 AC805820 8C825810 30420080 1040FFFD 3C03BF80 8C625820 14A0FFF9 24A5FFFF 240200FF AC625820 3C03BF80 8C625810 30420080 1040FFFD 3C02BF80 8C425820 24030005 304200FF 3044001F 1083002F 240300FF 24020001 AFA20010 0411FC4F 00000000 240400FF 3C03BF80 8FA20010 AC645820 3C04BF80 8C835810 30630080 1060FFFD 8FBF002C 3C03BF80 8FB30028 8FB20024 8FB10020 8FB0001C 8C635820 03E00008 27BD0030 24040058 0411FC96 00000000 1440002A 240300FF 3C02BF80 AC435820 3C04BF80 8C825810 30420080 1040FFFD 3C03BF80 8C625820 240200FE 3C04BF80 AC625820 8C825810 30420080 1040FFFD 3C02BF80 8C425820 24020200 A7828010 1000FFAA 00001021 10430018 24111388 3C139D00 3C10BF80 241200FF 8E620004 0040F809 24040064 AE125820 8E025810 30420080 1040FFFD 3C02BF80 8C425820 304200FF 10520007 2631FFFF 5620FFF4 8E620004 1000FFBF 24020001 1000FF93 24020001 5220FFBB 24020001 1000FFB9 00001021 'pf_write 27BDFFD0 AFB3001C AFB10014 AFB00010 AFBF002C AFB60028 AFB50024 AFB40020 AFB20018 00E08821 00808021 00C09821 1080008B ACE00000 90820001 30430001 50600061 8FBF002C 54C00011 30420040 30430040 5460006A 00002021 304200BF A2020001 00001021 8FBF002C 8FB60028 8FB50024 8FB40020 8FB3001C 8FB20018 8FB10014 8FB00010 03E00008 27BD0030 50400057 8C830018 8C820018 8E03001C 00621823 0073202B 10800004 00A0A021 1060006D 00609821 00A0A021 24150200 10000005 2416FFBF 02729823 12600066 0292A021 8E020018 305201FF 16400020 02B29023 92120002 00021A42 2652FFFF 00729024 325200FF 56400008 8E050024 54400046 8E050024 8E050020 2CA20002 54400048 A2000001 AE050024 02002021 0411FCF0 00000000 10400041 00522821 AE050028 00002021 0411FF21 00000000 5440003C A2000001 92020001 8E120018 34420040 A2020001 325201FF 02B29023 0272102B 0262900B 02802021 02402821 0411FF13 00000000 5440002E A2000001 8E020018 8E240000 02421021 00922021 304301FF AE020018 1460FFCB AE240000 00002021 00002821 0411FF05 00000000 54400020 A2000001 92020001 00561024 1000FFC1 A2020001 24020004 8FB60028 8FB50024 8FB40020 8FB3001C 8FB20018 8FB10014 8FB00010 03E00008 27BD0030 2402FE00 00621024 1000FFA8 AC820018 00002821 0411FEEE 00000000 54400009 A2000001 1000FF91 92020001 02002021 0411FD25 00000000 1000FFB8 00402821 A2000001 8FBF002C 24020001 8FB60028 8FB50024 8FB40020 8FB3001C 8FB20018 8FB10014 8FB00010 03E00008 27BD0030 1000FF81 24020005 1000FF7F 00001021 'disk_initialize 3C029D00 8C420000 27BDFFD8 AFB20020 8C520000 2403003B 3C02BF80 AFB00018 AFBF0024 AFB1001C 00129042 AC435830 2410000A 3C03BF80 240400FF AC645820 8C625810 30420080 1040FFFD 3C02BF80 2610FFFF 321000FF 8C425820 1600FFF7 00002821 24040040 0411FBAD 00000000 00408821 24020001 1222000A 00000000 0411FB4C 00000000 24020001 8FBF0024 8FB20020 8FB1001C 8FB00018 03E00008 27BD0028 40904800 24040048 0411FB9C 240501AA 1451FFF2 27A40010 27A60014 3C03BF80 240500FF AC655820 8C625810 30420080 1040FFFD 3C02BF80 8C425820 A0820000 24840001 1486FFF7 24020001 93A30012 1462FFE2 93A30013 240200AA 1462FFDF 00000000 40024800 0052102B 240400E9 1040FFDA 3C054000 0411FB80 00000000 1440FFF8 2404007A 00002821 0411FB7B 00000000 1440FFD1 3C03BF80 240500FF 24040004 AC655820 8C665810 30C60080 10C0FFFD 3C11BF80 8E275820 27A80010 01023021 24420001 1444FFF6 A0C70000 93A30010 2402000C 30630040 24100004 0043800B 0411FB0A 00000000 24030002 02001021 AE235830 1000FFBC 8FBF0024 'check_fs 27BDFFE0 240601FE 24070002 AFB10018 AFB00014 AFBF001C 00808021 00A08821 0411FBD2 00000000 1440000E 8FBF001C 92030001 92020000 00031A00 00621825 7C031E20 2402AA55 1062000B 24020002 8FBF001C 8FB10018 8FB00014 03E00008 27BD0020 24020003 8FB10018 8FB00014 03E00008 27BD0020 02002021 02202821 24060052 24070002 0411FBB8 00000000 304200FF 5440FFEE 24020001 92020001 92030000 00021200 00431025 7C021620 38424146 1000FFE6 0002102B 'pf_mount 27BDFFB8 AFB0003C 00002821 00808021 27A40010 AFBF0044 AFB10040 0411FFC9 00000000 24030001 10430063 00008821 24030003 1043005B 8FBF0044 10400007 27A40010 8FBF0044 24020006 8FB10040 8FB0003C 03E00008 27BD0048 02202821 2406000D 24070024 0411FB91 00000000 1440004B 93A8002A 93A20029 93A60012 00084600 93A70027 93A50011 00021400 93AA0028 93A30015 93A40017 01021025 00063200 93A90014 93A80016 00471025 00C53025 000A5200 93A70013 93A50010 00031A00 00042200 004A1025 02268821 00691825 00882025 70471002 AE11000C A2050002 1480000B A6030004 93A90026 93A40025 00094E00 00042400 93A80023 93A70024 01242025 00882025 00073A00 00872025 00862023 00031902 00822023 00832023 0085001B 00A001F4 3404FFF7 00002812 24A50002 00A4202B 1480FFC1 AE050008 93A70032 93A40031 00621021 00518821 93A6002F 93A50030 24020003 00073E00 00042400 A2020000 A2000001 00E42025 00862025 00052A00 8FBF0044 00852025 AE110014 AE040010 00001021 8FB10040 8FB0003C 03E00008 27BD0048 8FBF0044 24020001 8FB10040 8FB0003C 03E00008 27BD0048 27A40010 00002821 240601BE 24070010 0411FB39 00000000 1440FFF4 8FBF0044 93A20014 5040FF9B 24020006 93B1001B 93A4001A 93A30018 00042400 93A20019 00118E00 02248825 02238825 00021200 02228825 27A40010 02202821 0411FF4B 00000000 1000FF85 24030003 'pf_open 27BDFFA0 AFB00054 AFBF005C AFB10058 00808021 10800017 00A03821 27A20010 A0800001 27A5001C 27A60030 AFA20020 0411FC7A 00000000 14400008 00408821 93A20030 10400004 93A2003B 30420010 1040000F 02002021 24110003 8FBF005C 02201021 8FB00054 8FB10058 03E00008 27BD0060 8FBF005C 24110005 02201021 8FB00054 8FB10058 03E00008 27BD0060 27A50030 0411FBC0 00000000 93A6004F 93A3004E 93A5004C 93A4004D AE020020 00063600 24020001 00031C00 A2020001 00C31825 00651825 00042200 8FBF005C 00641825 02201021 AE03001C AE000018 8FB10058 8FB00054 03E00008 27BD0060 'main 27BDFFC0 3C02BF80 AFB1001C 00808821 34048060 AFB70034 AFB60030 AFB5002C AFB40028 AFB30024 AFB20020 8C535830 AFB00018 8C545800 AFBF003C AFBE0038 8CA30000 8FB70050 8C555840 AC445800 24040C00 AC445840 24040002 00A08021 00C09021 00E0B021 AC445830 146000B2 00001021 3C03BF81 8C65F220 3C020661 7CA5D800 3444A053 50A40008 24020050 8C64F220 2443A053 7C84D800 00832026 24020050 2403000C 0064100B 3C039D00 8C640088 00441021 8C440000 24020065 1082006B 3C05BF81 8CA7F220 3C040661 7CE7D800 3486A053 10E600CF 8C620010 8CA5F220 2483A053 7CA5D800 00A32826 24040014 24030003 0065200B 00003021 0040F809 24050008 3C04BF81 8C86F220 3C030661 3C029D00 7CC6D800 3465A053 10C500C9 8C420010 8C85F220 2463A053 7CA5D800 00A31826 24040014 24050003 00A3200B 00003021 0040F809 24050064 3C04BF81 8C86F220 3C030661 3C029D00 7CC6D800 3465A053 10C500C3 8C420010 8C85F220 2463A053 7CA5D800 00A31826 24040029 2405000E 00A3200B 00003021 0040F809 24050002 3C04BF81 8C86F220 3C030661 3C029D00 7CC6D800 3465A053 10C500BD 8C420010 8C85F220 2463A053 7CA5D800 00A31826 24040029 2405000E 00A3200B 00003021 0040F809 24050064 3C04BF81 8C86F220 3C030661 3C029D00 7CC6D800 3465A053 10C500B7 8C420010 8C85F220 2463A053 7CA5D800 00A31826 2404000E 24050019 00A3200B 24050008 0040F809 00003021 3C04BF81 8C86F220 3C030661 3C029D00 7CC6D800 3465A053 10C50073 8C420010 8C85F220 2463A053 7CA5D800 00A31826 2404000E 24050019 00A3200B 24050064 0040F809 00003021 3C02BF81 8C43FA84 24040001 7C831804 AC43FA84 3C03BF81 8C64FB04 24020003 7C441804 AC64FB04 3C02BF80 34038060 AC435800 24030C00 AC435840 3C1E9D00 8FC20090 92430000 00003021 A0430030 8FC30090 8FC20010 80640030 0040F809 24050008 8FC30090 8FC2001C 80640030 0040F809 24050006 0411FDE8 00000000 30420001 1040002D 8FBF003C 24040001 00002821 00801021 00A01821 8FBE0038 8FB70034 8FB60030 8FB5002C 8FB40028 8FB30024 8FB20020 8FB1001C 8FB00018 03E00008 27BD0040 24040001 106400A6 02402021 24040002 5064001D 8EC50000 24040003 50640062 8EDE0000 8FBF003C 3C03BF80 00022FC3 00402021 AC735830 00801021 AC745800 8FBE0038 AC755840 8FB70034 00A01821 8FB60030 8FB5002C 8FB40028 8FB30024 8FB20020 8FB1001C 8FB00018 03E00008 27BD0040 02202021 0411FE4E 00000000 1000FFDF 8E030000 04A00003 02202021 0411FBA8 00000000 5440FFDF 8E030000 8EE60000 28C20100 10400085 02202021 26450001 27A70010 0411FC0A 00000000 8FA30010 A2430000 8FA40054 AC830000 1000FFD1 8E030000 1000FF94 2404000E 24040014 24050008 0040F809 00003021 3C04BF81 8C86F220 3C030661 3C029D00 7CC6D800 3465A053 14C5FF39 8C420010 24040014 24050064 0040F809 00003021 3C04BF81 8C86F220 3C030661 3C029D00 7CC6D800 3465A053 14C5FF3F 8C420010 24040029 24050002 0040F809 00003021 3C04BF81 8C86F220 3C030661 3C029D00 7CC6D800 3465A053 14C5FF45 8C420010 24040029 24050064 0040F809 00003021 3C04BF81 8C86F220 3C030661 3C029D00 7CC6D800 3465A053 14C5FF4B 8C420010 1000FF50 2404000E 2410FE00 03D08024 02202021 02002821 0411FB5E 00000000 8EE60000 28C20100 54400001 26520001 8EC20000 10500042 02402821 3C029D00 8C420040 0040F809 24040200 00402821 02202021 24060200 27A70010 0040B021 0411FBB8 00000000 02202021 02002821 0411FB48 00000000 1440FF83 8FBF003C 8EE40000 33DE01FF 03C42021 2C820201 54400031 03C4102A 2490FE00 24040200 02401021 02DEF021 02C42021 90430000 A3C30000 27DE0001 17C4FFFC 24420001 8FA60010 02202021 02C02821 27A70010 0411FC9C 00000000 56000023 8EE50000 02202021 00002821 00003021 27A70010 0411FC94 00000000 1000FF63 8FBF003C 0411F8E2 00000000 00402821 02202021 0411FE49 00000000 1000FF54 8E030000 02402821 27A70010 0411FB86 00000000 8FA30010 8FA40054 1000FF7D AC830000 27A70010 02202021 0411FC7E 00000000 1000FFE4 02202021 1040000C 00008021 1000FFD0 02401021 02202021 00B02823 02452821 02003021 27A70010 0411FC71 00000000 1000FFD7 02202021 8FA60010 02202021 02C02821 27A70010 0411FC69 00000000 1000FFCF 02202021 End CFunction #define SPISTAT *(volatile unsigned int *)(0xbf805810) //SPI status register #define SPIBUF *(volatile unsigned int *)(0xbf805820) //SPI output buffer #define SPICON *(volatile unsigned int *)(0xbf805800) //SPI control register #define SPIBRG *(volatile unsigned int *)(0xbf805830) //SPI clock register #define SPICON2 *(volatile unsigned int *)(0xbf805840) //SPI 2nd control register #define writeCommand(a,b) *dcclrport=dcpin; SPIBUF=a; while ((SPISTAT & 0x80)==0); b=SPIBUF; #define writeData(a,b) *dcsetport=dcpin; SPIBUF=a; while ((SPISTAT & 0x80)==0); b=SPIBUF; long long SetRegion(long long *x, long long *y, long long *w, long long *h){//Cfunction volatile unsigned int *dcsetport,*dcclrport; int dcpin, cspin, b,a=0, xstart=*x, ystart=*y, width=*w, height=*h, cs, cd; unsigned int consave,brgsave,con2save; brgsave=SPIBRG; //save any user SPI setup consave=SPICON; con2save=SPICON2; SPICON=0x8060; SPICON2=0xC00;// this is defined in IOPorts.h SPIBRG=2; cd=Option->LCD_CD; dcpin=1<<GetPinBit(cd); dcsetport=GetPortAddr(cd,LATSET); dcclrport=GetPortAddr(cd,LATCLR); PinSetBit(Option->LCD_CS,LATCLR); writeCommand(ILI9341_COLADDRSET,b); writeData(xstart>>8,b); writeData(xstart,b); writeData((xstart+width-1)>>8,b); writeData(xstart+width-1,b); writeCommand(ILI9341_PAGEADDRSET,b); writeData(ystart>>8,b); writeData(ystart,b); writeData((ystart+height-1)>>8,b); writeData(ystart+height-1,b); writeCommand(ILI9341_MEMORYWRITE,b); *dcsetport=dcpin; PinSetBit(Option->LCD_CS,LATSET); SPIBRG=brgsave; //restore user (or my) setup SPICON=consave; SPICON2=con2save; return Option->LCD_CD; } long long DisplayBuffer(unsigned char *C){//Cfunction int num=C[0],a=1,b,RGB; unsigned int consave,brgsave,con2save; brgsave=SPIBRG; //save any user SPI setup consave=SPICON; con2save=SPICON2; SPICON=0x8060; SPICON2=0xC00;// this is defined in IOPorts.h SPIBRG=2; PinSetBit(Option->LCD_CS,LATCLR); while(a<=num){ RGB = C[a]<<8 & 0xF800; RGB|=(C[a+1]<<3) & 0xFFE0; RGB|=(C[a+2]>>3); SPIBUF=RGB>>8; while ((SPISTAT & 0x80)==0);b=SPIBUF; SPIBUF=RGB; while ((SPISTAT & 0x80)==0);b=SPIBUF; a+=3; } PinSetBit(Option->LCD_CS,LATSET); SPIBRG=brgsave; //restore user (or my) setup SPICON=consave; SPICON2=con2save; return num; } |
||||
drkl![]() Senior Member ![]() Joined: 18/10/2015 Location: HungaryPosts: 102 |
Dear Matherp, Thanks to the modified program, it works perfectly. The tiger is beautiful. My question is to be used for data collection purposes is the same solution. I apply given the SPI2 solution using BASIC program if the replaced part C function? I'm sorry, but I can not in C programming. Thanks, drkl |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10180 |
Not quite sure I understand the question but if you are asking if this version does all the same functions as the SPI2 version then the answer is yes. All of the examples above have been tested and work if you substitute the Cfunction and change all the calls to refer to SDcardSPI1. Or just rename the Cfunction to "SDcard" - I changed it just to keep the version separate but Cfunctions don't care what they are called. |
||||
drkl![]() Senior Member ![]() Joined: 18/10/2015 Location: HungaryPosts: 102 |
Dear Matherp, I tested the programs, but I have a problem: Here is the begin of the testprogram: option explicit option default none ' ' Version to use the standard SPI port on the Micromite ' DIM I AS integer, P$(20) AS STRING length 20 const mount=0 const fileopen=1 const readfile=2 const writefile=3 const SD_CS = 4 P$(1)="tiger2.ppm" P$(2)="chipcad.ppm" P$(3)="tiger2.ppm" P$(4)="chipcad.ppm" cls do FOR I=1 TO 4 CLS VETIT P$(I) pause 2000 NEXT I loop SUB VETIT K$ ? "IN: ",K$ displaypicture(K$,0,0) ? "OUT: ",K$ END SUB and the result: > RUN IN: tiger2.ppm OUT: iger2.ppm IN: chipcad.ppm OUT: hipcad.ppm IN: tiger2.ppm OUT: iger2.ppm IN: chipcad.ppm OUT: hipcad.ppm IN: iger2.ppm The first characters are vanished! (displaypicture is wrong?) where I made a mistake? drk |
||||
drkl![]() Senior Member ![]() Joined: 18/10/2015 Location: HungaryPosts: 102 |
Dear Matherp, A new problem: If I inserted the sdcard cfunction into the library, the main progran can't run. It writes "RUN", but nothing happened. (the command line operates). The program with built in Cfunctions works well. drk |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10180 |
The fileopen call in the CFunction converts the Basic formatted string into a "C" formatted string. I could fix this but it just adds code. The workround is to copy the filename into a scratch variable before calling displaypicture FOR I=1 TO 4 CLS scratch$=P$(I) VETIT scratch$ pause 2000 NEXT I This works for me. You have to follow the correct procedure. First ensure the library area is clear - LIBRARY DELETE Then download just the Cfunctions to the Micromite and type LIBRARY SAVE Then REBOOT Now load the program without the CFunctions All should then work OK |
||||
drkl![]() Senior Member ![]() Joined: 18/10/2015 Location: HungaryPosts: 102 |
Dear Matherp, Thank you. The REBOOT was missing. All operates drk |
||||
RonnS Senior Member ![]() Joined: 16/07/2015 Location: GermanyPosts: 121 |
many Thanks to Mr. matherp.. the tiger an other Pics are working.... but a "CLS" command doesnt work into my loop for more then one Picture would it be possible to load an run an basic file from the SD Card (LCD BackPack SPI 1 ) ???? thanks Ron |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10180 |
No: Cfunctions don't currently have access to some core firmware routines that would be required to do this |
||||
micronut Newbie ![]() Joined: 03/09/2014 Location: United StatesPosts: 37 |
I was wondering how much larger the code would be if Chan's FatFs is used so we can get the ability to create files for logging purposes? Also I had some problems with using the SD functions on the LCD Backpack. When I use OPTION LCDPANEL ILI9341, LANDSCAPE, 2, 23 with the Touch disabled and SD_CS = 6 I get "Unable to mount Disk". How do you set up the LCD Backpack for SD functions? |
||||
micronut Newbie ![]() Joined: 03/09/2014 Location: United StatesPosts: 37 |
I did a little research and found that the SD Card SPI pins are the 4 hole header on the opposite side of the display. Geoff had enough fore thought to put the SPI connections on the breadboard compatible header. That makes things much easier. All I have to do is solder a 90 degree male header on the LCD and I'll be good to go. ![]() |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |