Step 4Allocating Pins
Now, PORT D has 8 pins which is convenient as it can act as our output port. The LCD requires 7 pins to operate - 4 data pins and 3 control pins. The IR LED only requires one pin, so that makes up our 8.
PORTB is going to be our button port, it has 6 inputs, but we're only going to need 5. These will be the mode and directional buttons.
PORTC is special, it is the ADC port. We only need one pin for the trigger input and it makes sense to put it on PC0 (a common abbreviation for port pins in this case Port C, Pin 0). We then have a couple of pins for status LEDs (one lights up when the ADC value is above some condition, the other lights up when it is below some condition). We are also going to put our ok/shoot button input here, for reasons that will become clear later.
After all this, we've used up the majority of the ports but we still have a few left if you wish to expand the project - perhaps multiple triggers?
| « Previous Step | Download PDFView All Steps | Next Step » |
![]() |
Add Comment
|

























































