NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Microcontroller Programming » Reassigning Microcontroller pins to the LCD

May 26, 2012
by unnamed0404
unnamed0404's Avatar

Hello,

I am attempting to reassign one of the pins going to the lcd screen. By default, all pins from the microcontroller to the LCD go through PORTD. For the project that I am doing, I require use of the analog comparator, which happens to be pin PD6. Therefore, I was trying to reassign the PD6 output to another pin, in my case PB1. I made the appropriate changes in lcd_init() and lcd_write_nibble, as I've attached below (the code I added is marked w/ asterisks), and then initiated a make in that directory. Then, I uploaded my main program into the microcontroller.

alt image text

alt image text

Unfortunately, this didn't seem to work. When I reconnected that LCD wire to PB1, nothing showed up on my LCD screen. However, when I moved it back to its original position at PD6, it worked fine. This is strange since I commented out the code setting PD6 in lcd.c. It's almost as if the code I changed never made it through to the microcontroller. Now, this is my first time modifying code outside my main program directory, so I suspect may be missing a step. In my main code, I do have lcd.h (which is in another directory) included however, so if something is changed in lcd.c, the code should be recompiled right?

Do I have to go thru a different process of "making" the files?

May 26, 2012
by unnamed0404
unnamed0404's Avatar

I'm reposting my code images since they didn't zoom very well in my first post.

alt image text alt image text

May 26, 2012
by Rick_S
Rick_S's Avatar

Try deleting all .o files in the libnrdkit folder then recompile.

Rick

May 26, 2012
by unnamed0404
unnamed0404's Avatar

Hi Rick,

Thanks for your suggestion. Turns out, I had to not only delete all .o files from the libnerdkits folder, but also all .o and .hex files in my main directory. Then it recompiled everything. Now its working. Thanks!

Chris

May 26, 2012
by Rick_S
Rick_S's Avatar

No Problem glad it worked

Post a Reply

Please log in to post a reply.

Did you know that our USB NerdKit comes with everything you need to get started with microcontrollers? Learn more...