OpenM1`28 AVR development board flashing LED examples

In this example we simply flashed the LEDs on a Waveshare OpenM128 AVR development board – I am trying to test out and use a variety of AVR related boards that I have, this is a very nice compact development board with LEDs, buttons, joystick and also a wide variety of connectors for LCDs, I2C, UART, PWM and various ports.

The board comes with a wide range of code that can be downloaded and there also a wide range of useful adaptor boards that can be plugged in to the board

This is a picture of the board, the LEDs are all connected to PortA on this board

Parts List

Name Link
OPenM128 AVR board ATmega128 AVR Development Evaluation Board Kit = OpenM128 Standard
USBASP programmer 1LOT New USBASP USBISP AVR Programmer USB ISP USB ASP ATMEGA8 ATMEGA128 Support Win7 64
MikroC for AVR

MIKROC Code

Just simple examples using MIkroC to flash the LEDs on the board

void main() 
{
  DDRA = 0xFF;     // set direction to be output
  PORTA = 0x00;    // turn OFF the PORTA leds
 
 
  while (1) 
  {
   PORTA = 0x00;
   Delay_ms(1000);
   PORTA = 0xff;
   Delay_ms(1000);
  }
}

And here is another one

char counter;
 
void wait() 
{
  Delay_ms(100);
}
 
void main() 
{
  DDRA = 0xFF;     // set direction to be output
  PORTA = 0x00;    // turn OFF the PORTA leds
 
 
  while (1) {
    for (counter=0; counter<8; counter++)
    {
      PORTA |= 1 << counter;
      wait();
    }
 
    counter = 0;
    while (counter<8) 
    {
      PORTA &= ~(1 << counter);
      wait();
      counter++;
    }
  }
}

 

Atmel Studio Code

#include <avr/io.h>
#include <util/delay.h>
 
void delay_ms_test(unsigned char  ms)
{
unsigned char i;
i++;
     if (i%2==1)
	  PORTA=0x00;
}
 
void delay_ms(unsigned int  ms)
{
 
     for(volatile unsigned  int i=0;i<ms;i++);
 
 
}
 
int main(void)
{
	DDRA=0xFF;	
	PORTA=0x00;
	while(1)
	{
	//	delay_ms(1000);	
 
       PORTA=0x00;
       delay_ms(50000);
	   PORTA=0xff;
	   delay_ms(50000);
	}
}

 

Programming

I used AVRpal.net and connected a USBASP programmer, I had to use Zadig to install the necessary driver on Windows 10. I have managed to get this combination working but after a reboot the programmer stopped working so I will write a guide for Windows 10 later. I have several programmers such as a USB Tiny ISP, USB ASP and a USB AVRISP MK11.

The combination of getting these programmers working is a pain on Windows 10 so far

 

Links

 

Be Sociable, Share!

Add a Comment