SD card
Moderator: Benj
-
- Posts: 30
- Joined: Sat Mar 05, 2016 11:15 am
- Been thanked: 3 times
SD card
Hello I am a new user. I am trying to write a file to the sd card and then open it and display on lcd. I am having no luck please help. I have attached my file.
- Attachments
-
- FlowcodeSD card.fcfx
- (8.62 KiB) Downloaded 381 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: SD card
Hello,
I've made some modest modifications and your program now seems to be working well in simulation.
I've made some modest modifications and your program now seems to be working well in simulation.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 30
- Joined: Sat Mar 05, 2016 11:15 am
- Been thanked: 3 times
Re: SD card
Thanks so much. I think I am a bit confused though can i not create a string in the variable filecontent and then display that after i have written it to the sd card on my lcd. so that when i printascii(retval) it is the string i stored on filecontent. such as a calculation that file to content = hello then the lcd prints that as the reval.sorry if i am a bit noobish.
-
- Posts: 30
- Joined: Sat Mar 05, 2016 11:15 am
- Been thanked: 3 times
Re: SD card
Sorry. Am I being a fool or can you not read a file from the sd card and display on the lcd.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: SD card
Hello,
If your still struggling then please post your current flowchart again and we can look and see if we can work out what's going wrong.
You can assign a variable to a string and then use that string to write to the SD card and then write to an LCD. This should all work fine.I think I am a bit confused though can i not create a string in the variable filecontent and then display that after i have written it to the sd card on my lcd.
Print ASCII only prints a single byte to the LCD. This is why I used a loop to go through the string a byte at a time. You could instead use the print function which allows a string to be printed to the display in a single command.when i printascii(retval) it is the string i stored on filecontent
If your still struggling then please post your current flowchart again and we can look and see if we can work out what's going wrong.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 30
- Joined: Sat Mar 05, 2016 11:15 am
- Been thanked: 3 times
Re: SD card
Hello. I am a little confused about the sequence. If I create a file on the sd card and then append string to file. does that mean that I am writing the string hello i created on the variable file content to the file of the sd card or does it place the name of the variable filecontent into the file aswell or only. what would be written onto the append string to file on a real sd card? if I then write to file how can I read a file in the sd card and write it to the lcd.
- Attachments
-
- FlowcodeSD card.fcfx
- (8.53 KiB) Downloaded 381 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: SD card
Hello,
If you create a file on an SD card, open the file and then use the append string function then it will take the bytes from RAM and write those bytes to the file on the SD card.
You will end up with a file on the SD card which contains the text "Hello".
Create File "text.txt"
Open File "text.txt"
Append To File "writing to SD card"
Open File "text.txt"
Stream contents from file to LCD
A string variable is a number of locations in RAM. If you assign the value "Hello" to the string then the ASCII bytes 'H', 'e' etc are transferred to the bytes in RAM.If I create a file on the sd card and then append string to file. does that mean that I am writing the string hello i created on the variable file content to the file of the sd card or does it place the name of the variable filecontent into the file aswell or only.
If you create a file on an SD card, open the file and then use the append string function then it will take the bytes from RAM and write those bytes to the file on the SD card.
You will end up with a file on the SD card which contains the text "Hello".
In the example I posted above I take the string you assign and write it to a file. I then re-open the file and stream the contents to the LCD.if I then write to file how can I read a file in the sd card and write it to the lcd.
Create File "text.txt"
Open File "text.txt"
Append To File "writing to SD card"
Open File "text.txt"
Stream contents from file to LCD
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 30
- Joined: Sat Mar 05, 2016 11:15 am
- Been thanked: 3 times
-
- Posts: 30
- Joined: Sat Mar 05, 2016 11:15 am
- Been thanked: 3 times
Re: SD card
I think I have a little prob. If I wanted to have the lcd read the file from the sd as in a real scenario where the micro scans for sd insert then displays the file contents to lcd would the flowcode program work. I have included your file up to where I understand then want to open sd and read its contents with micro and display on lcd.
- Attachments
-
- FlowcodeSD card.fcfx
- (9.5 KiB) Downloaded 368 times
-
- Posts: 30
- Joined: Sat Mar 05, 2016 11:15 am
- Been thanked: 3 times
-
- Posts: 30
- Joined: Sat Mar 05, 2016 11:15 am
- Been thanked: 3 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: SD card
Hello,
Have a look at the example here and it shows streaming a file byte by byte from a file to the LCD.
http://www.matrixtsl.com/wiki/index.php ... _text_file
Have a look at the example here and it shows streaming a file byte by byte from a file to the LCD.
http://www.matrixtsl.com/wiki/index.php ... _text_file
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 30
- Joined: Sat Mar 05, 2016 11:15 am
- Been thanked: 3 times