Added missing classes from final year at OSU

This commit is contained in:
2019-06-17 14:04:15 -07:00
parent 8fa1ffb1b0
commit c717a0316f
166 changed files with 653934 additions and 308 deletions

View File

@@ -0,0 +1,36 @@
/*
This code will cause a TekBot connected to a mega128 board to 'dance' in a cool
pattern. No pins are used as input, and four Port B pins are used for output.
PORT MAP
Port B, Pin 4 -> Output -> Right Motor Enable
Port B, Pin 5 -> Output -> Right Motor Direction
Port B, Pin 7 -> Output -> Left Motor Enable
Port B, Pin 6 -> Output -> Left Motor Direction
*/
#define F_CPU 16000000
#include <avr/io.h>
#include <util/delay.h>
#include <stdio.h>
int main(void)
{
DDRB = 0b11110000; // configure Port B pins for input/output
PORTB = 0b11110000; // set initial value for Port B outputs
// (initially, disable both motors)
while (1) { // loop forever
PORTB = 0b01100000; // make TekBot move forward
_delay_ms(500); // wait for 500 ms
PORTB = 0b00000000; // move backward
_delay_ms(500); // wait for 500 ms
PORTB = 0b00100000; // turn left
_delay_ms(1000); // wait for 1 s
PORTB = 0b01000000; // turn right
_delay_ms(2000); // wait for 2 s
PORTB = 0b00100000; // turn left
_delay_ms(1000); // wait for 1 s
}
}

View File

@@ -0,0 +1,19 @@
:100000000C9446000C9450000C9450000C9450003A
:100010000C9450000C9450000C9450000C94500020
:100020000C9450000C9450000C9450000C94500010
:100030000C9450000C9450000C9450000C94500000
:100040000C9450000C9450000C9450000C945000F0
:100050000C9450000C9450000C9450000C945000E0
:100060000C9450000C9450000C9450000C945000D0
:100070000C9450000C9450000C9450000C945000C0
:100080000C9450000C9450000C94500011241FBE8E
:10009000CFEFD0E1DEBFCDBF0E9452000C948B00A9
:1000A0000C94000080EF87BB88BB20E680E290E4E0
:1000B00028BB3FEF49E658E1315040405040E1F75E
:1000C00000C0000018BA3FEF49E658E13150404007
:1000D0005040E1F700C0000088BB3FEF43ED50E324
:1000E000315040405040E1F700C0000098BB3FEF66
:1000F00047EA51E6315040405040E1F700C000006F
:1001000088BB3FEF43ED50E3315040405040E1F7B2
:0A01100000C00000CDCFF894FFCF2F
:00000001FF

View File

@@ -0,0 +1,16 @@
MCU=atmega128
CC=avr-gcc
OBJCOPY=avr-objcopy
CFLAGS=-std=c99 -Wall -g -Os -mmcu=${MCU} -DF_CPU=${F_CPU} -I.
TARGET=main
SRCS=DanceBot.c
all:
${CC} ${CFLAGS} -o ${TARGET}.bin ${SRCS}
${OBJCOPY} -j .text -j .data -O ihex ${TARGET}.bin ${TARGET}.hex
flash:
avrdude -p ${MCU} -c usbasp -U flash:w:${TARGET}.hex:i -F -P usb
clean:
rm -f *.bin *.hex