L A M P I R A N UNIVERSITAS KRISTEN MARANTHA

Size: px
Start display at page:

Download "L A M P I R A N UNIVERSITAS KRISTEN MARANTHA"

Transcription

1 L A M P I R A N

2

3

4

5

6

7

8

9 LAMPIRAN B LISTING PROGRAM MIKROKONTROLER

10 //Simplest universal VGA(20x20)/PAL(38x20) terminal //For sync used Timer0 Timer1 //To avoid flickering while receive UART data,recommend to send UART data after VSYNC #include <avr/io.h> #include <avr/signal.h> #include <avr/sleep.h> #include <avr/pgmspace.h> #include <string.h> #include <inttypes.h> #include <stdint.h> #include <stddef.h> #include <string.h> #include "symbol_tbl.h" #define true 1 #define false 0 #define NOP asm("nop") //Global definitions for VGA render #define vga_field_line_count 525 #define vga_symbols_per_row 20 #define vga_row_count 20 #define vga_symbol_height 24 //standart VGA quantity lines //symbols quantity per horizontal //symbols quantity per vertical //rendered symbol height

11 //Global defenitions for render PAL #define pal_field_line_count 312 //standart PAL/SECAM quantity lines (interlaced 625~312*2) #define pal_symbol_height 12 //rendered symbol height #define pal_symbols_per_row 38 //symbols quantity per horizontal #define pal_row_count 20 //symbols quantity per vertical //Makro for video handle //Video #define video_off DDRB=0x90 #define video_on DDRB=0xB0 //HSYNC //define hsync_off sbi(portd,3) #define hsync_off PORTD =(1<<PD3); //define hsync_on cbi(portd,3) #define hsync_on PORTD &=~(1<<PD3); //VSYNC #define vsync_off PORTD =(1<<PD2); //define hsync_off sbi(portd,2) #define vsync_on PORTD &=~(1<<PD3); //define hsync_on cbi(portd,2) //PAL Jumper #define check_pal_jumper bit_is_clear(pinc,1) //Global variables volatile unsigned char str_array [pal_symbols_per_row*pal_row_count+1]; //Chars array for display buffer volatile unsigned int current_symbol; //Current symbol number at terminal

12 volatile unsigned char video_enable_flg; volatile unsigned char raw_render; volatile unsigned int linecount; volatile unsigned char y_line_render; //flag for enable render //Current row at display buffer for render // current line for render //Current Y-line at symbol for render //Store strings data at Program Space, to avoid RAM leakage const char str1[] PROGMEM = "Simple PAL terminal v1.2 UART-19200bps"; const char str2[] PROGMEM = "Kennery W.S Manurung"; const char str3[] PROGMEM = " "; static void avr_init(void); //All VGA sincronize made here.. SIGNAL(SIG_OVERFLOW0) TCNT0 = 0xC3; //reload counter value //******Syncronization Handler******** //Count number of lines if (++linecount == vga_field_line_count) linecount = 0; //clear pointers for render display buffer raw_render = 0; y_line_render = 0;

13 //Make Vsync length 2 VGA lines if ((linecount == 10 ) (linecount == 11 )) //Make here vertical syncronization & HSYNC syncro level on vsync_on; else //.. & HSYNC syncro level on vsync_off; video_enable_flg = true; if (linecount < 45) video_enable_flg = false; //Add to avoid flickering at top display

14 else //Forming current string for rendering if (++y_line_render == vga_symbol_height) raw_render++; y_line_render = 0; else

15 hsync_off; //HSYNC syncro level off //******Syncronization Handler******** //All PAL sincronize made here.. SIGNAL(SIG_OUTPUT_COMPARE1A) //Count number of lines if (++linecount == pal_field_line_count) linecount = 0; //clear pointers for render display buffer raw_render = 0; y_line_render = 0; //Invert HSYNC for VSYNC if (linecount > 305 && linecount < 309) //Make here vertical syncronization //sbi(portc,1); //inverted syncro level on PORTC =(1<<PC1); char i = 15; while (--i)

16 else //And "black" = 8 mksk; //cbi(portc,1); //inverted syncro level off PORTC&=~(1<<PC1); //Make HSYHC = 4 mksk; //cbi(portc,1); //syncro level on PORTC&=~(1<<PC1); char i = 30; while (--i) //And "black" = 8 mksk; //sbi(portc,1); //syncro level off PORTC =(1<<PC1); video_enable_flg = true; if ((linecount < 40) (linecount > 278)) video_enable_flg = false; //Add to avoid flickering at top display

17 else //Forming current string for rendering if (++y_line_render == pal_symbol_height) raw_render++; y_line_render = 0; else

18 void spi_init (void) //Set SPI PORT DDR bits //sbi(ddrb, 7); //SCK //cbi(ddrb, 6); //MISO //sbi(ddrb, 5); //MOSI //sbi(ddrb, 4); //SS DDRB=0XB0; SPSR = 1 << SPI2X; SPCR = (1 << SPE) (1 << MSTR); //SPI enable as master,freq = fclk/2 //That's a great pity, that we can't work with SPI with FREQ = fclk, //because may be possible build terminal up 40 symbol per row!!! static void uart_init(void) UCSRB = 0x00; //disable while setting baud rate UCSRA = 0x00; UCSRC = 0x86; //8 bits data & 2 stop bits //UART SPEED bps UBRRL = 0x33; //set baud rate lo UBRRH = 0x00; //set baud rate hi //UART SPEED bps //UBRRL = 0x19; //set baud rate lo //UBRRH = 0x00; //set baud rate hi

19 //UART SPEED bps //UBRRL = 0x0C; //set baud rate lo //UBRRH = 0x00; //set baud rate hi //UART SPEED bps //UBRRL = 0x08; //set baud rate lo //UBRRH = 0x00; //set baud rate hi //UART RX Enable UCSRB = (1 << RXEN); static void pal_terminal_handle(void) // Parser received symbols from UART while(ucsra & (1<<RXC)) unsigned char current_line, received_symbol; received_symbol = UDR; //Check for overflow display buffer if(current_symbol == (pal_row_count*pal_symbols_per_row)) //Clear display buffer unsigned char i = pal_row_count; char * ptr; //Set pointers for clear string array ptr = &str_array[0]; while(i--) //Don't use here loop, to fastest clear display buffer

20

21 ; current_symbol = 0x0; switch ( received_symbol ) //BackSpace case 0x08: if(current_symbol) str_array[current_symbol] = 0x0; str_array[--current_symbol] = 0x0; break; //TAB case 0x09: if((current_symbol + 5) < (pal_row_count*pal_symbols_per_row)) //Add 5 Space str_array[current_symbol] = 0x0;

22 current_symbol += 5; break; //RETURN case 0x0D: current_line = current_symbol / pal_symbols_per_row; if((current_line) < 19) str_array[current_symbol] = 0x0; current_symbol = current_line*pal_symbols_per_row + pal_symbols_per_row; break; default: str_array[current_symbol++] = received_symbol; void pal_render(void) unsigned char i; char * _ptr; const char * _ptr1; //Initialize display buffer with StartUp strings strcpy_p(&str_array[pal_symbols_per_row*(pal_row_count-1)],&str1[0]); //Enable global interrupt asm ("sei"); for(;;)

23 //Wait compare interrupt signal from Timer1 sleep_mode(); //Check symbol on UART if (UCSRA & (1<<RXC)) //Parse received symbol pal_terminal_handle(); //Can easealy add here RX polling buffer //to avoid display flickering continue; //To make horizontal shift rendered image i=14; while(i--) //Check visible field if(video_enable_flg) //OK, visible //Main render routine //Set pointer for render line (display bufffer) _ptr = &str_array[raw_render * pal_symbols_per_row]; //Set pointer for render line (character generator) _ptr1 = &symbol[0][y_line_render]; //Cycle for render line i = pal_symbols_per_row;

24 video_on; while(i--) SPDR = pgm_read_byte(_ptr1 + (* _ptr++)*pal_symbol_height); at FOSC=16Mhz)!! //That's a great pity can't shift data faster (8Mhz //Delay for draw last symbol i=6; while(i--) video_off; else //Not visible //Can do something else.. //******Cursor handle****** //Count frame static unsigned int framecount; framecount++; //Here draw cursor if (framecount&0x800)

25 str_array[current_symbol] = ' '; else str_array[current_symbol] = 0x7F; //******Cursor handle****** //You can add here your own handlers.. //for(;;) static void vga_terminal_handle(void) // Parser received symbols from UART while(ucsra & (1<<RXC)) unsigned char current_line, received_symbol; received_symbol = UDR; //Check for overflow display buffer if(current_symbol == (vga_row_count*vga_symbols_per_row))

26 //Clear display buffer unsigned char i = vga_row_count; char * ptr; //Set pointers for clear string array ptr = &str_array[0]; while(i--) //Don't use here loop, to fastest clear display buffer

27 ; current_symbol = 0x0; switch ( received_symbol ) //BackSpace case 0x08: if(current_symbol) str_array[current_symbol] = 0x0; str_array[--current_symbol] = 0x0; break; //TAB case 0x09: if((current_symbol + 5) < (vga_row_count*vga_symbols_per_row)) //Add 5 Space str_array[current_symbol] = 0x0; current_symbol += 5; break; //RETURN case 0x0D: current_line = current_symbol / vga_symbols_per_row; if((current_line) < 19)

28 str_array[current_symbol] = 0x0; current_symbol = current_line*vga_symbols_per_row + vga_symbols_per_row; break; default: str_array[current_symbol++] = received_symbol; void vga_render() unsigned char i; char * _ptr; const char * _ptr1; //Initialize display buffer with StartUp strings strcpy_p(&str_array[vga_symbols_per_row*(vga_row_count-2)],&str2[0]); strcpy_p(&str_array[vga_symbols_per_row*(vga_row_count-1)],&str3[0]); //Enable global interrupt asm ("sei"); for(;;) //Wait compare interrupt signal from Timer1 sleep_mode(); //Check symbol on UART if (UCSRA & (1<<RXC))

29 //Parse received symbol vga_terminal_handle(); continue; //Check visible field if(video_enable_flg) //OK, visible //Main render routine //Set pointer for render line (display bufffer) _ptr = &str_array[raw_render * vga_symbols_per_row]; //Set pointer for render line (character generator) _ptr1 = &symbol[0][y_line_render >> 1]; //Cycle for render line i = vga_symbols_per_row; while(i--) SPDR = pgm_read_byte(_ptr1 + (* _ptr++)*vga_symbol_height/2); video_on; //That's a great pity can't shift data faster (8Mhz at FOSC=16Mhz)!! //Delay for draw last symbol

30 video_off; else //Not visible //Can do something else.. //******Cursor handle****** //Count frame static unsigned int framecount; framecount++; //Here draw cursor if (framecount&0x800) str_array[current_symbol] = ' '; else str_array[current_symbol] = 0x7F; //******Cursor handle****** //You can add here your own handlers..

31 //for(;;) #include <avr/io.h> int main(void) avr_init(); //Check pin VGA/PAL if(check_pal_jumper) pal_render(); else vga_render(); return(0); static void avr_init(void) //Set pin jumper VGA/PAL //sbi(ddrc,0); DDRC&=~(1<<DDC0); //sbi(portc,0); PORTC =(1<<PC0); //Enable SPI spi_init(); //init uart uart_init();

32 //Set power mode set_sleep_mode(sleep_mode_idle); //Check pin mode VGA/PAL if(check_pal_jumper) //init PAL SYNC port //sbi(portc,1); PORTC =(1<<PC1); //sbi(ddrc,1); DDRC =(1<<DDC1); //C.0 is sync:1000 ohm + diode to 75 ohm resistor //MOSI is video:330 ohm + diode to 75 ohm resistor // Initialize Sync for PAL OCR1A = 1024; //One PAL line 64us TCCR1B = (1<<WGM12) (1<<CS10);//full speed; clear-on-match TCCR1A = 0x00; //turn off pwm and oc lines TIMSK = 1<<OCIE1A; //enable interrupt from Timer1 CompareA else //init VGA SYNC ports //HSYNC //sbi(portd,3); PORTD=(1<<PD3); //sbi(ddrd,3); DDRD=(1<<DDD3);

33 //VSYNC //sbi(portd,2); PORTD=(1<<PD2); //sbi(ddrd,2); DDRD=(1<<DDD2); // Initialize Sync for VGA TCCR0 = 0x00; //stop TCNT0 = 0xC3; //set count, One VGA line 31.77us TCCR0 = 1<<CS01; //start timer with prescaler select 1/8 TIMSK = 1<<TOV0; //enable interrupt from Timer0 overflow return;

34 LAMPIRAN C SKEMA RANGKAIAN ALAT

35

36

37 LAMPIRAN D FOTO RANGKAIAN ALAT

38 Rangkaian downloader Rangkaian Mikrokontroler

39 Rangkaian Alat Untuk Menampilkan Karakter Ke Layar TV Hasil Tampilan Setelah Percobaan

40

41

42

43

X X X. VGA - Standard:

X X X. VGA - Standard: VG Pin 01 Pin 02 Pin 03 - Pin Pin 05 Pin 06 Pin 07 Pin 08 - Pin Pin 10 Pin 11 - Pin Pin 13 Pin 14 - Pin (female to V Monitor) P1 RED V P2 GRN V P3 BLU V P5 GND HSy P6 RED_RTN P7 GRN_RTN P8 BLU_RTN P10

More information

TIMSK=0b ; /* enables the T/C0 overflow interrupt in the T/C interrupt mask register for */

TIMSK=0b ; /* enables the T/C0 overflow interrupt in the T/C interrupt mask register for */ The codes below which help in better understanding of timers and counters. I have tested this code for atmega32. I have taken reference from www.avrfreaks.net. Hope you all will find this useful. Darsh

More information

ADC: Analog to Digital Conversion

ADC: Analog to Digital Conversion ECE3411 Fall 2015 Lecture 5b. ADC: Analog to Digital Conversion Marten van Dijk, Syed Kamran Haider Department of Electrical & Computer Engineering University of Connecticut Email: {vandijk, syed.haider}@engr.uconn.edu

More information

School of Electrical, Computer and Telecommunications Engineering University of Wollongong Australia

School of Electrical, Computer and Telecommunications Engineering University of Wollongong Australia ECTE333 s schedule ECTE333 Lecture 9 -Timers School of Electrical, Computer and Telecommunications Engineering University of Wollongong Australia Week Lecture (2h) Tutorial (h) Lab (2h) L7: C programming

More information

Features 2.4 GHz Carrier Frequency RS232 UART interface with variable baud rate Input supply voltage: 5V to 12V 255 possible Channels frequencies (0 to 255) Programmable Device Address (255 per channel)

More information

How to use RFpro in Packet Mode

How to use RFpro in Packet Mode How to use RFpro in Packet Mode Jumper Setting Priority Jumper J1 à Configuration Mode Jumper à Higher Priority Jumper J2 à Packet Mode Jumper à Lower Priority When both the jumpers are connected, by default,

More information

Supplementary Materials: Fabrication of a Lab on Chip Device Using Material Extrusion (3D Printing) and Demonstration via Malaria Ab ELISA

Supplementary Materials: Fabrication of a Lab on Chip Device Using Material Extrusion (3D Printing) and Demonstration via Malaria Ab ELISA S1 of S10 Supplementary Materials: Fabrication of a Lab on Chip Device Using Material Extrusion (3D Printing) and Demonstration via Malaria Ab ELISA Maria Bauer and Lawrence Kulinsky * 1. Program Code

More information

Introduction. Unit 4. Numbers in Other Bases in C/C++ BIT FIDDLING. Microcontrollers (Arduino) Overview Digital I/O

Introduction. Unit 4. Numbers in Other Bases in C/C++ BIT FIDDLING. Microcontrollers (Arduino) Overview Digital I/O 4.1 4.2 Introduction Unit 4 Microcontrollers () Overview Digital I/O The primary way that software controls hardware is by manipulating individual bits We need to learn how to: Set a bit to a 1 Clear a

More information

Unit 13 Timers and Counters

Unit 13 Timers and Counters Unit 13 Timers and Counters 1 2 Review of some key concepts from the first half of the semester A BRIEF SUMMARY 3 A Few Big Ideas 1 Setting and clearing bits in a register tells the hardware what do and

More information

Introduction to Embedded Systems

Introduction to Embedded Systems Introduction to Embedded Systems Edward A. Lee UC Berkeley EECS 149/249A Fall 2016 2008-2016: E. A. Lee, A. L. Sangiovanni-Vincentelli, S. A. Seshia. All rights reserved. Chapter 10: Input and Output,

More information

AVR Timers TIMER0. Based on:

AVR Timers TIMER0. Based on: AVR Timers TIMER0 Based on: http://maxembedded.wordpress.com/2011/06/24/avr-timers-timer0-2/ The basic concepts of AVR Timers. Let me summarize it: We have seen how timers are made up of registers, whose

More information

CSCE374 Robotics Fall 2013 Notes on the irobot Create

CSCE374 Robotics Fall 2013 Notes on the irobot Create CSCE374 Robotics Fall 2013 Notes on the irobot Create This document contains some details on how to use irobot Create robots. 1 Important Documents These notes are intended to help you get started, but

More information

Overview RFSv4.3 is a RF module providing easy and flexible wireless data transmission between devices. It is based on AVR Atmega8 with serial output which can be interfaced directly to PC. Features 2.4

More information

C-CODE EXAMPLE FOR SCP1000-D01 PRESSURE SENSOR

C-CODE EXAMPLE FOR SCP1000-D01 PRESSURE SENSOR C-CODE EXAMPLE FOR SCP1000-D01 PRESSURE SENSOR 1 INTRODUCTION The objective is to set up SPI communication between VTI Technologies' digital pressure sensor component and an MCU of an application device.

More information

Serial Communications

Serial Communications 1 Serial Interfaces 2 Embedded systems often use a serial interface to communicate with other devices. Serial Communications Serial implies that it sends or receives one bit at a time. Serial Interfaces

More information

UART: Universal Asynchronous Receiver & Transmitter

UART: Universal Asynchronous Receiver & Transmitter ECE3411 Fall 2015 Lecture 2a. UART: Universal Asynchronous Receiver & Transmitter Marten van Dijk, Syed Kamran Haider Department of Electrical & Computer Engineering University of Connecticut Email: {vandijk,

More information

Unit 14 Timers and Counters 14.1

Unit 14 Timers and Counters 14.1 Unit 14 Timers and Counters 14.1 14.2 Counter/Timers Overview ATmega328P has two and one counters. Can configure to count at some frequency up to some value (a.k.a. ), generate an and counkng again, if

More information

CSCE 236 Embedded Systems, Fall 2017 Homework 5

CSCE 236 Embedded Systems, Fall 2017 Homework 5 CSCE 236 Embedded Systems, Fall 2017 Homework 5 Started: Tuesday, November 7th, 2017 Due: Friday, November 17th, 2017 (5pm) Instructions: This homework is an individual assignment, collaboration is not

More information

UNIVERSITY OF CONNECTICUT. ECE 3411 Microprocessor Application Lab: Fall Quiz IV

UNIVERSITY OF CONNECTICUT. ECE 3411 Microprocessor Application Lab: Fall Quiz IV Department of Electrical and Computing Engineering UNIVERSITY OF CONNECTICUT ECE 3411 Microprocessor Application Lab: Fall 2015 Quiz IV There is 1 questions in this quiz. There are 15 pages in this quiz

More information

CSCE 236 Embedded Systems, Spring 2012 Quiz/Test 2

CSCE 236 Embedded Systems, Spring 2012 Quiz/Test 2 CSCE 236 Embedded Systems, Spring 2012 Quiz/Test 2 Thursday, April 12, 2012 Instructions: You will have the full class period to complete this test. Make sure to show your work to ensure you receive partial

More information

Distributed Real-Time Control Systems. Chapter 10 Real-Time Digital Control

Distributed Real-Time Control Systems. Chapter 10 Real-Time Digital Control Distributed Real-Time Control Systems Chapter 10 Real-Time Digital Control 1 Real-Time Digital Control Hardware Digital Controllers are usually designed as periodic tasks with fixed period and synchronized

More information

COMP2121: Microprocessors and Interfacing

COMP2121: Microprocessors and Interfacing COMP2121: Microprocessors and Interfacing Lecture 25: Serial Input/Output (II) Overview USART (Universal Synchronous and Asynchronous serial Receiver and Transmitter) in AVR http://www.cse.unsw.edu.au/~cs2121

More information

C:\Users\jacob\Documents\MtSAC\ELEC74 Mt SAC - chipkit\homework Sheets.docx

C:\Users\jacob\Documents\MtSAC\ELEC74 Mt SAC - chipkit\homework Sheets.docx ELEC 74 Worksheet 1 Logic Gate Review 1. Draw the truth table and schematic symbol for: a. An AND gate b. An OR gate c. An XOR gate d. A NOT gate ELEC74 Worksheet 2 (Number Systems) 1. Convert the following

More information

Fundamental concept in computation Interrupt execution of a program to handle an event

Fundamental concept in computation Interrupt execution of a program to handle an event Interrupts Fundamental concept in computation Interrupt execution of a program to handle an event Don t have to rely on program relinquishing control Can code program without worrying about others Issues

More information

12/11/06 10:58:54 P1_AVR_TWI.c

12/11/06 10:58:54 P1_AVR_TWI.c 10:58:54 P1_AVR_TWI.c 1 / Program Title: P1 AVR Boot/Monitor Program Name: P1_AVR_TWI.c Version: 0.87 Author: SS Date: August 10, 2005 Compiled with ImageCraft ICCAVR Standard V6.29 This file contains

More information

// filename pwm.c // ATtiny84 (14 pin DIP)

// filename pwm.c // ATtiny84 (14 pin DIP) // stepper motor driver for spectrometer // with manual speed and direction input // and adjustable scan speed and direction // stepper motor driver set to 32usteps/step (32Hz clk = 1 step/sec) // filename

More information

Embedded Systems and Software. Serial Communication

Embedded Systems and Software. Serial Communication Embedded Systems and Software Serial Communication Slide 1 Using RESET Pin on AVRs Normally RESET, but can be configured via fuse setting to be general-purpose I/O Slide 2 Disabling RESET Pin on AVRs Normally

More information

WEATHER STATION WITH SERIAL COMMUNICATION

WEATHER STATION WITH SERIAL COMMUNICATION WEATHER STATION WITH SERIAL COMMUNICATION Written by: Wenbo Ye, Xiao Qu, Carl-Wilhelm Igelström FACULTY OF ENGINEERING, LTH Digital and Analogue Projects EITF11 Contents Introduction... 2 Requirements...

More information

Distributed Real- Time Control Systems. Lecture 7 Real- Time Control

Distributed Real- Time Control Systems. Lecture 7 Real- Time Control Distributed Real- Time Control Systems Lecture 7 Real- Time Control 1 Real- Time Digital Control Hardware Digital Controllers are usually designed as periodic tasks with fixed period and synchronizeda/d-

More information

Lampiran. Universitas Sumatera Utara

Lampiran. Universitas Sumatera Utara Lampiran LISTING PROGRAM #include #include // Declare your global variables here char buff[16]; unsigned int frekuensi,x; unsigned int detak; // External Interrupt 0 service routine

More information

Topic 11: Timer ISMAIL ARIFFIN FKE UTM SKUDAI JOHOR

Topic 11: Timer ISMAIL ARIFFIN FKE UTM SKUDAI JOHOR Topic 11: Timer ISMAIL ARIFFIN FKE UTM SKUDAI JOHOR Introduction Timer s objective Timer features Timer Registers - Understand function of each bit Initialization Introduction o In micro-p, we use counter

More information

Orangutan X2 Command Documentation v1.01

Orangutan X2 Command Documentation v1.01 Orangutan X2 Command Documentation v1.01 Page 1 of 27 1. Overview.................................................... 3 2. ATmega644 SPI Configuration........................................ 4 3. Low-Level

More information

Embedded Systems and Software

Embedded Systems and Software Embedded Systems and Software Serial Communication Serial Communication, Slide 1 Lab 5 Administrative Students should start working on this LCD issues Caution on using Reset Line on AVR Project Posted

More information

Serial Peripheral Interface (SPI)

Serial Peripheral Interface (SPI) SPI = Simple, 3 wire, full duplex, synchronous serial data transfer Interfaces to many devices, even many non-spi peripherals Can be a master or slave interface 4 interface pins: -MOSI master out slave

More information

MIDI.C December 8, 2002 Page 1

MIDI.C December 8, 2002 Page 1 MIDI.C December 8, 2002 Page 1 /* Midi.c These are the functions that provide the interface to the midi port */ #include #include #include "smb.h" #include "midi.h" #pragma interrupt_handler

More information

8-bit Microcontroller with 4K Bytes of In-System Programmable Flash AT90S4433 AT90LS4433. Features. Not Recommend for New Designs. Use ATmega8.

8-bit Microcontroller with 4K Bytes of In-System Programmable Flash AT90S4433 AT90LS4433. Features. Not Recommend for New Designs. Use ATmega8. Features High-performance and Low-power AVR 8-bit RISC Architecture 118 Powerful Instructions Most Single Cycle Execution 32 x 8 General Purpose Working Registers Up to 8 MIPS Throughput at 8 MHz Data

More information

Marten van Dijk, Syed Kamran Haider

Marten van Dijk, Syed Kamran Haider ECE3411 Fall 2015 Lecture 3b. Timers 0, 1 & 2 Marten van Dijk, Syed Kamran Haider Department of Electrical & Computer Engineering University of Connecticut Email: vandijk, syed.haider@engr.uconn.edu Based

More information

Laboratory 4 Usage of timers

Laboratory 4 Usage of timers Laboratory 4 Usage of timers 1. Timer based interrupts Beside external interrupt, the MCU responds to internal ones which are triggered by external events (on the external pins). The source of the internal

More information

EE 308: Microcontrollers

EE 308: Microcontrollers EE 308: Microcontrollers Timers Aly El-Osery Electrical Engineering Department New Mexico Institute of Mining and Technology Socorro, New Mexico, USA April 2, 2018 Aly El-Osery (NMT) EE 308: Microcontrollers

More information

Physics 120B: Lecture 11. Timers and Scheduled Interrupts

Physics 120B: Lecture 11. Timers and Scheduled Interrupts Physics 120B: Lecture 11 Timers and Scheduled Interrupts Timer Basics The ATMega 328 has three @mers available to it (Arduino Mega has 6) max frequency of each is 16 MHz, on Arduino TIMER0 is an 8- bit

More information

19.1. Unit 19. Serial Communications

19.1. Unit 19. Serial Communications 9. Unit 9 Serial Communications 9.2 Serial Interfaces Embedded systems often use a serial interface to communicate with other devices. Serial implies that it sends or receives one bit at a time. µc Device

More information

Design with Microprocessors

Design with Microprocessors Design with Microprocessors Lecture 6 Interfaces for serial communication Year 3 CS Academic year 2017/2018 1 st Semester Lecturer: Radu Dănescu Serial communication modules on AVR MCUs Serial Peripheral

More information

ATmega128. Serial Communication (RS-232C)

ATmega128. Serial Communication (RS-232C) ATmega128 Serial Communication (RS-232C) RS-232C EIA (Electronics Industries Association) DTE (Data Terminal Equipment) DCE (Data Communication Equipment) RS-232C Signals 핀번호 (Pin No.) 명칭 (Signal Name)

More information

RTC rtc(dst_on); U8GLIB_SH1106_128X64 u8g(u8g_i2c_opt_none U8G_I2C_OPT_DEV_0);

RTC rtc(dst_on); U8GLIB_SH1106_128X64 u8g(u8g_i2c_opt_none U8G_I2C_OPT_DEV_0); #include #include #include #include RTC rtc(dst_on); U8GLIB_SH1106_128X64 u8g(u8g_i2c_opt_none U8G_I2C_OPT_DEV_0); const int WIDTH=128; const int HEIGHT=35; const

More information

Processor and compiler dependent

Processor and compiler dependent Fundamental concept in computation Interrupt execution of a program to handle an event Don t have to rely on program relinquishing control Can code program without worrying about others Issues What can

More information

Embedded Real-Time Systems

Embedded Real-Time Systems Embedded Real-Time Systems Reinhard von Hanxleden Christian-Albrechts-Universität zu Kiel Copyright 2008-11, Slides kindly provided by Edward A. Lee & Sanjit Seshia, UC Berkeley, All rights reserved Lecture

More information

Interrupts & Interrupt Service Routines (ISRs)

Interrupts & Interrupt Service Routines (ISRs) ECE3411 Fall 2017 Lecture 2a. Interrupts & Interrupt Service Routines (ISRs) Marten van Dijk Department of Electrical & Computer Engineering University of Connecticut Email: marten.van_dijk@uconn.edu Copied

More information

// Voltage Reference: AREF pin #define ADC_VREF_TYPE ((0<<REFS1) (0<<REFS0) (0<<ADLAR))

// Voltage Reference: AREF pin #define ADC_VREF_TYPE ((0<<REFS1) (0<<REFS0) (0<<ADLAR)) 44 Lampiran 1 Listing program dari seluruh sistem. /****************************************************** * This program was created by the CodeWizardAVR V3.12 Advanced Automatic Program Generator Copyright

More information

Digital and Analogue Project Report

Digital and Analogue Project Report EITF 040 Digital and Analogue Project Report Group 6 Fida Saidani Qinghua Liu March, 2013 1 Abstract The aim of this project is to build an electronic device that makes use of the law of light reflection,

More information

Demystifying the TLC5940. Matthew T. Pandina

Demystifying the TLC5940. Matthew T. Pandina Demystifying the TLC5940 Matthew T. Pandina artcfox@gmail.com August 1, 2011 ii c 2010 Matthew T. Pandina. Verbatim copying and redistribution of this entire book is permitted provided this notice is preserved.

More information

UNIVERSITY OF CONNECTICUT. ECE 3411 Microprocessor Application Lab: Fall Quiz V

UNIVERSITY OF CONNECTICUT. ECE 3411 Microprocessor Application Lab: Fall Quiz V Department of Electrical and Computing Engineering UNIVERSITY OF CONNECTICUT ECE 3411 Microprocessor Application Lab: Fall 2015 Quiz V There are 3 questions in this quiz. There are 10 pages in this quiz

More information

STUDENT NAME(s):. STUDENT NUMBER(s): B00.

STUDENT NAME(s):. STUDENT NUMBER(s): B00. ECED3204 Lab #5 STUDENT NAME(s):. STUDENT NUMBER(s): B00. Pre Lab Information It is recommended that you read this entire lab ahead of time. Doing so will save you considerable time during the lab, as

More information

Physics 124: Lecture 12. Timer Basics. Timers and Scheduled Interrupts

Physics 124: Lecture 12. Timer Basics. Timers and Scheduled Interrupts Physics 124: Lecture 12 Timers and Scheduled Interrupts Timer Basics The Arduino Uno/Nano (ATMega 328) has three Hmers available to it (Arduino Mega has 6) max frequency of each is 16 MHz, (as assembled)

More information

Building a Smart-Necklace

Building a Smart-Necklace Building a Smart-Necklace by Bruce E. Hall, W8BH 1) INTRODUCTION Nuts & Volts magazine is a great rag for the electronic hobbyist. In the July 2013 issue there is an article Make a Smart Necklace by Craig

More information

spi 1 Fri Oct 13 13:04:

spi 1 Fri Oct 13 13:04: spi 1 Fri Oct 1 1:: 1.1 Introduction SECTION SERIAL PERIPHERAL INTERFACE (SPI) The SPI module allows full-duplex, synchronous, serial communication with peripheral devices.. Features Features of the SPI

More information

LAMPIRAN. 1. Program Alat

LAMPIRAN. 1. Program Alat LAMPIRAN 1. Program Alat This program was produced by the CodeWizardAVR V2.03.4 Standard Automatic Program Generator Copyright 1998-2008 Pavel Haiduc, HP InfoTech s.r.l. http://www.hpinfotech.com Project

More information

Interrupts (II) Lecturer: Sri Parameswaran Notes by: Annie Guo

Interrupts (II) Lecturer: Sri Parameswaran Notes by: Annie Guo Interrupts (II) Lecturer: Sri Parameswaran Notes by: Annie Guo 1 External Interrupts The external interrupts are triggered by the INT7:0 pins. If enabled, the interrupts will trigger even if the INT7:0

More information

Interrupts Arduino, AVR, and deep dark programming secrets. What is an Interrupt?

Interrupts Arduino, AVR, and deep dark programming secrets. What is an Interrupt? Interrupts Arduino, AVR, and deep dark programming secrets What is an Interrupt? A transfer of program control that is not directed by the programmer Like a phone call in the middle of a conversation Stop

More information

Using printf with an AVR

Using printf with an AVR Using printf with an AVR Based on : http://efundies.com/avr/avr_printf.htm Required Functions You should keep all of the functions that you need from the previous guide: usart_init() usart_getchar() usart_purchar()

More information

AVR Helper Library 1.3. Dean Ferreyra

AVR Helper Library 1.3. Dean Ferreyra AVR Helper Library 1.3 Dean Ferreyra dean@octw.com http://www.bourbonstreetsoftware.com/ November 11, 2008 Contents 1 Introduction 2 2 Build and Installation 3 2.1 Build..................................

More information

Order this document by EB285/D Motorola Semiconductor Engineering Bulletin EB285 C Macro Definitions for the MC68HC(7)11E20 By John Bodnar

Order this document by EB285/D Motorola Semiconductor Engineering Bulletin EB285 C Macro Definitions for the MC68HC(7)11E20 By John Bodnar nc. Order this document by /D Motorola Semiconductor C Macro Definitions for the MC68HC(7)11E20 By John Bodnar Austin, Texas Introduction Conventions With more microcontroller users moving to high level

More information

Timers and Interrupts. Mark Neil - Microprocessor Course

Timers and Interrupts. Mark Neil - Microprocessor Course Timers and Interrupts 1 Example Product: Signal Generator A Signal Generator should be programmable. A user can use the the LCD display and the keyboard to change the: Frequency scale Amplitude scale Offset

More information

AVR094: Replacing ATmega8 by ATmega88. 8-bit Microcontrollers. Application Note. Features. Introduction

AVR094: Replacing ATmega8 by ATmega88. 8-bit Microcontrollers. Application Note. Features. Introduction AVR094: Replacing by 8 Features Interrupt Vectors Bit and Register s and locations Oscillators and Start up Delay Brown Out Detection USART Control Register access Internal Voltage Reference Programming

More information

EB287. Motorola Semiconductor Engineering Bulletin. C Macro Definitions for the MC68HC(7)11E9/E8/E1/E0. Freescale Semiconductor, I.

EB287. Motorola Semiconductor Engineering Bulletin. C Macro Definitions for the MC68HC(7)11E9/E8/E1/E0. Freescale Semiconductor, I. Order this document by Motorola Semiconductor C Macro Definitions for the MC68HC(7)11E9/E8/E1/E0 By John Bodnar Austin, Texas Introduction With more microcontroller users moving to high level languages

More information

Lecture 2. Introduction to Microcontrollers

Lecture 2. Introduction to Microcontrollers Lecture 2 Introduction to Microcontrollers 1 Microcontrollers Microcontroller CPU + ++++++++++ Microprocessor CPU (on single chip) 2 What is a Microcontroller Integrated chip that typically contains integrated

More information

8-bit Microcontroller with 2K Bytes of In-System Programmable Flash AT90S2313

8-bit Microcontroller with 2K Bytes of In-System Programmable Flash AT90S2313 Features Utilizes the AVR RISC Architecture AVR High-performance and Low-power RISC Architecture 118 Powerful Instructions Most Single Clock Cycle Execution 32x8GeneralPurposeWorkingRegisters Up to 10

More information

INTERRUPTS in microprocessor systems

INTERRUPTS in microprocessor systems INTERRUPTS in microprocessor systems Microcontroller Power Supply clock fx (Central Proccesor Unit) CPU Reset Hardware Interrupts system IRQ Internal address bus Internal data bus Internal control bus

More information

8-bit Microcontroller with 8K Bytes In-System Programmable Flash AT90S8515

8-bit Microcontroller with 8K Bytes In-System Programmable Flash AT90S8515 Features Utilizes the AVR RISC Architecture AVR High-performance and Low-power RISC Architecture 118 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General-purpose Working Registers Up

More information

Interrupts & Interrupt Service Routines (ISRs)

Interrupts & Interrupt Service Routines (ISRs) ECE3411 Fall 2015 Lecture 2c. Interrupts & Interrupt Service Routines (ISRs) Marten van Dijk, Syed Kamran Haider Department of Electrical & Computer Engineering University of Connecticut Email: vandijk,

More information

8-bit Microcontroller with 4K/8K bytes In-System Programmable Flash AT90S4414 AT90S8515. Features. Pin Configurations

8-bit Microcontroller with 4K/8K bytes In-System Programmable Flash AT90S4414 AT90S8515. Features. Pin Configurations Features Utilizes the AVR RISC Architecture AVR - High-performance and Low-power RISC Architecture 118 Powerful Instructions - Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers

More information

Topic 11: Interrupts ISMAIL ARIFFIN FKE UTM SKUDAI JOHOR

Topic 11: Interrupts ISMAIL ARIFFIN FKE UTM SKUDAI JOHOR Topic 11: Interrupts ISMAIL ARIFFIN FKE UTM SKUDAI JOHOR Objectives To become familiar with interrupts on the AVR Maskable and non-maskable Initialization Triggers To develop interrupt service routines

More information

UNIVERSITY OF CONNECTICUT. ECE 3411 Microprocessor Application Lab: Fall Quiz II

UNIVERSITY OF CONNECTICUT. ECE 3411 Microprocessor Application Lab: Fall Quiz II Department of Electrical and Computing Engineering UNIVERSITY OF CONNECTICUT ECE 3411 Microprocessor Application Lab: Fall 2015 Quiz II There are 5 questions in this quiz. There are 9 pages in this quiz

More information

Marten van Dijk Department of Electrical & Computer Engineering University of Connecticut

Marten van Dijk Department of Electrical & Computer Engineering University of Connecticut ECE3411 Fall 2016 Wrap Up Review Session Marten van Dijk Department of Electrical & Computer Engineering University of Connecticut Email: marten.van_dijk@uconn.edu Slides are copied from Lecture 7b, ECE3411

More information

12.1. Unit 12. Exceptions & Interrupts

12.1. Unit 12. Exceptions & Interrupts 12.1 Unit 12 Exceptions & Interrupts 12.2 Disclaimer 1 This is just an introduction to the topic of interrupts. You are not meant to master these right now but just start to use them We will cover more

More information

C:\Users\Jacob Christ\Documents\MtSAC\ELEC74 Mt SAC - chipkit\homework Sheets.docx

C:\Users\Jacob Christ\Documents\MtSAC\ELEC74 Mt SAC - chipkit\homework Sheets.docx ELEC 74 Worksheet 1 Logic Gate Review 1. Draw the truth table and schematic symbol for: a. An AND gate b. An OR gate c. An XOR gate d. A NOT gate ELEC74 Worksheet 2 (Number Systems) 1. Convert the following

More information

Interrupts and timers

Interrupts and timers Applied mechatronics, Lab project Interrupts and timers Sven Gestegård Robertz Department of Computer Science, Lund University 2018 Outline 1 Interrupts Interrupt types Execution of an interrupt Maskable

More information

The Atmel ATmega168A Microcontroller

The Atmel ATmega168A Microcontroller Ming Hsieh Department of Electrical Engineering EE 459Lx - Embedded Systems Design Laboratory The Atmel ATmega168A Microcontroller by Allan G. Weber 1 Introduction The Atmel ATmega168A is one member of

More information

Jate Sujjavanich EEL 5666C IMDL Final Report Thursday, August 7, Oscar the Grouchy Garbageman

Jate Sujjavanich EEL 5666C IMDL Final Report Thursday, August 7, Oscar the Grouchy Garbageman Jate Sujjavanich EEL 5666C IMDL Final Report Thursday, August 7, 2003 Oscar the Grouchy Garbageman ABSTRACT...3 EXECUTIVE SUMMARY...3 INTRODUCTION...3 INTEGRATED SYSTEM...4 ATmega128...4 MOBILE PLATFORM...5

More information

Getting Started with ESPI Interface Using the Z8 Encore! XP F1680

Getting Started with ESPI Interface Using the Z8 Encore! XP F1680 Application Note Getting Started with ESPI Interface Using the Z8 Encore! XP F1680 AN027301-0308 Abstract This application note demonstrates how to use the Enhanced Serial Peripheral Interface (ESPI) in

More information

Asynchronous & Synchronous Serial Communications Interface. Student's name & ID (1): Partner's name & ID (2): Your Section number & TA's name

Asynchronous & Synchronous Serial Communications Interface. Student's name & ID (1): Partner's name & ID (2): Your Section number & TA's name MPSD Serial Communication Lab Exercise Asynchronous & Synchronous Serial Communications Interface Student's name & ID (1): Partner's name & ID (2): Your Section number & TA's name Notes: You must work

More information

Use a semaphore to avoid the enqueue and dequeue functions from accessing and modifying count variable at the same time.

Use a semaphore to avoid the enqueue and dequeue functions from accessing and modifying count variable at the same time. Goal: In this project you will create an OS-driven multitasking device than can capture data at precise intervals, buffer the data to EEPROM, and send data over a serial interface to a computer, while

More information

Using the USART Serial Communications

Using the USART Serial Communications Using the USART Serial Communications Tutorial (c) Dean Camera, 2007. dean_camera@hotmail.com This tutorial will focus on setting up the serial USART on the AVR platform. Although other hardware AVR interfaces

More information

< W3150A+ / W5100 Application Note for SPI >

< W3150A+ / W5100 Application Note for SPI > < W3150A+ / W5100 Application Note for SPI > Introduction This application note describes how to set up the SPI in W3150A+ or W5100. Both the W3150A+ and W5100 have same architecture. W5100 is operated

More information

Embedded Systems and Software

Embedded Systems and Software Embedded Systems and Software Lecture 11 Interrupts Interrupts Slide 1 Interrupts One way to think of interrupts is that they are hardwaregenerated functions calls Internal Hardware When timer rolls over,

More information

The Atmel ATmega328P Microcontroller

The Atmel ATmega328P Microcontroller Ming Hsieh Department of Electrical Engineering EE 459Lx - Embedded Systems Design Laboratory 1 Introduction The Atmel ATmega328P Microcontroller by Allan G. Weber This document is a short introduction

More information

ATmega128 USART. Overview

ATmega128 USART. Overview USART Dual USART Overview The Universal Synchronous and Asynchronous serial Receiver and Transmitter (USART) is a highly flexible serial communication device. The main features are: Full Duplex Operation

More information

Marten van Dijk, Syed Kamran Haider

Marten van Dijk, Syed Kamran Haider ECE3411 Fall 2015 Wrap Up Review Session Marten van Dijk, Syed Kamran Haider Department of Electrical & Computer Engineering University of Connecticut Email: vandijk, syed.haider@engr.uconn.edu Pulse Width

More information

The modules in this lab room are 4 line by 16 character display modules. The data sheet/users manual for the module is posted on My.Seneca.

The modules in this lab room are 4 line by 16 character display modules. The data sheet/users manual for the module is posted on My.Seneca. LCD Modules A common output display device used with low cost embedded systems is a character LCD display. The displays are available as complete modules with a standard microprocessor parallel interface.

More information

Introduction to Embedded Systems

Introduction to Embedded Systems Introduction to Embedded Systems UsingANSICand the Arduino Development Environment David J. Russell University of NebraskaLincoln SYNTHESIS LECTURES ONDIGITAL CIRCUITSAND SYSTEMS #30 xi Preface Introduction

More information

EB289. Motorola Semiconductor Engineering Bulletin. C Macro Definitions for the MC68HC11F1 By John Bodnar Austin, Texas. Freescale Semiconductor, I

EB289. Motorola Semiconductor Engineering Bulletin. C Macro Definitions for the MC68HC11F1 By John Bodnar Austin, Texas. Freescale Semiconductor, I nc. Order this document by /D Motorola Semiconductor C Macro Definitions for the MC68HC11F1 By John Bodnar Austin, Texas Introduction Conventions With more microcontroller users moving to high level languages

More information

Application Note. Interfacing the CS5521/22/23/24/28 to the 68HC05. Figure 1. 3-Wire and 4-Wire Interfaces

Application Note. Interfacing the CS5521/22/23/24/28 to the 68HC05. Figure 1. 3-Wire and 4-Wire Interfaces Application Note Interfacing the CS5521/22/23/24/28 to the 68HC05 TABLE OF CONTENTS 1. INTRODUCTION... 1 2. ADC DIGITAL INTERFACE... 1 3. SOFTWARE DESCRIPTION... 2 3.1 Initialize... 2 3.2 Write Channel

More information

The MC9S12 Input Capture Function

The MC9S12 Input Capture Function The MC9S12 Input Capture Function The MC9S12 allows you to capture the time an external event occurs on any of the eight Port T PTT pins An external event is either a rising edge or a falling edge To use

More information

LCD03 - I2C/Serial LCD Technical Documentation

LCD03 - I2C/Serial LCD Technical Documentation LCD03 - I2C/Serial LCD Technical Documentation Pagina 1 di 5 Overview The I2C and serial display driver provides easy operation of a standard 20*4 LCD Text display. It requires only a 5v power supply and

More information

Interrupt vectors for the 68HC912B32. The interrupt vectors for the MC9S12DP256 are located in memory from 0xFF80 to 0xFFFF.

Interrupt vectors for the 68HC912B32. The interrupt vectors for the MC9S12DP256 are located in memory from 0xFF80 to 0xFFFF. Interrupts The Real Time Interrupt Interrupt vectors for the 68HC912B32 The interrupt vectors for the MC9S12DP256 are located in memory from 0xFF80 to 0xFFFF. These vectors are programmed into Flash EEPROM

More information

AVR EEPROM Memory Read/Write Cookbook BETA version /23/08

AVR EEPROM Memory Read/Write Cookbook BETA version /23/08 AVR EEPROM Memory Read/Write Cookbook BETA version 0.00 2/23/08 This is the beta version of a tutorial that, once it has been sufficiently reviewed and commented in the forum, will be posted in the tutorials

More information

EE318 Electronic Design Lab, Project Report, EE Dept, IIT Bombay, April GPS Tracker. Group No: B11

EE318 Electronic Design Lab, Project Report, EE Dept, IIT Bombay, April GPS Tracker. Group No: B11 EE318 Electronic Design Lab, Project Report, EE Dept, IIT Bombay, April 2009 GPS Tracker Group No: B11 B.V. Sesha Pavan Srinadh (06007038) Mayank Manjrekar (06007036)

More information

Software debouncing of buttons

Software debouncing of buttons Software debouncing of buttons snigelen February 5, 2015 1 Introduction Connecting a button as an input to a micro-controller is a relatively easy task, but there are some problems. The main problem is

More information

USART Register Description

USART Register Description USART Register Description USART I/O Data Register UDR RXB[7:0] TXB[7:0] Read/Write R/W R/W R/W R/W R/W R/W R/W R/W Initial Value 0 0 0 0 0 0 0 0 UDR (Read) UDR (Write) The USART Transmit Data Buer Register

More information

Interrupt Controlled UART

Interrupt Controlled UART AVR306 Design Note: Using the AVR UART in C Features Setup and Use the AVR UART Code Examples for Polled and Interrupt Controlled UART Compact Code C-Code Included for AT90S8515 Description This application

More information

Interrupts. How can we synchronize with a peripheral? Polling

Interrupts. How can we synchronize with a peripheral? Polling Interrupts How can we synchronize with a peripheral? Polling run a program loop continually checking status of the peripheral wait for it to be ready for us to communicate with it Then handle I/O with

More information