Post Reply 
HP50G SD card STO and RCL
10-31-2014, 12:27 AM
Post: #1
HP50G SD card STO and RCL
I am new to this forum but not to HP calculators. I have (2) HP41CX and (2) HP 48SX calculators so I am no stranger to RPN and RPL. I have programmed both of these for a number of years. I just got an HP50G and I can only find one document on the web that deals with the SD card and how to use it. This was a HP support document and most of the instructions it gives don't seem to work on MY Hp50G. I am trying to learn how to save programs to the SD card and then RCL them and save them as a user program. For instance, The document says to use ' when accessing a program on the root of the SD card but this only returns errors on MY HP50G. I have to use " for everything ex: :3:"MYPROG/PROG2.
Also, when you RCL a directory on the SD card, how can you pick out 1 program from the directory (now on the stack) and make it a program on the calculator? What I need is the documentation for **MY** HP50G for accessing the SD card. Can anyone help and point me to it?
My rom version is 2.15, Build 0106, Firmware 4.02

Thanks to all and especially to Dave Hicks for helping me get on here.
Paul[/size][/font]
Find all posts by this user
Quote this message in a reply
10-31-2014, 03:02 AM
Post: #2
RE: HP50G SD card STO and RCL
(10-31-2014 12:27 AM)Paul 6146 Wrote:  I just got an HP50G and I can only find one document on the web that deals with the SD card and how to use it.

If you haven't already done so, I would suggest reading through the HP 50g User's Guide section that's devoted to the SD card ("Using SD cards", starting on page 26-7). That will probably fill in some of the details that you haven't seen yet.

(10-31-2014 12:27 AM)Paul 6146 Wrote:  I am trying to learn how to save programs to the SD card and then RCL them and save them as a user program.

This is a bit ambiguous. When you say "save programs to the SD card", are you saving them using the 50g, or are you attempting to save them to the card using a computer (eg. creating the source on a PC)? There's a big difference, and the answers will vary depending on what your intent is. Could you elaborate further?

(10-31-2014 12:27 AM)Paul 6146 Wrote:  Also, when you RCL a directory on the SD card, how can you pick out 1 program from the directory (now on the stack) and make it a program on the calculator?

The answer may depend on how the item was originally stored on the card, but if you've RCL'd a directory object to the stack from the SD card by name (eg. :3:"MYDIR" RCL), it will exist as a single object in stack level 1. Even though that directory may contain other elemental objects (numbers, programs, lists, etc.), it is still a single "container" object when recalled to the stack in that way. The only method I know of to work with the individual items it contains would be to store that directory object as a user (global) variable first ('MYDIR' STO). Then you can navigate to the item(s) of interest and do whatever is needed. If you're only interested in one item, simply recall that to the stack, delete the newly created directory, then save the remaining stack item wherever you need.

Hope this helps!
- David
Find all posts by this user
Quote this message in a reply
10-31-2014, 03:42 PM
Post: #3
RE: HP50G SD card STO and RCL
Thanks David! Your 2nd paragraph is exactly what I was doing. I would RCL a directory onto the stack and save it to the sd card thinking the programs inside the directory would be included on the sd card. I will try creating a global variable first on the sd card and then store the programs into it.


(10-31-2014 12:27 AM)Paul 6146 Wrote:  I am new to this forum but not to HP calculators. I have (2) HP41CX and (2) HP 48SX calculators so I am no stranger to RPN and RPL. I have programmed both of these for a number of years. I just got an HP50G and I can only find one document on the web that deals with the SD card and how to use it. This was a HP support document and most of the instructions it gives don't seem to work on MY Hp50G. I am trying to learn how to save programs to the SD card and then RCL them and save them as a user program. For instance, The document says to use ' when accessing a program on the root of the SD card but this only returns errors on MY HP50G. I have to use " for everything ex: :3:"MYPROG/PROG2.
Also, when you RCL a directory on the SD card, how can you pick out 1 program from the directory (now on the stack) and make it a program on the calculator? What I need is the documentation for **MY** HP50G for accessing the SD card. Can anyone help and point me to it?
My rom version is 2.15, Build 0106, Firmware 4.02

Thanks to all and especially to Dave Hicks for helping me get on here.
Paul[/size][/font]

(10-31-2014 03:02 AM)DavidM Wrote:  
(10-31-2014 12:27 AM)Paul 6146 Wrote:  I just got an HP50G and I can only find one document on the web that deals with the SD card and how to use it.

If you haven't already done so, I would suggest reading through the HP 50g User's Guide section that's devoted to the SD card ("Using SD cards", starting on page 26-7). That will probably fill in some of the details that you haven't seen yet.

(10-31-2014 12:27 AM)Paul 6146 Wrote:  I am trying to learn how to save programs to the SD card and then RCL them and save them as a user program.

This is a bit ambiguous. When you say "save programs to the SD card", are you saving them using the 50g, or are you attempting to save them to the card using a computer (eg. creating the source on a PC)? There's a big difference, and the answers will vary depending on what your intent is. Could you elaborate further?

(10-31-2014 12:27 AM)Paul 6146 Wrote:  Also, when you RCL a directory on the SD card, how can you pick out 1 program from the directory (now on the stack) and make it a program on the calculator?

The answer may depend on how the item was originally stored on the card, but if you've RCL'd a directory object to the stack from the SD card by name (eg. :3:"MYDIR" RCL), it will exist as a single object in stack level 1. Even though that directory may contain other elemental objects (numbers, programs, lists, etc.), it is still a single "container" object when recalled to the stack in that way. The only method I know of to work with the individual items it contains would be to store that directory object as a user (global) variable first ('MYDIR' STO). Then you can navigate to the item(s) of interest and do whatever is needed. If you're only interested in one item, simply recall that to the stack, delete the newly created directory, then save the remaining stack item wherever you need.

Hope this helps!
- David
Find all posts by this user
Quote this message in a reply
10-31-2014, 03:47 PM (This post was last modified: 10-31-2014 03:48 PM by Han.)
Post: #4
RE: HP50G SD card STO and RCL
(10-31-2014 03:42 PM)Paul 6146 Wrote:  Thanks David! Your 2nd paragraph is exactly what I was doing. I would RCL a directory onto the stack and save it to the sd card thinking the programs inside the directory would be included on the sd card. I will try creating a global variable first on the sd card and then store the programs into it.

If you are trying to use

:port_number:dir_name/prog_name

that's not going to work. The scheme only works for internal ports because the objects stored on internal ports are HP objects. The file format of an SD card, however, is the same as that on a PC, which would have no ability to recognize composite HP objects. Thus the scheme above would not work for port 3 (where the SD card sits) because any "name" you create there is a "PC filename" and any object you store there is no longer an HP object but a "PC file."

Saving each individual program to its own file on the SD card will work just fine, though.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
10-31-2014, 09:50 PM
Post: #5
RE: HP50G SD card STO and RCL
(10-31-2014 03:42 PM)Paul 6146 Wrote:  Thanks David! Your 2nd paragraph is exactly what I was doing. I would RCL a directory onto the stack and save it to the sd card thinking the programs inside the directory would be included on the sd card. I will try creating a global variable first on the sd card and then store the programs into it.

If I understand you correctly, that won't work. Saving a global to the SD card will not allow you to edit it or change the contents after it's been saved.

What is your goal? Are you trying to create a set of programs on the SD card that can be brought into main memory as needed? Or just needing to create a backup? Or something else? It's not clear to me what problem you're trying to solve with this. Where you put things and how you organize/group them will change depending on what it is you're trying to do.
Find all posts by this user
Quote this message in a reply
11-01-2014, 01:51 AM
Post: #6
RE: HP50G SD card STO and RCL
David
I am trying to make an exact copy of 2 directories on the calculator to the SD card. Each directory contains 2 programs. These would function as a backup on the SD card.
What confuses me is what the other user "Han" said about the files on the sd card being only compatible with a pc and not the hp. I used the same syntax that the User manual used to save a Dir/file to the card but when I view the directory from the file manager it won't show the program in the directory Ex. :3:"BASE/D-H" (enter on stack level 1) then STO.
Find all posts by this user
Quote this message in a reply
11-01-2014, 04:36 AM
Post: #7
RE: HP50G SD card STO and RCL
(10-31-2014 03:47 PM)Han Wrote:  
(10-31-2014 03:42 PM)Paul 6146 Wrote:  Thanks David! Your 2nd paragraph is exactly what I was doing. I would RCL a directory onto the stack and save it to the sd card thinking the programs inside the directory would be included on the sd card. I will try creating a global variable first on the sd card and then store the programs into it.
This is the EXACT syntax that the user manual tells you to store a program in a directory.... :3:"dir/program" enter sto
the directory os created and it appears in the File Manager.
if you try to view the directory an error message appears.



If you are trying to use

:port_number:dir_name/prog_name

that's not going to work. The scheme only works for internal ports because the objects stored on internal ports are HP objects. The file format of an SD card, however, is the same as that on a PC, which would have no ability to recognize composite HP objects. Thus the scheme above would not work for port 3 (where the SD card sits) because any "name" you create there is a "PC filename" and any object you store there is no longer an HP object but a "PC file."

Saving each individual program to its own file on the SD card will work just fine, though.
Find all posts by this user
Quote this message in a reply
11-01-2014, 05:46 AM
Post: #8
RE: HP50G SD card STO and RCL
(11-01-2014 01:51 AM)Paul 6146 Wrote:  David
I am trying to make an exact copy of 2 directories on the calculator to the SD card. Each directory contains 2 programs. These would function as a backup on the SD card.
What confuses me is what the other user "Han" said about the files on the sd card being only compatible with a pc and not the hp. I used the same syntax that the User manual used to save a Dir/file to the card but when I view the directory from the file manager it won't show the program in the directory Ex. :3:"BASE/D-H" (enter on stack level 1) then STO.

Any time you STO something on the SD card, it exists there as a single file -- regardless of what that file actually contains. It can be a number, a string, a list, an array, a program, a 50g directory, or even a backup of the 50g's main memory. All of those objects are still seen as a single entity when stored on the SD card.

If I'm understanding you correctly, you're wanting to replicate a group of items that are organized as a 50g directory into a similar hierarchy on the SD card. That simply can't be done in a single step. You would have to STO them on the SD card one at a time. That's the only way you'd see the individual items on the SD card.
Find all posts by this user
Quote this message in a reply
11-01-2014, 08:42 AM
Post: #9
RE: HP50G SD card STO and RCL
consider also try this program made ​​by Tim Wessman:

SDfiler
Quote:SDfiler is a uses a C library to directly access the SD card. This provides the ability to browse the SD card while displaying full length file names, as well as delete folders, move files between subdirectories, and other abilities that are impossible using the native filer. Full source included.
http://www.hpcalc.org/details.php?id=6524
Find all posts by this user
Quote this message in a reply
11-01-2014, 03:18 PM
Post: #10
RE: HP50G SD card STO and RCL
(11-01-2014 05:46 AM)DavidM Wrote:  
(11-01-2014 01:51 AM)Paul 6146 Wrote:  David
I am trying to make an exact copy of 2 directories on the calculator to the SD card. Each directory contains 2 programs. These would function as a backup on the SD card.
What confuses me is what the other user "Han" said about the files on the sd card being only compatible with a pc and not the hp. I used the same syntax that the User manual used to save a Dir/file to the card but when I view the directory from the file manager it won't show the program in the directory Ex. :3:"BASE/D-H" (enter on stack level 1) then STO.

Any time you STO something on the SD card, it exists there as a single file -- regardless of what that file actually contains. It can be a number, a string, a list, an array, a program, a 50g directory, or even a backup of the 50g's main memory. All of those objects are still seen as a single entity when stored on the SD card.

If I'm understanding you correctly, you're wanting to replicate a group of items that are organized as a 50g directory into a similar hierarchy on the SD card. That simply can't be done in a single step. You would have to STO them on the SD card one at a time. That's the only way you'd see the individual items on the SD card.

David
Then what is the purpose of the USER manual telling you that you can store a program into a directory on the sd card when you can't even access the directory in the File Manager? This generates an error. So in other words......the hp50G doesn't really make directories on the sd card. This says to me that all the programs you want to save to sd card must be saved in the root which is going to be a mess since there will be multiple programs that belong together all mixed up with other programs in one place. Not very good design!
Find all posts by this user
Quote this message in a reply
11-01-2014, 04:41 PM
Post: #11
RE: HP50G SD card STO and RCL
(11-01-2014 03:18 PM)Paul 6146 Wrote:  David
Then what is the purpose of the USER manual telling you that you can store a program into a directory on the sd card when you can't even access the directory in the File Manager? This generates an error. So in other words......the hp50G doesn't really make directories on the sd card. This says to me that all the programs you want to save to sd card must be saved in the root which is going to be a mess since there will be multiple programs that belong together all mixed up with other programs in one place. Not very good design!

The User Manual is correct, but you're making some assumptions about what it means that aren't correct. You appear to be making a mental connection between calculator directories and SD card directories, and that's where things are falling apart for you. They are not the same thing. The 50g can make SD directories on the SD card, but there's no connection between those and the ones you see on your calculator (other than the fact that we call them both "directories").

Let's say I have a newly-formatted SD card installed in my 50g. I want to save a Gregorian-to-Julian date conversion program I just wrote on the card, but instead of the root of the card, I want to save it into a SD subdirectory. I might do the following:

1) RCL the program object to the stack
2) Type in the following SD card file specifier: :3:"UTILS/DATETOOLS/CONVERT/GtoJ"
3) STO

The STO command will happily create a UTILS directory at the root of the card, and then DATETOOLS and CONVERT subdirectories beneath it. Finally, the program is stored into an SD file named "GtoJ" in the CONVERT subdirectory. This (hopefully) is perfectly understandable.

Now consider the same situation, but instead of saving a single program, you recall a calculator directory object containing multiple programs to the stack. Everything that happened above for the single program will still apply to this new scenario. Just like in the first case, the STO command will happily create the UTILS/DATETOOLS/CONVERT/ directory structure on the SD card, then save the object you gave it into a single file named "GtoJ". The STO command doesn't treat the directory object any differently than any other object -- it simply saves it as a file in the location you specified.

As a convenience, the Filer (and several third-party utilities) will show you what type of object the SD card file is, but none that I am aware of will allow you to browse the contents of that object if it happens to be a composite (list, array, program, library, etc.).
Find all posts by this user
Quote this message in a reply
11-01-2014, 04:51 PM
Post: #12
RE: HP50G SD card STO and RCL
Here's what I use to backup my projects. It will backup all objects in the current directory into the SD card, into the same path where they are in HOME, each object in a different file, overwriting them if they exist. Doesn't do subdirectories, though, you have to manually enter the subdirs and run it there too.

Code:

\<< PATH TAIL "/" SWAP ADD "/" + \GSLIST VARS ADD
VARS 2. \<< RCL SWAP 3. \->TAG DUP PURGE STO 0. \>>
DOLIST DROP
\>>
Find all posts by this user
Quote this message in a reply
11-01-2014, 05:06 PM
Post: #13
RE: HP50G SD card STO and RCL
(11-01-2014 01:51 AM)Paul 6146 Wrote:  I am trying to make an exact copy of 2 directories on the calculator to the SD card. Each directory contains 2 programs. These would function as a backup on the SD card.

Paul,
The program in my previous post will help you. Just store it in the directory with your 2 programs, I usually name it SDBACK. Every time you want to back up your programs, just run SDBACK directly from the VARS menu, and it will do the job.
If your programs are in { HOME MYPROGS MYDIR }, they will be stored in the SD card in /MYPROGS/MYDIR, each program in a separate file, named exactly like in the calculator.
For this to work well, you need to avoid using strange characters when naming your programs (and directories) in the calculator, like using the arrow or the sigma letter, etc. You can only use characters that will be accepted as a file name in a FAT filesystem, so stick to plain ASCII.

Hope it helps.
Find all posts by this user
Quote this message in a reply
11-01-2014, 05:24 PM
Post: #14
RE: HP50G SD card STO and RCL
Claudio....Thanks for your backup program.
David....Thanks for the explanation about directories. I downloaded the Filer library and the C source. I'll try to install the Library when I figure out that procedure. You're correct, I was assuming that if you create a directory on the SD card you can put programs into the directory (folder container) and then the file manager would show them in the tree. Do either of you gentlemen know how I *can* group programs on the SD card that are from the same sub directory on the calculator? I don't like the idea of just dumping everything to the root. I want to thank you both for being patient with me and my learning curve. I'll eventually figure it out just like I did with the 41CX and the 48SX.
Find all posts by this user
Quote this message in a reply
11-01-2014, 07:02 PM (This post was last modified: 11-01-2014 07:14 PM by DavidM.)
Post: #15
RE: HP50G SD card STO and RCL
(11-01-2014 05:24 PM)Paul 6146 Wrote:  I was assuming that if you create a directory on the SD card you can put programs into the directory (folder container) and then the file manager would show them in the tree.

There's an important subtlety to this statement that makes it either true or false. I've re-written it below with slight modifications to show the difference:

FALSE:
Quote:...if you create STO a calculator directory object on the SD card you can put programs into the calculator directory object and then the file manager would show them in the tree.

TRUE:
Quote:...if you create a SD directory on the SD card you can put programs into the SD directory and then the file manager would show them in the tree.

Note that, technically speaking, the Filer won't show the directory contents in the tree, but it does show them if you follow the SD card directories using the right-arrow key.

(11-01-2014 05:24 PM)Paul 6146 Wrote:  Do either of you gentlemen know how I *can* group programs on the SD card that are from the same sub directory on the calculator? I don't like the idea of just dumping everything to the root. I want to thank you both for being patient with me and my learning curve. I'll eventually figure it out just like I did with the 41CX and the 48SX.

Just use something like the program Claudio provided above. Follow his instructions carefully and you'll get there.

Don't feel bad about not understanding all of this just yet. The documentation could definitely be clearer than it is, and there's some underlying details in the implementation that help to make sense of this once you begin to understand them. But now is not the time for that level of specificity. Get to know the system better first, and then start digging into the underpinnings after you start to see the bigger picture. The good news is that there's a ton of information and tools available when you're ready.
Find all posts by this user
Quote this message in a reply
12-11-2018, 12:36 PM (This post was last modified: 12-11-2018 03:00 PM by Stevetuc.)
Post: #16
RE: HP50G SD card STO and RCL
(11-01-2014 04:51 PM)Claudio L. Wrote:  Here's what I use to backup my projects. It will backup all objects in the current directory into the SD card, into the same path where they are in HOME, each object in a different file, overwriting them if they exist. Doesn't do subdirectories, though, you have to manually enter the subdirs and run it there too.

Code:

\<< PATH TAIL "/" SWAP ADD "/" + \GSLIST VARS ADD
VARS 2. \<< RCL SWAP 3. \->TAG DUP PURGE STO 0. \>>
DOLIST DROP
\>>

Hi Claudio,

I entered the above program into my Hp50g, with the appropriate \ char substitutions. Ie \GS char(133) from CHARS.

When run in home I get the error:

ADD Error: Invalid Dimension

And on return stack:

2: "/"
1: { }

Mode is set RPN
Cas approx
Can you see whats wrong?


Attached File(s) Thumbnail(s)
   
Find all posts by this user
Quote this message in a reply
12-14-2018, 10:01 PM
Post: #17
RE: HP50G SD card STO and RCL
(12-11-2018 12:36 PM)Stevetuc Wrote:  
(11-01-2014 04:51 PM)Claudio L. Wrote:  Here's what I use to backup my projects. It will backup all objects in the current directory into the SD card, into the same path where they are in HOME, each object in a different file, overwriting them if they exist. Doesn't do subdirectories, though, you have to manually enter the subdirs and run it there too.

Code:

\<< PATH TAIL "/" SWAP ADD "/" + \GSLIST VARS ADD
VARS 2. \<< RCL SWAP 3. \->TAG DUP PURGE STO 0. \>>
DOLIST DROP
\>>

Hi Claudio,

I entered the above program into my Hp50g, with the appropriate \ char substitutions. Ie \GS char(133) from CHARS.

When run in home I get the error:

ADD Error: Invalid Dimension

And on return stack:

2: "/"
1: { }

Mode is set RPN
Cas approx
Can you see whats wrong?

PATH TAIL will give you an empty list, so it can't be used at HOME without considering that as a special case (which the code does not).
The whole point of that little program is to dump an entire subdirectory into an equally named subdirectory in the SD card, so it's only meant to be used within a subdirectory.

To make it work in home a simple fix would be:

Code:

\<< PATH TAIL IF DUP SIZE THEN "/" SWAP ADD "/" + \GSLIST ELSE DROP "/" END VARS ADD
VARS 2. \<< RCL SWAP 3. \->TAG DUP PURGE STO 0. \>>
DOLIST DROP
\>>
Find all posts by this user
Quote this message in a reply
12-15-2018, 02:32 PM (This post was last modified: 12-15-2018 02:34 PM by Stevetuc.)
Post: #18
RE: HP50G SD card STO and RCL
(12-14-2018 10:01 PM)Claudio L. Wrote:  PATH TAIL will give you an empty list, so it can't be used at HOME without considering that as a special case (which the code does not).
The whole point of that little program is to dump an entire subdirectory into an equally named subdirectory in the SD card, so it's only meant to be used within a subdirectory.

To make it work in home a simple fix would be:

Code:

\<< PATH TAIL IF DUP SIZE THEN "/" SWAP ADD "/" + \GSLIST ELSE DROP "/" END VARS ADD
VARS 2. \<< RCL SWAP 3. \->TAG DUP PURGE STO 0. \>>
DOLIST DROP
\>>

Thanks Claudio, that works well. I changed the final "/" to "/HOME/" so that contents of home gets its own subdir too.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: