Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0
BloodyRum

How to program EEPROM?

Question

10 answers to this question

Recommended Posts

  • 0
  • Solution

If you ask me, writing to an EEPROM chip is not that hard:

  • Write your BIOS in Lua
  • Stick an empty EEPROM chip into your computer
  • Run flash yourbioscode.lua
  • Take out your EEPROM (and put the old one back in, otherwise your dev computer won't start)

Or if you want to do it from Lua:

local component = require("component")
component.eeprom.set("-- your BIOS code here")

Writing data to an EEPROM is not hard, it's writing a program in only 4 KB with only basic APIs that's difficult. The reason for that is that you're not programming an Arduino, you're programming a computer on its lowest level. I don't know Arduino much, but I assume that you can write Arduino programs with more high-level and easy-to-use libraries than a BIOS.

Link to post
Share on other sites
  • 0

EEPROMs can store 4096 bytes of code (dependant on the architecture of the CPU in the computer) and can be written to by utilising the "flash" program in OpenOS (not sure if other OS' have flash programs). once you have booted the computer to OpenOS you can remove the Lua BIOS EEPROM and put in a blank one ready for writing to.
 

You will need to keep the EEPROM in some sort of loop because if the program exits/finishes then it will turn off.
http://ocdoc.cil.li/tutorial:custom_oses may also be of use to know what is available to the controller.

Link to post
Share on other sites
  • 0

EEPROMs can store 4096 bytes of code (dependant on the architecture of the CPU in the computer) and can be written to by utilising the "flash" program in OpenOS (not sure if other OS' have flash programs). once you have booted the computer to OpenOS you can remove the Lua BIOS EEPROM and put in a blank one ready for writing to.

 

You will need to keep the EEPROM in some sort of loop because if the program exits/finishes then it will turn off.

http://ocdoc.cil.li/tutorial:custom_oses may also be of use to know what is available to the controller.

That seams more difficult then it should be. Is there any plans to make it act like a floppy in a block that reads it?

Link to post
Share on other sites
  • 0

That seams more difficult then it should be. Is there any plans to make it act like a floppy in a block that reads it?

 

Microcontrollers are not meant to be easy. As for blocks for reading them, I think Computronics might add one (don't quote me on that, I'm not 100% sure). They can be read the same way they're written to (i think the flash program has arguments for reading from the EEPROM to a file) by putting it in a computer case.

Link to post
Share on other sites
  • 0

Actually in real world it is not that hard to connect a microcontroller and program it. Reading of course is kind of impossible.

So from my site i would appreciate making writing to it easier, but it would be acceptable if reading is not possible at all.

Link to post
Share on other sites
  • 0

Microcontrollers are not meant to be easy. As for blocks for reading them, I think Computronics might add one (don't quote me on that, I'm not 100% sure). They can be read the same way they're written to (i think the flash program has arguments for reading from the EEPROM to a file) by putting it in a computer case.

I did not mean Microcontrollers are harder then they should I mean programming the EEPROM is too hard. In real life Microcontrollers are easy (At least for me besides the pesky soldering) to use and upload info too. When I decide to write a code for Arduino I just plug it in using a simple USB cable then open the programming application for it and write.

 

As for what Kevink525 Said That "Reading of course is kind of impossible." its not. I mean it "kind" of is but with some good logic and some setup you can find the code or reverse engineer it. Writing to the EEPROM should be easy but Reading it should be difficult if at all possible.

Link to post
Share on other sites
  • 0

If you ask me, writing to an EEPROM chip is not that hard:

  • Write your BIOS in Lua
  • Stick an empty EEPROM chip into your computer
  • Run flash yourbioscode.lua
  • Take out your EEPROM (and put the old one back in, otherwise your dev computer won't start)

Or if you want to do it from Lua:

local component = require("component")
component.eeprom.set("-- your BIOS code here")

Writing data to an EEPROM is not hard, it's writing a program in only 4 KB with only basic APIs that's difficult. The reason for that is that you're not programming an Arduino, you're programming a computer on its lowest level. I don't know Arduino much, but I assume that you can write Arduino programs with more high-level and easy-to-use libraries than a BIOS.

Thank you. Now it looks like something a ten year old can do. (Not joking nor being Sarcastic) But it should be easily done with something like

 

1. Make special X Block and put EEPROM Into it

2. Enter something like "edit (EEPROM Add)"

3. Enter code then remove EEPROM

 

With Arduino the coding is "simple" much like OpenComputers. Snippet of Arduino code

int hour11 = 1;
int hour21 = 2;
int hour22 = 3;
int hour23 = 4;
int hour24 = 5;
int minute11 = 6;
int minute12 = 7;
int minute13 = 8;
int minute21 = 9;
int minute22 = 10;
int minute23 = 11;
int minute24 = 12;
    int hour1 =  0;
    int hour2 = 0;
    int minute1 = 0;
    int minute2 = 0;
        int addmin = 0;
        int addhour = 13;
void setup() {
  pinMode(hour11, OUTPUT);
  pinMode(hour21, OUTPUT);
  pinMode(hour22, OUTPUT);
  pinMode(hour23, OUTPUT);
  pinMode(hour24, OUTPUT);
  pinMode(minute11, OUTPUT);
  pinMode(minute12, OUTPUT);
  pinMode(minute13, OUTPUT);
  pinMode(minute21, OUTPUT);
  pinMode(minute22, OUTPUT);
  pinMode(minute23, OUTPUT);
  pinMode(minute24, OUTPUT);
  pinMode(addmin, INPUT);
  pinMode(addhour, INPUT);
}

void loop() {
  delay(60000);
  minute2 = minute2 + 1;
  if (minute2 = 10){
    minute1 = minute1 + 1;
    minute2 = 0;
  }
    if (minute1 = 6){
      hour2 = hour2 + 1;
      minute1 = 0;
    }
      if (hour2 = 10){
        hour1 = hour1 + 1;
        hour2 = 0;
      }
      if (hour2 = 2){
        if (hour1 = 1){
          hour1 = 0;
          hour2 = 0;
        }
      }

(Sorry Admins if this is too long)

(Think of pinmode as Redstone IO)

You can see its similar to OpenComputers, but instead of

 if (hour2 = 2){
   if (hour1 = 1){
     hour1 = 0;
     hour2 = 0;
   }
 }

You would have

 if hour2 == 2
   if hour1 == 1
     hour1 = 0
     hour2 = 0
   end
 end

Also the main reason why I wanted to do this to program a Microcontroller is to have a big reactor control program.

(Again sorry admins if this is too long. Delete it or let me know to shorten this.)

Link to post
Share on other sites
  • 0

If you like to use the program edit, you can install my device file system:

devfs (extract it with "tar -xf devfs.tar" within the root directory)

It isn't finished yet - please report any bugs - but you can access the bios via /dev/eeprom/bios.

(It also includes a lot of other drivers.)

Link to post
Share on other sites
  • 0

The Computronics EEPROM reader is actually for Nedo Computers EEPROMs.

To read an EEPROM in a microcontroller you can just temporarily swap it out with another. (iirc that can be done, but I'm not sure).

Also, you're mixing up microcontrollers and development cards. Arduino are development cards with a specific language that is then compiled to AVR executables. The microcontroller which powers the Arduino is an ATMega, and if it were to be stripped from the card, it'd require some kind of adapter and some wiring to program. In-game microcontrollers are meant to be sort-of that way.

 

As for programming an EEPROM, you don't have access to most of the libraries, which are provided by OpenOS. For example, you won't have the event library, and you also don't have the require() function, although it's part of standard Lua, it calls for a filesystem. The accessible libraries are actually loaded in global space. I think that's all there is to say about it ?

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.