AVRing

[ No Comments ] Posted on 12.23.09 in Electronics, Microcontrollers

Softrock is behaving well, but propagation has been poor. So naturally I’ve turned my attention elsewhere…. for now!

I’ve always been into microcontrollers and have played with the arduino line of open source prototype platforms quite a bit. The problem is, I always feel like I am not really programing the AVR atmega chips – instead there is another layer of abstraction (the arduino programming language).

I bought a few atmega168 chips a while back and a USBtinyISP programmer kit from LadyAda. I got to building the programmer which was really easy – it took about 30-40 minutes. I also followed the instructions on LadyAda’s site to get the compiler and programmer software (avrdude) working on my Mac laptop – again, very easy, at least for me.

Remarkably I found it tricky to hook up the programmer to the chip – which is surprising since the atmega chips are in circuit programmable. Evilmadscientist has a nice page up though, which explained how to connect the programmer pin outs to the chip pins. The picture below might help anyone else who is confused. LadyAda should really document this on her site!
avr-isp-connections
Now, when I checked the pinout on my cable it seemed to be backwards from the one above. That is, colmns 1 and 2 were flipped. I probably installed the ribbon cable wrong on Ladyada’s programmer. Anyway, I suggest others check before programming a chip. Just check where you have 5V and ground.

#include
int main (void)
{
   DDRB |= 0b00000011; // Set LED as output
   TCCR1B |= (1 << CS10); // Set up timer
   PORTB = 0b00000010; // turn PB1 on, turn PB0 off
   uint8_t i = 0;
   for (;;)    {
      // Check timer value in if statement, true when count matches 1/20 of a second
      if (TCNT1 >= 49999) // 49999 normal -- 20 Hz flash
      {
         if ( i >= 10 )
         {
                PORTB ^= 0b00000011; // Toggle the LEDs: 0 -> 1 or 1 -> 0 through the
                                     // xor statement
                i = 0;
         }
         else
         {
                i++;
         }
         TCNT1 = 0;
      }
   }
}

RedWhite


Geek VodCast

[ No Comments ] Posted on 08.16.09 in Electronics

I just came across this website by David L. Jones (I think he uses the L so he is not confused with the famous Australian Department Store). Anyway – he is a fellow Aussie – from Sydney to boot – and has a video podcast relating to all things electrical engineering.

I’ll be honest – his style is amateurish. The content, though, is largely interesting. He also speaks with a very typical (and to many weird) Australian accent, complete with bizarre inflections at the end of sentences. Yes, we Aussies do that. Its kind of a cross between being emphatic while asking a question at the same time.

Anyway I suggest checking it out – I hope he doesn’t run out of steam and keeps coming up with some interesting topics.