I found an old PCB of a weighing machine in which there was this IC named MG87FE52AE by Megawin that I want to reprogram and play around with, but when I looked at the data sheet of the IC there was not a single page where they mentioned anything about programming. There was a slight mention of the way the ROM is partitioned but nothing much.

Even on the Keil website this IC is not in the list of supported Megawin IC list.

I just want a heads up before I buy the Megawin 8051 OCD ICE adapter so that it won't be a waste of money


1 Answer 1


From the datasheet it should be possible.

The OEM has undoubtedly locked the memory (you'd only be able to wipe the entire memory) so you'd have to do it from scratch though, so perhaps it could be better to substitute an MCU you are more familiar with or have the dev tools for. Lock disables page erase and program but full erase should still be possible.

I have not used the Keil 8051 compiler in anger for a very long time, but I recall it's not hard to make a configuration file to adapt it to a slightly different MCU, just a few lines to be modified.

Having the original chip around would at least allow you to compare results with your program, in case the OEM has some tricky filtering or other firmware that is not obvious at first blush. Once you wipe the original chip, there is no going back, and it almost certainly cannot be backed up or copied, so my suggestion would be to use a fresh chip, whether the same part number or something different, and set the original aside.

  • \$\begingroup\$ The reason I would like to use the same chip is because I want reuse the same PCB I found the IC from, the PCB has connectors for a 7-segment display a keypad and a load cell. I wouldn't really care if I had to completely wipe the memory as I am no interested in the code already present, so what tools do you recommend for me to program? \$\endgroup\$
    – BluTen
    Commented May 20, 2023 at 2:05
  • \$\begingroup\$ To be frank I have been programming My Uno and esp32 only and this is my first time I am attempting to program a IC, so technically I am not familiar with any IC. I have a few of the same PCB laying around so comparing my results won't be a issue. \$\endgroup\$
    – BluTen
    Commented May 20, 2023 at 2:12
  • \$\begingroup\$ You’ll need whatever is used to download the hex file and an assembler or compiler. Personally I would probably use assembler since I have a lot of 8051 (and some other 8-bitter) code routines that work fast and well. You might find a C compiler more familiar. \$\endgroup\$ Commented May 20, 2023 at 3:28
  • \$\begingroup\$ Thats exactly where I have a problem. I am not sure if I can use Megawin's OCD ICE adapter because the data sheet doesn't specify any SDA and SCL pins on the chip. And buying a universal programmer is my last resort because it costs a lot of money. \$\endgroup\$
    – BluTen
    Commented May 20, 2023 at 8:15
  • \$\begingroup\$ Is there an obvious connector on the PCB? \$\endgroup\$ Commented May 20, 2023 at 15:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.