blinky for DB101 (AVR1281V)

Go To Last Post
10 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

I'm just starting out playing around with AVR and need some help with the basics. I have a DB101 and would like to be able to do some simple input/output on it. I've been looking around but couldn't find any guides specific to the DB101. I did find a gcc port of the stuff already on there (http://www.siwawi.arubi.uni-kl.d...) and loaded that on to it.

Is there a tutorial on how to make a blinky application for the DB101?

Thanks,

Waspinator

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Exactly what do you want to blink? The DB101 doesn't have an LED. If you want that, you will have to connect an LED to one of the unused outputs. Once that it done, then any blinky program for any AVR will work, you just have to adjust it to use the output that you have the LED connected to.

If you want to blink something on the LCD, then you'll have to look at what functions in the example code are available to send stuff to the LCD.

Regards,
Steve A.

The Board helps those that help themselves.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry about not being more clear. An external LED is what I want to blink, connected to some unused ports.

I just don't know how to access the ports in software, and would need some help figuring out where they are physically.

I found this. could I just use this without modification? Where is port 6? Is avr/io.h part of the standard library or do I have to write that myself?

(http://www.ladyada.net/learn/pro...)

00001 // this is the header file that tells the compiler what pins and ports, etc.
00002 // are available on this chip.
00003 #include 
00004 
00005 // define what pins the LEDs are connected to.
00006 // in reality, PD6 is really just '6'
00007 #define LED PD6
00008 
00009 // Some macros that make the code more readable
00010 #define output_low(port,pin) port &= ~(1<<pin)
00011 #define output_high(port,pin) port |= (1<<pin)
00012 #define set_input(portdir,pin) portdir &= ~(1<<pin)
00013 #define set_output(portdir,pin) portdir |= (1<<pin)
00014 
00015 // this is just a program that 'kills time' in a calibrated method
00016 void delay_ms(uint8_t ms) {
00017   uint16_t delay_count = F_CPU / 17500;
00018   volatile uint16_t i;
00019 
00020   while (ms != 0) {
00021     for (i=0; i != delay_count; i++);
00022     ms--;
00023   }
00024 }
00025 
00026 int main(void) {
00027   // initialize the direction of PORTD #6 to be an output
00028   set_output(DDRD, LED);  
00029 
00030   while (1) {
00031     // turn on the LED for 200ms
00032     output_high(PORTD, LED);
00033     delay_ms(200);
00034     // now turn off the LED for another 200ms
00035     output_low(PORTD, LED);
00036     delay_ms(200);
00037     // now start over
00038   }
00039 }
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That should work. According to the hardware documentation PortD bit 6 is free on one of the connectors at the bottom. I'm not sure which one, but it say J107. But in looking at the docs I remembered that the DB101 does indeed have LEDs since it has a backlight for the LCD. You could use that, but I don't know offhand what port it is attached to. My DB101 doesn't have a backlight (it was a pre-production model).

Quote:

Is avr/io.h part of the standard library

Yes, it comes with avr-gcc. It is the main file that contains (indirectly) all the definitions (for registers, ISR addresses, etc) for all AVRs (you need to specify the AVR you are using in the makefile or in the project setting if you are using AVR Studio).

Regards,
Steve A.

The Board helps those that help themselves.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I can't seem to figure out which connection it is.

I have tried to look at the hardware manual but can't find J103-J108.

Here is what I looked at and failed.
http://img200.yfrog.com/img200/7...

I'm going to try to run the program and just stick in an LED into every port and see which one lights up. I hope that this won't break anything though.

Thanks for your help and please let me know if you have any more ideas.

Waspinator

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Looking at the front, D5,D6 and D7 are to the left (just above the U|SART pins), and B5, B6, C2 and F3 are to the right (under the joystick). What confused us is that they are clearly marked :D

Regards,
Steve A.

The Board helps those that help themselves.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ah Thanks,

What confused me was hardware manual saying something about PCB connections which weren't the ones that actually appear on the PCB.

Is there some place I can find a tutorial / guide / more sample code using the libraries and drivers provided with the DB101? Are these libraries and drivers used for anything other than the DB101?

Thanks again,

Waspinator

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you search on the atmel site for teh DB101 you should be able to get all the documentation you want. I think even the original application that is on it. ON this forum search for teh DB101 should give a link to the source code changed for the WinAVR environment as the original app is for IAR....

school project?
a lot of DB101 questions in an instance where this evaluation board is already around for quite a while....

regards

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks meslomp.

I actually already have all that documentation
http://www.atmel.com/dyn/Product...
and the gcc version of the included code
http://www.siwawi.arubi.uni-kl.d...
but I was wondering if there was anything else.

Some beginner guides to AVR focusing on what's available on the DB101 or some more sample code for the DB101 making use of the drivers and libraries provided.

Thanks,

Waspinator

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have never found them.

I also have a DB101. But shortly after became a proud owner of an STK500, so the DB101 is put aside infavour of the STK wich gave me a lot more freedom to do whatever I want with my processor.

There are 3 application notes though. I thought one of them gave a breef overview of the software and how to use it.

regards