the "file" command
hello everyone I am attempting something that has never really happened before, in robotic history (as far as I know). The thing I am attempting is to have a robot connected to a computer (USB) that has a virtual program (dark basic) and it will have the virtual robot in that world (with other robots and obstacles) to do several different tasks. When the robot is done being used that program will rearrange .spin source code and apply info to a .txt file for the propeller to read, so in a way the robot thinks and applies that info to the next time it turns on. In a way it sort of evolves. I could talk a lot more about this but anyways I need to figure out how to use the file command within the propeller to finish this project... can anyone give me an idea on how it works, thank you in advance!!
Comments
In other words, the file is put inside of your HUB-RAM-image.
I guess file has to be used in a DAT-section - I think I never tried it so far ;o)
PS: If I understand you right a german computer magazine did something similar already. They developed a robot and a virtual robot including a virtual environment. The program you wrote for the robot could be run on both, the real and the virtual robot.
-Phil
It will then put the contents of that file, in the program image, addressed at whatever label is assigned to the file.
If one has built up a cog image, such that it can be loaded into RAM, and executed with a cognew, then it's a simple way to include a driver, or something into a project, as well. Nice way to simulate reading from SD card, or as a check on that, for example.
Declare a buffer, then use "file" to fetch a binary, and cognew it. Then, once it's all playing nice, happy, do it again from SD, with the same file.
Another use is for graphics assets and such. It's pretty easy to pack things into a file, then make use of them in the program with offsets of different kinds.
This is a very nice way to insert graphics, without having to encode them for DAT section storage the hard way. A bitmap file, could be loaded this way, header ignored, with the program consuming the graphics data directly. Open bitmap in editor, change pixels, save, hit F10...