Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 19:53 24 Apr 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Flash file system

Author Message
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1798
Posted: 11:22pm 23 Jan 2023
Copy link to clipboard 
Print this post

I am re writing my weather station code to use the flash file system instead of saving to the DS3231 flash
I'm trying to open a directory and save some values, I have
  Quote  open "A:/weather" for output as #1

and I get   Error : Entry is a dir
I find it hard as I can't find any examples, what am I doing wrong?
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3839
Posted: 11:55pm 23 Jan 2023
Copy link to clipboard 
Print this post

Hi @palcal,

You don't "open a directory", you open a file in a directory.

Assuming the directory "A:/weather/" exists (if not then use MKDIR first) then:

open "A:/weather/my_file.txt" for output as #1


Best wishes,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1798
Posted: 12:05am 24 Jan 2023
Copy link to clipboard 
Print this post

Thanks I have never worked with directories so learning
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1798
Posted: 12:22am 24 Jan 2023
Copy link to clipboard 
Print this post

Thanks I have never worked with directories so learning
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1798
Posted: 01:17am 24 Jan 2023
Copy link to clipboard 
Print this post

OK got it working with..
open "A:/weather/data" for output as #1
print #1, rain
print #1, rainyest
print #1, rainyear
close #1
open "A:/weather/data" for input as#1
input #1, rain
input #1, rainyest
input #1, rainyear
close #1
print rain,rainyest,rainyear


Is there a way to Input and Output without using 3 lines, I tried...
print #1, rain, rainyest, rainyear
input #1, rain, rainyest, rainyear

but the second two entries returned zero
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5897
Posted: 01:25am 24 Jan 2023
Copy link to clipboard 
Print this post

'
rain =25
raintest = 100.5
rainyear = 1040.8

OPEN "A:/weather/data" FOR output AS #1
PRINT #1, rain;","; rainyest;","; rainyear
CLOSE #1
OPEN "A:/weather/data" FOR INPUT as#1
INPUT #1, rain, rainyest,rainyear
CLOSE #1
PRINT rain,rainyest,rainyear



You need to pout commas between the fields when printing to the file.

Jim
VK7JH
MMedit   MMBasic Help
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1798
Posted: 01:38am 24 Jan 2023
Copy link to clipboard 
Print this post

OK Jim thanks for that.
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1798
Posted: 02:57am 24 Jan 2023
Copy link to clipboard 
Print this post

With my new Win 11 machine none of the function keys work with Teraterm, GFXterm or MMEdit.
the function key for screen brightness are OK.
Edited 2023-01-24 13:15 by palcal
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5897
Posted: 03:37am 24 Jan 2023
Copy link to clipboard 
Print this post

On some keyboards the function keys are dual purpose and you may have to switch them to "function keys"
This is very common on laptops and keyboards that are supplied by the big name manufacturers.
VK7JH
MMedit   MMBasic Help
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1798
Posted: 04:58am 24 Jan 2023
Copy link to clipboard 
Print this post

Forget it.
Edited 2023-01-24 15:02 by palcal
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
Chrisk

Senior Member

Joined: 21/12/2014
Location: Australia
Posts: 114
Posted: 06:05am 09 Feb 2023
Copy link to clipboard 
Print this post

Hi Guys
I'm not sure why Palcal is using the DS3231 flash.
Isn't it an RTC. Does it have memory that can be written to?
Then once stored what do you Palcal  do with this data.
Just interested.

Chris K
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 1777
Posted: 06:24am 09 Feb 2023
Copy link to clipboard 
Print this post

Most RTC modules also have a 24C32 memory chip which he was using, but now the Pico has a flash file system he is switching to that.
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1798
Posted: 07:36am 09 Feb 2023
Copy link to clipboard 
Print this post

@ Chrisk, yes I saved to the DS3231 flash. The code is somewhere here on the forum, I can post it if you want.
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
Chrisk

Senior Member

Joined: 21/12/2014
Location: Australia
Posts: 114
Posted: 05:08am 10 Feb 2023
Copy link to clipboard 
Print this post

Hi palcal
Tried to look it up with search but couldn't find it.
Please send when you have the time.
What is the advantage of using one over the other.
Quite often it is better to leave a functioning system alone unless there are real advantages.

Phill99.- Thanks Phill, I will look up the data sheet.

Chris K
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1593
Posted: 05:17am 10 Feb 2023
Copy link to clipboard 
Print this post

Maybe this is what you are looking for?

Bill
Keep safe. Live long and prosper.
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1798
Posted: 05:23am 10 Feb 2023
Copy link to clipboard 
Print this post

Now I remember, it was Twofingers, I've been trying to remember so I could look it up.
I think probably easier to use than the Flash File system but that's just me and this will also work with the MMs
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1593
Posted: 05:35am 10 Feb 2023
Copy link to clipboard 
Print this post

My link above is to Michael's (Twofingers) post.

Bill
Keep safe. Live long and prosper.
 
Chrisk

Senior Member

Joined: 21/12/2014
Location: Australia
Posts: 114
Posted: 08:47am 10 Feb 2023
Copy link to clipboard 
Print this post

Thanks Guys

The info in the link certainly had my head whirring.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8573
Posted: 11:02am 10 Feb 2023
Copy link to clipboard 
Print this post

The flash file system is exactly the same as the SDcard file system that has been in Maximites and Micromites for ages.

The only difference is that, like LINUX, filenames are case sensitive so "file.bas" is different from "FILE.bas" etc. To make like easy keep everything in lower case and then you can forget about it.

It is very well described in the manual section on "Program and data storage"
Edited 2023-02-10 21:03 by matherp
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024