Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[AVR] Is ATmega1280 code compatible with ATmega128?

Status
Not open for further replies.

chirag2239

Member level 3
Joined
Jul 29, 2011
Messages
64
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
2,048
Hello,

I am working on a project based on AVR and GLCD. I have written my code in Arduino Mega 1280. Now my problem is that I have ordered the wrong controller. I know this is the silly question but I want to know that I have ordered ATmega128.

I have checked the datasheet of ATmega1280 and Both have no major differences. SO I want to know that can I use the code written for ATmega1280 for ATmega128?

Or, is there any way to use the code written for Arduino Mega128 to use for ATmega128?

I have loaded the code and I am getting the voltage at the output pins at which the GLCD is connected. But I am not getting output that should be. At first I was getting 5V on data pins of the GLCD but after that I am not getting 5V but 1V is available.

So I want solutions of above mentioned problems.

Please help me to solve this out.

Thanks.
Chirag
 

If you are using the Arduino IDE to compile the program, you will have to create a pins.h file for the ATmega128 and add the ATmega128 to the boards.txt files so that the sketch will be compiled properly.
 

Thanks for respond.

What is pins.h file? Is it available on google or I have to create? Can you create for me? And where this file would be located after creation? I know about board.txt. But have confusion that which board of arduino have atmega128? Because in first line of board.txt, we have to mention the board. What's about it? Kindly reply to these problems.

Thanks.
 

What GLCD are you using ? KS0108/0107 based ? If yes, then I can port the code of ATMEGA 1280 (Arduino) to ATMega 128 using mikroC PRO AVR Compiler.
 

It is actually pins_arduino.h. The arduino software has them in arduino-1,0.5/hardware/arduino/variants/mega etc.
They map the pins of the chip and board, so there is one for each arduino variant such as mega, leonardo etc,
You might be able to find one on the internet. I found some for the ATmega1284P at one time.
 
Hi,

I have a code written in Arduino and the controller for LCD is KS0108. I will post the code here and can you please do it for me?
Thanks.
Chirag
 

Yes, I can port it to mikroC PRO AVR code but I need 1 or 2 days. Draw the Circuit using Proteus and post it here. Proteus contains KS0108 based blue color GLCD model. Use it and make the circuit. I will port the code.
 
Hey Thanks man,

I found and I have done it. I got the information from internet and already designed pins_arduino.h file. I just copied the text in separate text file in my laptop and then done as directed in other website. I do not have tested yet but I think it may work definitely. If any issues will be there related to this board.txt and pins_arduino.h, I will come to you back. ANyway, thanks a lot for helping me. Its too easy.

Thanks again.
Chirag

- - - Updated - - -

Its late here at night and I will post it by tomorrow. But for your better start up, I have attached the Proteus 7.8 file and you can check it for schematic and the ports are same as ATmega128 in this ATmega1280. Anyway, you knows better than me. So I will not explain anything more. Please find the attachment.

Thanks.
Chirag
 

Attachments

  • GLCD Schematic.PNG
    GLCD Schematic.PNG
    91.5 KB · Views: 191

Yes, I can port it to mikroC PRO AVR code but I need 1 or 2 days. Draw the Circuit using Proteus and post it here. Proteus contains KS0108 based blue color GLCD model. Use it and make the circuit. I will port the code.

Please find the .ino file of Arduino and make it for ATmega128. And yes provide the program c file and hex file along with it because I do not know much about MicroC for AVR and I need hex file download to controller directly. So please provide the modified C file and hex file.

Thanks.
Chirag

- - - Updated - - -

Hi,
I have tried to verify the code after your instruction. So I get the following error in LED blink program when I clicked the verify.

In file included from Blink.ino:18:
I:\arduino-1.0.6-windows\arduino-1.0.6\hardware\arduino\cores\arduino/Arduino.h:235:26: error: pins_arduino.h: No such file or directory

This error is available in compilation status bar.
 

Attachments

  • Code.txt
    18.2 KB · Views: 100

And where are the bitmaps or bitmaps array to be used in the code ? The code is big and I need one week to make the new code but if the bitmaps or bitmaps arrays are provided.

- - - Updated - - -

Zip and post your pins_arduino.h file and Blink.ino file. I will see if Arduino cade can be made to compile and work.
 

I don't know if this will help, but here as an example .zip file. This file would be uncompressed go in the sketchbook folder in a folder within the sketchbook folder named hardware. It has a pins_arduino and a boards.txt file for the ATmega128, but the pins_arduino file is not made for your board, so this is an example. With this folder in my sketchbook/hardware folder, arduino-1.0.6 compiled the generic blink sketch without error. However I don't have an ATmega128 board to test it with, so no idea if it will run properly. I hope the file attached properly, but I don't know until this is posted.


View attachment ATmega128-hardware.zip

- - - Updated - - -

Looks like the file attached OK. When it is decompressed, just the folder named "ATmega128" is the one that goes in the hardware folder. It is within the folder "ATmega128-hardware" created when the file is decompressed. Tested the downloaded and unzipped file in windows version of Arduino and it compiled the generic blink sketch O.K. with the board ATmega128 selected in the tools - board menu.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top