понеделник, 10 ноември 2014 г.

First project with microcontroller - Relay control

Relay controlled by microcontroller

This is my first project with microcontroller. 


Relay is connected on pin PORTB4 (PB4)
and controlled by switch on pin PORTD0 (PD0)

Source code

.include "8515def.inc"

    ser    r16
    out    DDRB,r16

    ldi r16,low(RAMEND)
    out SPL,r16
    ldi r16,high(RAMEND)
    out SPH,r16

    clr r16

    sbic PIND,0
    rjmp LOOP
    ldi     r16,0b00010000
    out PORTB,r16

    sbis PIND,0
    rjmp LOOP1
    rjmp LOOP2

    sbic PIND,0
    rjmp LOOP2
    clr r16
    out PORTB,r16

    sbis PIND,0x00
    rjmp LOOP3
    rjmp LOOP

Formule for LED Resistor

U = 5V
U forward led = 2V
I led = 12.5mA

I=U/R =>
R = U/I =>
R = (U - U forward led) / I led => R = (5-2) / 0.0125 => 240 ohm
R4 LED = 240 Ohm

четвъртък, 6 ноември 2014 г.

First dual programmer and debugger for ATtmel

Two in one: STK500 based programmer with ATmega8, JTAGICE based programmer and debugger with ATmega16.
 Board including peripheral:
- Power supply 5V (LM7805) with led and switch on/off and/or USB power too;
- USB interface with FTDI FT232 or SERIAL COM Port interface with MAX232 for UART/USART communication to programmer/debugger.
- Switch to choice left for STK500v2 programmer or right for JTAGICE programmer/debugger.
- ISP interface from STK500v2 programmers for programming/flashing microcontroller.
- JTAG interface from JTAGICE programmer/debugger for programming/flashing and debugging microcontroller. Debug only microcontrollers: ATmega16, ATmega162, ATmega169, ATmega32, ATmega323, ATmega64, ATmega128, AT90CAN128.
- External added and removable pull-up resistors 100kohm on PORTC for I2C interface.
- External removable crystal resonator with capacitors;
- Socket DIP40 for testing microcontroller ATmel ATmega8535, ATmega16, ATmega32 with full all four ports;
- External RESET push button;

Block scheme of pcb board.

STK500v2 programmer

JTAG ICE programmer/debugger

First test board for MCU

This is my first test board for mcu PIC16F84, PIC16F628, ATmega8515, ATmega162, ATtiny25, ATtiny45, ATtiny85, ATtiny13.
Board including peripheral:
- Power supply 5V (LM7805) with led and switch on/off;
- External removable common crystal resonator with capacitors;
- Socket DIP40 for ATmel ATmega, socket DIP8 for ATmel ATtiny, socket DIP18 for Microchip;
- External ports 5 qty. for ATmel mega series, 1 qty. for ATmel tiny series and 2 qty. for Microchip;
- External common RESET push button;
- Buzzer;
- 8 LEDs with port.
- 8 push buttons with port.