Skip to content

Instantly share code, notes, and snippets.

View pilinux's full-sized avatar

mahir pilinux

View GitHub Profile
@pilinux
pilinux / 0_reuse_code.js
Created October 18, 2015 23:43
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
#include <stdio.h>
void main(int argc, char[] argv) {
printf("hello, world!\n");
}
@pilinux
pilinux / or.c
Created February 12, 2016 10:21
Set bit with OR operation
// ------- Preamble ------- //
#include <avr/io.h>
#include <util/delay.h> /* Time delay function */
#define DELAYTIME 250 /* milliseconds */
#define LED_PORT PORTB
#define LED_DDR DDRB
int main(void) {
@pilinux
pilinux / xor.c
Created February 12, 2016 10:23
Twiddling bit with XOR operation
// ------- Preamble ------- //
#include <avr/io.h>
#include <util/delay.h> /* Time delay function */
#define DELAYTIME 250 /* milliseconds */
#define LED_PORT PORTB
#define LED_DDR DDRB
int main(void) {
@pilinux
pilinux / Usage: avrdude
Created February 13, 2016 06:36
Usage: avrdude [options]
Usage: avrdude [options]
Options:
-p <partno> Required. Specify AVR device.
-b <baudrate> Override RS-232 baud rate.
-B <bitclock> Specify JTAG/STK500v2 bit clock period (us).
-C <config-file> Specify location of configuration file.
-c <programmer> Specify programmer type.
-D Disable auto erase for flash memory
-i <delay> ISP Clock Delay [in microseconds]
-P <port> Specify connection port.
@pilinux
pilinux / lab1.c
Created February 13, 2016 10:55
AVR C Lab 1
/*
* lab1.c
*
* Created: 12/23/2015 6:18:56 PM
* Author : mahir
*/
#include <avr/io.h>
@pilinux
pilinux / Usage: avrdude
Created February 13, 2016 19:38
Usage: avrdude output on Ubuntu OS
mahir@ubuntu:~$ avrdude
Usage: avrdude [options]
Options:
-p <partno> Required. Specify AVR device.
-b <baudrate> Override RS-232 baud rate.
-B <bitclock> Specify JTAG/STK500v2 bit clock period (us).
-C <config-file> Specify location of configuration file.
-c <programmer> Specify programmer type.
-D Disable auto erase for flash memory
-i <delay> ISP Clock Delay [in microseconds]
@pilinux
pilinux / Makefile
Created February 13, 2016 21:41
Common Makefile for all avr C projects
##########------------------------------------------------------##########
########## Project-specific Details ##########
########## Check these every time you start a new project ##########
########## or when you change your MCU or USB PORT ##########
##########------------------------------------------------------##########
MCU = atmega8 ## Name of your microcontroller device.
F_CPU = 8000000UL ## Frequency
BAUD = 19200 ## BAUD rate
PORT = /dev/ttyUSB0 ## USB PORT of your computer
@pilinux
pilinux / blinkLED.c
Created February 18, 2016 10:27
Lab 2 (AVR C)
// Preamble
#include <avr/io.h>
#include <util/delay.h> /* Time delay function */
// Function definitions
#define LED_DDR DDRB
#define LED_PORT PORTB
//main function
int main(void)
@pilinux
pilinux / structureAvrC
Created February 18, 2016 14:10
Structure of AVR C (blinkLED.c explanation)
[comment]
anything written on the right side of `//` notation, i.e on
lines 1, 5, 9, 12, 13, 15, 17, 18, 20, 21 and 23.
[includes]
lines 2-3, here include other important files for your present projects.
[function definitions]
lines 6-7, define global variables and other functions
or include library of a function.