NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Microcontroller Programming » original program

September 12, 2014
by Oldskoolgamer
Oldskoolgamer's Avatar

I was practicing using the compiler and loading programs on to the chip, I loaded the program Initialload and it worked. I went into programers notepad and altered the text for the led to the original tex, I expected the second line "your Nerdkits hardware is OK!" to scroll like it originally did, but it is static, how is this done? can you post a sample of the original code that came on t eh micro- controller? thank you John

September 13, 2014
by scootergarrett
scootergarrett's Avatar

here is the 'initialload' "its alive" program

// initialload.c
// for NerdKits with ATmega168
// mrobbins@mit.edu

#define F_CPU 14745600

#include <stdio.h>

#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
#include <inttypes.h>

#include "../libnerdkits/delay.h"
#include "../libnerdkits/lcd.h"
#include "../libnerdkits/io_328p.h"

// PIN DEFINITIONS:
//
// PC4 -- LED anode

int main() {
  // LED as output
  DDRC |= (1<<PC4);

  // turn on LED
  PORTC |= (1<<PC4);

  // fire up the LCD
  lcd_init();
  lcd_home();

  // print message to screen
  //             20 columns wide:
  //                     01234567890123456789
  lcd_line_one();
  lcd_write_string(PSTR("  Congratulations!  "));
  lcd_line_two();
  lcd_write_string(PSTR("********************"));
  lcd_line_three();
  lcd_write_string(PSTR("  Your USB NerdKit  "));
  lcd_line_four();
  lcd_write_string(PSTR("      is alive!     "));

  // turn off that LED
  PORTC &= ~(1<<PC4);

  // busy loop
  while(1) {
    // do nothing
  }

  return 0;
}

you need to make sure that the libraries are pointing in the correct folder.

September 14, 2014
by sask55
sask55's Avatar

This may be what you are looking for. original message code

Post a Reply

Please log in to post a reply.

Did you know that an electroluminescent backlight for an LCD panel requires hundreds of volts AC to run? Learn more...