How does the C code relates to hex output in terms of pins assignment for ATmega16

atmegaembeddedhexmicrocontroller

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.

PB3
:1000E000A398A5980895C398C19A0E945B00C79AE7
:1000F000C39A81E090E00895C398C1980E945B0084
:10010000C79AC39A81E090E0089582EE0E947C0035

PB2
:1000E000A398A5980895C298C19A0E945B00C79AE8
:1000F000C29A81E090E00895C298C1980E945B0086
:10010000C79AC29A81E090E0089582EE0E947C0036

PB1
:1000E000A398A5980895C198C19A0E945B00C79AE9
:1000F000C19A81E090E00895C198C1980E945B0088
:10010000C79AC19A81E090E0089582EE0E947C0037

PC2
:1000E000A398A5980895AA98C19A0E945B00C79A00
:1000F000AA9A81E090E00895AA98C1980E945B00B6
:10010000C79AAA9A81E090E0089582EE0E947C004E

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

Best Answer

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.