So I wrote up a code which interfaces a graphic LCD with ATmega16 and displays some custom characters on it. This is a subject that I'm doing in my university. I would like to share the code with my peers but I don't want to share my code (I want them to learn by themselves). What I thought that I would share them my hex files which they could burn on their micro controller using avrstudio. They would just have to change one pin assignment to get the message displayed on their LCDs (and they would know if their hardware works).

Now I have had a little knowledge of using hex workshop for editing hex files for PSP and I was wondering if I could do so using that method. So I started looking of hex vales for that particular pin.

My LCD Chip select (on my PCB) is PB2 and I want other to only change this assignment. I tried to compile various versions of the code into hex formats in order to find the variations in the code and I found out three lines which got changed.





I was wondering how does AVRStudio assign the pin addresses(or something on those terms) while converting the code. Any help in this matter would be highly appreciated. Also this is my first time using Stackexchange, I hope I'm doing it the right way.

Thanks! Sahil

  • \$\begingroup\$ Whilst it would be technically possible to modify pin assignments (by decompiling and recompiling, or decompiling and modifying bits) it would be very hard. It would be better to package your code as a precompiled library and header file, if the development environment allows. \$\endgroup\$ – David Sep 28 '15 at 9:32

As explained in the datasheet, output is performed by setting the bit position(s) in DDRx and changing the bits in PORTx to the desired value. As given in the datasheet, DDRB is register 0x17, DDRC is 0x14, PORTB is 0x18, and PORTC is 0x15. Using that information along with the AVR instruction set manual and a disassembly of the compiled .elf file will help you find which bytes to change to what values.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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