NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Microcontroller Programming » trouble need help
March 15, 2012 by Mcheques ![]() |
Hello, I dont understand how to set these register bits. On this board at G12 i need that to be set as a output say a led and on G15 i need that to be set as a input. So if g15 is set to on it will turn g12 on and if g15 is off than g12 is off. Can some one show me this simple code and explain it thank you |
---|---|
March 15, 2012 by hevans (NerdKits Staff) ![]() |
Hi Macheues, I'm not really sure what you are asking here. Could you be more specific about what you are trying to do? Are you working on the NerdKits Guide at the moment or some different project? Humberto |
March 15, 2012 by Mcheques ![]() |
im using nerdkits, all i really want to know is how to set the different pins on the right side of the chip. I dont understand how to program them |
March 15, 2012 by Rick_S ![]() |
Look at the code in the LED blink example in the downloaded code.zip file. That example will demonstrate how to turn on and off the pin at g12 on the breadboard. Rick |
March 16, 2012 by Mcheques ![]() |
ok this is what i need. pin 28 as a input pin, and pin 27 as a output. Esentialy i want a signal coming into pin 28, if its on than pin 27 turns on and if pin 28 is off than pin 27 is off. I dont know how to do this, can someone please explain it to me, thanks |
March 16, 2012 by pcbolt ![]() |
Mcheques - Pin 28 is PC5 and Pin 27 is PC4 (the way the microcontroller understands it). To set PC5 as and input pin you would code the Data Direcrtion Register C like this:
To set PC4 as an output pin:
Then you would set up an infinite code loop to keep checking if the input pin is high or low, like this:
|
March 17, 2012 by Mcheques ![]() |
thank you |
Please log in to post a reply.
Did you know that two resistors plus a transistor can be used to make a better voltage supply? Learn more...
|