Hello friends, I hope you all are doing great. Today, I am going to share the new Arduino Mega 1280 Library for Proteus V4.0. The Arduino Mega 1280 is the very first Arduino Mega, from 2009: the long blue board with the ATmega1280 microcontroller, an FT232RL USB chip, 54 digital pins and 16 analog inputs. With this Arduino Mega 1280 Library for Proteus, you place the board on your sheet, load your sketch's HEX file and press Run. The board then behaves like the real one: the ON LED lights up, the L LED follows pin 13, TX and RX flash with the serial data, and the RESET button really resets the chip.
Version 4.0 is the next version of our Arduino libraries for Proteus; there were earlier versions before it, the last one being V3.0 from 2023. The Mega 1280 is one of the six boards of our Arduino Library for Proteus V4.0 (all six boards in one library), and like the others it has a built-in serial monitor, so there is no Virtual Terminal to wire. In this post, I will focus on what is special about the Mega 1280: the ATmega1280, the FT232RL, the L LED that hangs straight on pin 13 and the big 2x18 header.
NOTICE: This library is very special to our team. The Arduino boards were among our very first Proteus libraries, and in V4.0 they finally come to life: LEDs that work, a RESET button with the bootloader, real supply pins and a serial monitor inside the board. It took our team a lot of hard work, many test runs and many design changes. Your feedback is the fuel that keeps us going, so please tell us what you think in the comments below or in the Arduino Proteus Library board of our forum. And if our free libraries help you, you can buy us a coffee. So, let's get started with the Arduino Mega 1280 Library for Proteus V4.0:
What is the Arduino Mega 1280?
The Arduino Mega came out in 2009 as the big brother of the Arduino boards of that time. It kept the familiar left end, with the USB socket, the power jack and the same headers, and stretched the board to the right for many more pins. Its heart is the ATmega1280, an 8-bit AVR microcontroller from Atmel (now Microchip), running at 16 MHz.
Between the USB socket and the microcontroller sits the FT232RL from FTDI, a USB-to-serial converter. On the PC, it appears as a COM port; on the board, it is wired to the ATmega1280's first serial port, pins 0 (RX) and 1 (TX). Everything you print with Serial goes through this chip, and the FT232RL also drives the board's TX and RX LEDs.
In 2010, the Arduino Mega 2560 took its place: the same pins, but the ATmega2560 with twice the flash memory, and a small ATmega8U2 (later ATmega16U2) microcontroller instead of the FT232RL. The later R3 boards also added an op-amp buffer for the L LED, an IOREF pin and SCL / SDA pins next to AREF. If you have one of the first Megas, or an old project made for it, the Mega 1280 is the board to pick in Proteus.
The Arduino Mega 1280 at a Glance
| Feature | Value |
|---|---|
| Microcontroller | ATmega1280, 8-bit AVR, 16 MHz |
| Flash memory | 128 KB; the bootloader takes 4 KB, so a sketch can use up to 126,976 bytes |
| SRAM / EEPROM | 8 KB / 4 KB |
| Digital pins | 54 (D0 - D53); PWM with analogWrite() on 2 - 13 and 44 - 46 |
| Analog inputs | 16 (A0 - A15), 10-bit ADC: 0 to 1023 for 0 to 5 V |
| Serial ports | 4 UARTs (RX / TX): Serial on 0 / 1 (to the FT232RL), Serial1 on 19 / 18, Serial2 on 17 / 16, Serial3 on 15 / 14 |
| External interrupts | 6: pins 2, 3, 18, 19, 20 and 21 |
| I2C and SPI | SDA 20, SCL 21; MISO 50, MOSI 51, SCK 52, SS 53 |
| USB chip | FT232RL (FTDI) |
| LEDs | ON (power), L (pin 13), TX, RX |
| Size | 4.0 x 2.1 in (101.6 x 53.3 mm) |
| Arduino IDE board | Arduino Mega or Mega 2560, processor ATmega1280 |
Mega 1280 vs Mega 2560: What Is Different?
| Feature | Mega 1280 | Mega 2560 R3 |
|---|---|---|
| Microcontroller | ATmega1280 | ATmega2560 |
| Flash | 128 KB | 256 KB |
| USB chip | FT232RL | ATmega16U2, with its own ICSP header |
| L LED | Straight on pin 13 | Through an op-amp buffer |
| L while D13 floats (an INPUT, or the chip in reset) | Dark | A dim glow |
| Arduino IDE processor | ATmega1280 | ATmega2560 |
| Board macro in a sketch | ARDUINO_AVR_MEGA | ARDUINO_AVR_MEGA2560 |
| V4.0 device | ARDUINO MEGA1280 V4.0 | ARDUINO MEGA2560 V4.0 |
| Pins, headers, size, ON / TX / RX, RESET, built-in monitor | The same | The same |
So the two Megas wire the same in Proteus, but they need different HEX files, and their L LEDs behave differently when pin 13 is not an output. Using the newer board? Then read our Arduino Mega 2560 Library for Proteus V4.0.
What's New in the Arduino Mega 1280 Library for Proteus V4.0
In V3.0, the Mega 1280 ran your sketch, but the board itself was a picture with pins. V4.0 keeps the microcontroller model that V3.0 used, Proteus's own AVR model, so your sketch, the HEX upload, the clock and Proteus's AVR debug windows work exactly as before. Around it, the board now does what the real one does:
- Drawn again as the real board: a detailed top view of the first Mega in its real orientation, colour and size, with the FT232RL, the ATmega1280, the crystal, the regulator, the headers and the silkscreen.
- Working LEDs: ON lights with power, L follows pin 13, and TX / RX flash with the serial traffic on D0 / D1.
- A working RESET button with the bootloader: L flashes 3 times, and the sketch starts again 1 s after you release it.
- Real supply pins: 5V and 3.3V are voltage sources you can power parts from, and the GND pins are tied to ground.
- A built-in serial monitor with Board, Monitor and Plotter tabs.
- 11 new pins, 85 instead of 74: the 74 pins of V3.0 come first, in V3.0's order; the new ones are SCL / SDA / GND on the top header, IOREF, 3.3V, VIN and a second GND on the power header, and the 5V and GND pairs of the 2x18 header.
- A typo fixed: V3.0's property "Clock Frequence" is now "Clock Frequency".
V3.0 and V4.0 can stay installed together, because their file and device names differ. The pin positions changed, though, so a V3.0 design does not swap pin for pin: place the V4.0 board and wire it again.
Features of Arduino Mega 1280 Library for Proteus
- One device,
ARDUINO MEGA1280 V4.0, inArduinoV4TEP.LIB, the library with all six V4.0 boards, and one model,TEPARDUINO.DLL. - Proteus's own ATmega1280 model runs your sketch, as in V3.0.
- The first Mega, drawn as the real one: the FT232RL instead of the 16U2, one ICSP header, "MEGA" in its white border and the ATmega1280 in its 100-pin package.
- Four working LEDs that glow in steps and fade out over a few frames.
- L straight on pin 13, like the first Mega: no buffer, so it is dark while pin 13 floats.
- RESET with the bootloader, plus a RESET key on the monitor's Board tab.
- Supply pins: 5V, 3.3V and IOREF are sources, and the Board tab shows their voltages.
- 85 pins, with the 2x18 header drawn as the real one and its 36 pins as one comb on the right edge.
- A built-in serial monitor: our TEP Serial Monitor Advance inside the board, with a Board tab that shows every pin.
- A demo with nothing to wire: the board, its HEX file and the monitor.
- A small package: about 0.91 MB, without the C++ source code.
Download Arduino Mega 1280 Library for Proteus
Click the button below to download Arduino-Mega-1280-Library-for-Proteus-v4.0.zip (about 0.91 MB, without the C++ source code):
Arduino Mega 1280 Library for Proteus V4.0- README.txt: a detailed guide to the files, the installation, the board, the LEDs, the monitor, the properties and real hardware.
- Proteus Library Files:
ArduinoV4TEP.LIB, the library with all six boards. - Proteus Model Files:
TEPARDUINO.DLL, the board model. - Proteus Simulation:
MEGA1280-V4-Board-Demo.pdsprj, its sketchTEP_Board_Demo_MEGA1280.hexand a copy ofTEPARDUINO.DLL, so the demo runs as it is. - Arduino Code:
TEP_Board_Demo.ino, one sketch for all six boards; it needs no extra Arduino library.
The library file is the same in all our V4.0 downloads, so this zip also gives you the UNO, the Mega 2560, the Nano, the Pro Mini and the Mini; only the demo project is the Mega 1280's.
How to Install Arduino Mega 1280 Library for Proteus
- Close Proteus and extract the whole zip file to a normal folder, for example on your Desktop.
- Copy
ArduinoV4TEP.LIBfrom Proteus Library Files into the LIBRARY folder of Proteus, for exampleC:\Program Files (x86)\Labcenter Electronics\Proteus 8 Professional\LIBRARY(on some PCsC:\ProgramData\Labcenter Electronics\Proteus 8 Professional\LIBRARY; use the folder that already holds Proteus's own .LIB files). - Copy
TEPARDUINO.DLLfrom Proteus Model Files into the MODELS folder. - If an
ArduinoV4TEP.IDXis in the LIBRARY folder, delete it. - Start Proteus, press P (Pick Devices) and search for V4.0 or Arduino. The six boards are in the category Arduino > Arduino Boards; pick ARDUINO MEGA1280 V4.0.
Note: Tested in Proteus 8.5; Proteus 7 is not supported. Keep the .hex file and TEPARDUINO.DLL beside the demo project, so that it runs as it is.
The Arduino Mega 1280 in Proteus
Here is the board, ARD1, running the demo, at a closer zoom. We drew it as a clean TEP board in the shape, colour and size of the first Mega: 4.0 x 2.1 inches, blue, with the two corners at the right end cut at an angle.
The Board Drawing
From left to right, you find what the real board has:
- Left end: the USB-B socket and the black DC jack, the RESET button in the top-left corner, the FT232RL USB chip next to the USB socket, the 16 MHz crystal, the voltage regulator and two 47 uF capacitors.
- Middle: the four LEDs (L, TX and RX beside the FT232RL, ON next to the logo), the Arduino logo with "ARDUINO" and "MEGA" in its white border, and our TEP mark.
- Right: the ATmega1280 ("ATMEL ATMEGA1280"), a square 100-pin chip, with its ICSP header, and the 2x18 header at the right end.
- Silkscreen: every pin name, and the header captions DIGITAL (PWM~), COMMUNICATION, POWER and ANALOG IN.
Put it next to the Mega 2560, and the difference is at the left end: the 2560 R3 has an ATmega16U2 with a second ICSP header there, while the first Mega has the FT232RL and no second ICSP. The logo also says just "MEGA", not "MEGA 2560".
Pinout: 85 Pins
The top pins point up, the bottom pins point down, and the 2x18 header's pins leave the right edge:
| Header | Pins | Pins point |
|---|---|---|
| Top, first header (10) | SCL, SDA, AREF, GND, 13, 12, 11, 10, 9, 8 | Up |
| Top, second header (8) | 7, 6, 5, 4, 3, 2, 1 (TX0), 0 (RX0) | Up |
| COMMUNICATION (8) | 14 (TX3), 15 (RX3), 16 (TX2), 17 (RX2), 18 (TX1), 19 (RX1), 20 (SDA), 21 (SCL) | Up |
| POWER (7) | IOREF, RESET, 3.3V, 5V, GND, GND, Vin (the first hole has no pin) | Down |
| ANALOG IN (16) | A0 to A15 | Down |
| 2x18 header (36) | 5V, 5V, 22, 23, 24 ... 52, 53, GND, GND | Right, as one comb |
SCL and SDA on the first header are the same signals as pins 21 and 20, one net each, as on the real R3 layout. Pins 0 and 1 are the hardware serial port that the built-in monitor uses. The other three serial ports, Serial1 (19 / 18), Serial2 (17 / 16) and Serial3 (15 / 14), are free for your modules.
The 2x18 Header: One Comb, 50 Thou Apart
The real 2x18 header at the right end has two columns: the even pins 22, 24 ... 52 on the inner side and the odd pins 23, 25 ... 53 on the outer side, with a pair of 5V pins at the top and a pair of GND pins at the bottom. We drew it as the real one. Its 36 pins leave the board's right edge as one comb, 50 thou (0.05 inch) apart: row by row, the even pin at the row's height and the odd pin 50 thou below it.
So, from top to bottom, the comb reads 5V, 5V, 22, 23, 24, 25 ... 52, 53, GND, GND, in the same order as the numbers printed beside the header. Every pin has its own wire end, so you can wire any of them directly. Zoom in when you wire them, and for many connections, short wires with wire labels (net names) keep the sheet tidy.
While the simulation runs, you will see a grey bar along the comb, as in the image above. That is Proteus's logic-state square, which it draws on every pin; at 50 thou apart, the squares touch. If it bothers you, turn it off in System > Set Animation Options (Show Logic State of Pins).
Component Properties
| Property | Meaning | Default |
|---|---|---|
| Upload Hex File | Your sketch: a HEX, ELF or COFF file | The demo: TEP_Board_Demo_MEGA1280.hex |
| Clock Frequency | The AVR model's clock | 16MHz |
| BOOTLOADER | YES: after RESET, L flashes 3 times and the sketch starts 1 s later, as on a real board; NO: it starts at once | YES |
| MONITOR | YES: the built-in serial monitor on D0 / D1; NO: D0 / D1 are free for your own terminal | YES |
| BAUD | The monitor's baud rate: 300 to 2000000, or AUTO (it measures the sketch's bits) | 9600 |
| AUTOOPEN | YES: the monitor window opens at Run; NO: click the USB socket to open it | YES |
The AVR fuses, the EEPROM file and the trace switches are Proteus's own, hidden as in V3.0.
Working LEDs on the Arduino Mega 1280
The board has the four LEDs of the real Mega, and in V4.0 they all work. Here is the left end of the board while the demo prints:
| LED | Colour | In V4.0 | On the real board |
|---|---|---|---|
| ON | Red | Lit while the board has power | The same |
| L | Green | Pin 13: lit while D13 drives HIGH, a faint glow from INPUT_PULLUP, dark while D13 floats or is LOW | Hangs on pin 13 through a resistor |
| TX | Orange | Flashes while the sketch sends on D1, held 40 ms after the last edge | Driven by the FT232RL, for the USB traffic only |
| RX | Blue | Flashes while D0 receives, held 40 ms after the last edge | Driven by the FT232RL, for the USB traffic only |
L Hangs Straight on Pin 13
This is the biggest difference between the two Megas in V4.0. On the Mega 2560 R3 (and the UNO R3), L hangs on pin 13 through an op-amp buffer, which makes the LED glow dimly while pin 13 floats. The first Mega has no buffer: its L LED hangs straight on pin 13. So on our Mega 1280:
- D13 drives HIGH (
pinMode(13, OUTPUT)anddigitalWrite(13, HIGH)): L is lit. - D13 drives LOW: L is dark.
- D13 is an input with the pull-up (
INPUT_PULLUP): a faint glow, because the weak internal pull-up pushes only a small current through the LED. - D13 is a plain input, or the chip is in reset: the pin floats and L is dark.
The demo sketch makes pin 13 an output in setup(), so L blinks once a second. If L stays dark in your own sketch, check that pin 13 is an output.
TX and RX: Held 40 ms
At 9600 baud, one byte takes about 1 ms (10 bits). A flash that short is hard to see, so the model keeps TX or RX lit for 40 ms after the last edge on the line. While text keeps coming, the LED stays on and shimmers a little. All four LEDs glow in steps and fade out over a few frames, like real LEDs; the steps, the fade and the shimmer are our drawing, not physics.
In the close-up above, the sketch is printing, so TX is lit. L is on too: the red square at pin 13 is Proteus's HIGH state. RX is dark, because nothing is being typed at that moment. On a real Mega 1280, the FT232RL lights TX and RX only for the USB traffic; in Proteus, they flash for any traffic on D0 / D1, also from a module you wire there.
The RESET Button and the Bootloader
The RESET button in the top-left corner is a tactile switch, drawn as one, and you can click it while the simulation runs:
- Hold it down: the cap sinks (darker, without its shine) and the ATmega1280 is held in reset. The sketch stops and every pin floats, so the logic-state squares turn grey.
- Release it: the bootloader runs as on a real board. L flashes 3 times (in steps of 62.5 ms; pin 13 really toggles, so a part on D13 sees it too), and the sketch starts again 1 s after the release.
- BOOTLOADER=NO: the sketch starts at once after the release.
- Run (power-on): the sketch starts at once.
- The Board tab's RESET key: a 20 ms press, then the bootloader.
Look at L in the picture. Pin 13 floats while the chip is in reset, and on the Mega 1280 that means L is dark. A Mega 2560 R3 would show a dim glow here, because of its buffer. It is a quick way to see which Mega you placed.
Supply Pins of the Arduino Mega 1280
The supply pins are real in V4.0: you can power parts from them, and the monitor's Board tab shows their voltages.
| Pin | In V4.0 | On a real Mega 1280 |
|---|---|---|
| 5V (power header and the 2x18 header's 5V pair) | A 5 V source (0.1 ohm) | 5 V from USB or the regulator |
| 3.3V | A 3.3 V source (0.5 ohm), no current limit | Made by the FT232RL's own regulator: about 50 mA at most |
| IOREF | A 5 V source (0.1 ohm) | Added with the R3 boards; the first Mega has none |
| VIN | A load only (1 Mohm); the board runs as if USB-powered | The input to the 5 V regulator |
| GND (5 pins) | Tied to ground | Ground |
Keep the real limit in mind: in Proteus, the 3.3V pin feeds any load, but the first Mega's FT232RL gives only about 50 mA. A 3.3 V module that needs more must have its own regulator.
The Built-in Serial Monitor
On the real board, the FT232RL carries your Serial text to the Serial Monitor of the Arduino IDE. In Proteus, there is no PC on the other side, so V4.0 puts a monitor into the board. This is a TEP addition; no real board has one. It is our TEP Serial Monitor Advance, wired inside the board to the hardware serial port like the real USB chip: it listens to D1 (the sketch's TX) and drives D0 (the sketch's RX) through a weak driver, the way the USB chip sits behind its 1 k resistors. So a module you wire to D0 still wins.
The window opens at Run (property AUTOOPEN), or when you click the board's USB socket. It has three tabs, Board, Monitor and Plotter, and a compact Simple interface. If you would rather use a Virtual Terminal or another monitor on D0 / D1, set MONITOR=NO. The built-in monitor watches Serial only; for Serial1, Serial2 or Serial3, wire a terminal to their pins as usual.
The Simple Interface
At Run, the monitor shows the sketch's start text. The monitor screenshots in this post with only the text and a send line show the Simple interface: the log, the line to send and one slim toolbar row (baud rate, follow, pause, search and clear). The header says "ARD1 · 9600 8N1": the board's part reference on the sheet and the serial format (9600 baud, 8 data bits, no parity, 1 stop bit).
=== TEP Arduino Mega 1280 V4.0 - board demo (9600 baud) ===
Commands:
HELP this list
LED ON pin 13's LED on (stops the blink)
LED OFF pin 13's LED off
BLINK blink it again (1 s)
READ the analog pins (volts)
PLOT ON stream sin / cos / ramp for the Plotter tab
PLOT OFF stop the stream
STATUS LED, plot and uptime
Ready - L blinks; type a command and press Enter.
The banner and the PLOT ON line are wider than the window, so the screenshot cuts them; the full lines are above. The board's name in the banner comes from the sketch: the Arduino IDE defines ARDUINO_AVR_MEGA when you build for the ATmega1280, so the same sketch prints "Arduino Mega 1280" here and "Arduino Mega 2560" on the newer board.
- Switch to the Simple interface: press Ctrl+Shift+U, or use the ... menu.
- Back to the full interface: press Esc, or click the expand arrows at the top right.
- Send a command: type it in the send box and press Enter; Newline is the line ending.
The Board Tab
The full interface opens on the Board tab: the whole board at one glance.
- The header: "Arduino Mega 1280 V4.0", ARD1 and 9600 8N1, the three tabs, the zoom (100 %) and the palette (theme), gear (Settings) and ? (Help) icons. The bar below it shows "ATmega1280 @ 16 MHz · TEP_Board_Demo_MEGA1280.hex".
- ARDUINO MEGA (ATMEGA1280): a RUNNING pill (it says IN RESET or BOOTLOADER at those times), the four LEDs as they glow on the sheet (here ON lit and L between two blinks), the red RESET key, and two options: "Bootloader after RESET (L flashes 3x)" and "Open this window at Run".
- Chip, Sketch, Resets and Speed: ATmega1280 @ 16 MHz, TEP_Board_Demo_MEGA1280.hex, 1 (one RESET press so far in this run) and 62 % of real time.
- DIGITAL PINS: all 54, with the legend HIGH, LOW, pull-up and input. Pin 1 (the sketch's TX, idle HIGH) is bright green; pin 0 shows the darker pull-up green, the monitor's weak driver holding the RX line high; pin 13 is LOW (L is off at this moment); the others are inputs.
- ANALOG PINS: A0 to A15 in two rows, each with its volts and
analogRead()count. Here every tile says "open": nothing is wired to them, so Proteus has no node to read (the sketch reads 0). - SUPPLY PINS: 5V 5.00 V, 3.3V 3.30 V, IOREF 5.00 V and VIN 0.00 V (a load only).
- The status bar: Running, 9600 8N1, RX 3,168 bytes received, TX 13 bytes sent (READ and PLOT ON with their newlines), No errors, 106 lines, and the simulation time, t = 38.494 s.
The Monitor Tab and the READ Command
The Monitor tab is the serial text both ways, with a line to send, the line ending, the baud rate and format, an ASCII or HEX view, time stamps, search and save. Here is the answer to READ, in the Simple interface:
A0: 0 (0.00 V)
A1: 0 (0.00 V)
A2: 0 (0.00 V)
A3: 0 (0.00 V)
A4: 0 (0.00 V)
A5: 0 (0.00 V)
A6: 0 (0.00 V)
A7: 0 (0.00 V)
A8: 0 (0.00 V)
A9: 0 (0.00 V)
A10: 0 (0.00 V)
A11: 0 (0.00 V)
A12: 0 (0.00 V)
A13: 0 (0.00 V)
A14: 0 (0.00 V)
A15: 0 (0.00 V)
The Mega has 16 analog pins, and the sketch reads them all, because NUM_ANALOG_INPUTS is 16 on the Mega. Before these lines, the sketch echoes "You typed: READ". Every line carries a green RX tag: the monitor received it from the board. The pins read 0 because nothing is wired to them; wire a potentiometer or a sensor to A0, and READ shows its count and its voltage.
The Plotter Tab
Type PLOT ON and open the Plotter tab. Every 200 ms, the sketch prints a line such as sin:0.938,cos:0.512,ramp:-0.50, and the Plotter draws every "name:value" pair as a live trace.
The values agree with the code. The 51st sample (number 50) is sin(7.5) = 0.938 and cos(5.25) = 0.512, and the ramp is (50 % 40) / 20 - 1 = -0.5. The ramp climbs from -1 to 0.95 in 40 steps (8 s) and jumps back. The menus at the top choose the window (Last 500 samples) and the scale (Auto scale); pause and clear are on the right. PLOT OFF stops the stream.
Help and Support
The ? icon opens Help & Support:
Read the article, User guide and Check for updates open this post (each board's monitor opens its own post). Report a bug and Suggest a feature open the Arduino board of our forum; then come Support / donate, our website and the community forum. Copy diagnostics copies the details we need for a bug report. A links.ini next to the DLL can change the links.
Run the Arduino Mega 1280 Demo in Proteus
The demo has nothing to wire: the board, its HEX file and the built-in monitor.
- Open
MEGA1280-V4-Board-Demo.pdsprjfrom the Proteus Simulation folder. KeepTEP_Board_Demo_MEGA1280.hexandTEPARDUINO.DLLbeside it. - Press Run. The board powers up (ON lit), the monitor opens with the start text, and L blinks once a second.
- Type a command in the monitor and press Enter. RX flashes while it arrives, TX while the sketch answers.
- Hold the RESET button: the sketch stops. Release it: L flashes 3 times, and the sketch starts again 1 s later.
- Open the Board tab, press its RESET key, and watch the pins and the LEDs.
| Command | What it does |
|---|---|
| HELP | The command list |
| LED ON | Pin 13's LED on; the blink stops ("L (pin 13) is ON") |
| LED OFF | Pin 13's LED off ("L (pin 13) is OFF") |
| BLINK | Blink again, once a second |
| READ | Every analog pin, A0 to A15: the count and the volts |
| PLOT ON | sin / cos / ramp every 200 ms for the Plotter tab |
| PLOT OFF | Stop the stream |
| STATUS | One line: the LED (blinking, ON or OFF), the plot stream and the uptime |
The sketch first answers "You typed: ..." and then the result; an unknown line gets "Unknown command - type HELP". Nothing is printed periodically unless PLOT ON is active, so the text stays easy to read.
The Demo Sketch for the Arduino Mega 1280
One sketch, TEP_Board_Demo.ino, serves all six boards, and it uses only the Arduino core. It takes the board's name from the macro that the Arduino IDE defines for each board:
#if defined(ARDUINO_AVR_MEGA2560)
const char BOARD[] = "Arduino Mega 2560";
#elif defined(ARDUINO_AVR_MEGA)
const char BOARD[] = "Arduino Mega 1280";
The LED pin and the timing:
const int LED_PIN = 13;
const unsigned long BLINK_MS = 500, PLOT_PERIOD_MS = 200, LINE_TIMEOUT_MS = 100;
setup() makes pin 13 an output, starts the serial port at 9600 baud and prints the banner and the command list:
void setup() {
pinMode(LED_PIN, OUTPUT);
Serial.begin(9600);
Serial.println();
Serial.print(F("=== TEP "));
Serial.print(BOARD);
Serial.println(F(" V4.0 - board demo (9600 baud) ==="));
printHelp();
Serial.println(F("Ready - L blinks; type a command and press Enter."));
nextBlinkAt = millis();
}
The loop never calls delay(). It collects the typed characters into a line; Enter ends the line, and with "No line ending", a pause of 100 ms does:
void loop() {
while (Serial.available() > 0) {
char c = Serial.read();
lastCharAt = millis();
if (c == '\r' || c == '\n') handleLine();
else if (lineLength < sizeof(line) - 1) line[lineLength++] = c;
}
if (lineLength > 0 && millis() - lastCharAt >= LINE_TIMEOUT_MS) handleLine(); // "No line ending": a pause ends it
The heartbeat toggles L every 500 ms, so it blinks once a second:
if (blinking && (long)(millis() - nextBlinkAt) >= 0) {
nextBlinkAt += BLINK_MS;
setLed(!ledOn);
}
READ loops over all analog pins; on the Mega 1280, that is 16:
void readAnalog() {
for (byte i = 0; i < NUM_ANALOG_INPUTS; i++) {
int v = analogRead(A0 + i);
Serial.print('A');
Serial.print(i);
Serial.print(F(": "));
Serial.print(v);
Serial.print(F(" ("));
Serial.print(v * 5.0 / 1023.0, 2);
Serial.println(F(" V)"));
}
}
PLOT ON prints three "name:value" pairs every 200 ms, the format the Plotter reads:
if (plotOn && (long)(millis() - nextPlotAt) >= 0) {
nextPlotAt += PLOT_PERIOD_MS;
float a = sample * 0.15;
Serial.print(F("sin:"));
Serial.print(sin(a), 3);
Serial.print(F(",cos:"));
Serial.print(cos(a * 0.7), 3);
Serial.print(F(",ramp:"));
Serial.println((sample % 40) / 20.0 - 1.0, 2);
sample++;
}
And LED ON stops the blink and sets the pin:
} else if (strcmp(cmd, "LED ON") == 0) {
blinking = false; setLed(true);
Serial.println(F("L (pin 13) is ON"));
Your Own Sketch on the Arduino Mega 1280
- In the Arduino IDE, select Tools > Board > Arduino AVR Boards > Arduino Mega or Mega 2560, then Tools > Processor > ATmega1280.
- Use Sketch > Export Compiled Binary. The IDE writes two .hex files next to your sketch; use the one without "with_bootloader".
- Double-click the board in Proteus and set Upload Hex File to that .hex file. Press Run.
Note: Always pick the ATmega1280 processor for this board. The ATmega2560 has twice the flash and a wider program counter, so a HEX built for it does not run correctly on the ATmega1280.
Your sketch can use the whole Mega: the 54 digital pins, the 16 analog inputs, Serial1 to Serial3 on their pins, and attachInterrupt() on pins 2, 3, 18, 19, 20 and 21. Keep Serial (D0 / D1) for the built-in monitor, and set its BAUD property to your Serial.begin() rate, or to AUTO.
Things to Know Before Using a Real Arduino Mega 1280
The demo sketch uses only the Arduino core, so it runs on a real Mega 1280, too. Keep in mind:
- Upload: pick the ATmega1280 processor in the IDE. The first Mega's bootloader takes uploads at 57600 baud, and the IDE uses that speed only with this processor selected; with ATmega2560 selected, the upload fails.
- The USB driver: the FT232RL needs FTDI's driver on the PC. Windows usually installs it by itself, and the board then appears as a COM port.
- Flash: a sketch can use 126,976 bytes, so a big sketch that fits a Mega 2560 may not fit.
- TX / RX LEDs: on the real board, the FT232RL lights them for the USB traffic only; in Proteus, any traffic on D0 / D1 lights them, also from a module.
- The bootloader: after a RESET, a real board waits about a second for an upload before the sketch starts. Our model plays the same bootloader on every board (BOOTLOADER=NO: no wait); a real board's own bootloader decides how L flashes.
- The 3.3V pin: about 50 mA from the FT232RL; in Proteus, a 3.3 V source with no current limit.
- VIN and the jack: on the real board, 7 to 12 V into VIN or the jack feeds the 5 V regulator; in Proteus, VIN is only a load, and the board runs as if USB-powered.
- The headers: our drawing uses the R3 header set of the Mega 2560, with SCL / SDA beside AREF and IOREF on the power header, so a circuit wires the same on both Megas. The original Mega 1280 boards have the older headers without those pins; there, use pins 20 (SDA) and 21 (SCL) for I2C.
- Unwired analog pins: on a real board, they float and read changing values; in Proteus, they read 0.
- Pin current: the pins are 5 V logic; keep each pin at about 20 mA (40 mA is the absolute maximum), and drive motors and relays through a driver.
Troubleshooting
- The board does not simulate, or no LED lights:
TEPARDUINO.DLLis missing from MODELS and from the project folder. - No monitor window: click the board's USB socket, or check MONITOR=YES. Proteus's Debug menu also lists the window.
- The monitor shows nothing: your
Serial.begin()rate and the BAUD property differ. Set BAUD to the sketch's rate, or to AUTO. - A Virtual Terminal on D0 / D1 shows the text twice or fights the monitor: set MONITOR=NO on the board.
- An analog tile says "open": nothing is wired to that pin, so Proteus has no node to read (the sketch reads 0).
- L stays dark in your sketch: make pin 13 an output with
pinMode(). On the Mega 1280, an input leaves L dark (andINPUT_PULLUPgives only a faint glow). - Your sketch waits for a pin-change interrupt and nothing happens: Proteus 8.5's AVR model did not run pin-change interrupts in our tests. Use
attachInterrupt()on pins 2, 3, 18, 19, 20 or 21 (INT0 to INT5), ordigitalRead(). - A grey bar beside the 2x18 header's pins: Proteus's logic-state squares; see the 2x18 header section above.
- The simulation runs slower than real time: about 62 % of real time on our PC, with the monitor open and the plot stream running. Proteus's AVR model sets the pace, as with V3.0.
- A V3.0 design does not take the V4.0 board pin for pin: the pins moved; place the V4.0 board and wire it again.
Still stuck? Post in our forum with a screenshot, the monitor text, the simulation log and the monitor's Copy diagnostics text.
Limitations of the Simulation
- The ATmega1280 is Proteus's own AVR model (
MODELS\AVR2.DLL, Labcenter Electronics), the one V3.0 used; what it simulates is up to that model. In our tests, Proteus 8.5's model did not run pin-change interrupts. - Not modelled: the FT232RL's USB side (the built-in monitor stands in for the PC), serial uploads to the bootloader (you load the HEX as a property), the regulator behind VIN and the jack, and the 3.3V pin's current limit.
- TEP additions, not real-board features: the built-in monitor with its Board tab, and the LEDs' glow steps, fade and shimmer.
- Tested in Proteus 8.5 on 9 October 2026, with the demo project as shipped and the built-in monitor: ON lit, L blinking, TX flashing; READ answered A0 to A15; holding RESET put the chip in reset; the Board tab showed all 54 digital and 16 analog pins; about 62 % of real time with the monitor open and the plot stream running. Our library generator also checks every board: no two parts or texts overlap, every text sits on the board, the LED and RESET regions are clear, and the pin positions and the V3.0 pin order are right; the demo project is read back after it is written. Proteus 7 is not supported.
- The board model, the drawing and the monitor are our own work. The DLL loads Proteus's AVR model and needs no Visual C++ redistributable. The HEX file contains the Arduino AVR core 1.8.6, which includes LGPL-licensed code; its source code is on GitHub. Arduino is a trademark of Arduino SA; the board is our own drawing, not an official Arduino product.
So, that was all about the Arduino Mega 1280 Library for Proteus V4.0. I hope the working LEDs, the RESET button and the built-in serial monitor make the first Arduino Mega feel real in your simulations, so your sketch works the first time you upload it to a real board. If you use the Arduino Mega 1280 Library for Proteus in a project, please share your feedback in the comments or in our forum, and if you have any questions, ask in the comments and I will help you out. Till the next tutorial, take care and have fun!