As part of the newest generation of BOBs boards, two buttons, and possibly (if I have enough pins left over) a few DIP switches. As a result, there has to be code to use these buttons and put them to work. This is where my new development board comes in.

As a side note, I’m trying out making this a multi paged post, when you get to then end of this first page, look around the bottom for “Page: 1,2,3”

For those who don’t know, over the summer I not only just about perfected my etching technique, but have also started work with SMD components. As a result of having the ability to do two layer boards and condense size to half the original because of the SMD parts, I decided to make a development board for my Atmegas. From this, and a few hundred hours, I finally came up with a small board that used one of my newer 3.3V very low drop out regulators which I received in my Jameco order. A few features:

  • 3.3V 100mA with a maximum input of 30V
  • Self shut off ability, regulators shut-off pin is bootstrapped when Atmega turns on and runs first few lines of code
  • .01 Header pin input, and screw terminal input for power
  • 2x .01 Header pin output of power
  • All pins broken out
  • I2C header broken out
  • UART header broken out, compatible with FTDI cable or Sparkfun FTDI breakout
  • 16mHz crystal on board
  • Reset button (big improvement over my past boards)
  • Bright red 0603 LED on top for power indication
  • 6 pin ICP header for programming

On this board is where I have been working on libraries for UART, and I2C/TWI. These Libraries can be found on my github, here. In the I2C library I have been working on getting the MCP4725 I2C DAC which I received from Sparkfun to work. I will also be working on getting my I2C programmable oscillator, and I2C Gyroscope to work in the near future. The UART library so far just sends data, either in 8 or 16 bit long packages, and can receive data through the use of an interrupt, so the data can come through at anytime, no worries about timing as a result.

Most recently I’ve been working on getting button feedback working, for this task, I made a simple breakout board with an 8 pole DIP switch, 2 tactile push buttons, 2 100ohm potentiometers, and a spot for my analog Accelerometer, and an I2C bus with spots currently for my three I2C boards, stated above.

A quick test to make sure buttons are working on the board with a simple PINx code:

button_one = (button_one * 9 + (PIND & 0b00001000) * 16)/16;
if (button_one > 5){ //If either are pulled high then turn pin 1 on port B on
} else { //if either are off, turn pin1 port B off

Which simple polls the pin which has the button on it, in this case, PORTD pin 3, and turns an LED on and off depending on whether the button it pushed down or not. And I confirm that the board works as expected (I would be embarrassed with how easy it is, if it did not work)

While this works well, and it’s not my preferred way. I would much rather work with the buttons in interrupts, where I can be sure button presses are caught no matter what the processor is doing at that time.