The same MATLAB code at [LINK] is applied with a change of image only. Both input and output are shown below for record.
Tuesday, May 31, 2016
Monday, May 9, 2016
Example 4-1 from Make: AVR Programming (2014)
This post is based on classroom demonstration of Example 4-1 from book Make: AVR Programming by Elliot Williams. The demonstration has three variations in cylonEyes.c listing on pp. 60-61. The Proteus simulation model is shown below. Then comes program codes and a short movie clip.
// Example 4-1. cylonEyes.c modified listing 1
// ------- Preamble -------- //
#include <avr/io.h> /* Defines pins, ports, etc */
#include <util/delay.h> /* Functions to waste time */
#define DELAYTIME 1000 /* milliseconds */
#define LED_PORT PORTB
#define LED_PIN PINB
#define LED_DDR DDRB
int main(void) {
// -------- Inits --------- //
uint8_t i = 0;
LED_DDR = 0xff; /* Data Direction Register B: all set up for output */
// ------ Event loop ------ //
while (1) {
while (i < 7) {
LED_PORT = (1 << i); /* illuminate only i'th pin */
_delay_ms(DELAYTIME); /* wait */
i = i + 1; /* move to the next LED */
}
while (i > 0) {
LED_PORT = (1 << i); /* illuminate only i'th pin */
_delay_ms(DELAYTIME); /* wait */
i = i - 1; /* move to the previous LED */
}
} /* End event loop */
return (0);
}
// Example 4-1. cylonEyes.c modified listing 2
// ------- Preamble -------- //
#include <avr/io.h> /* Defines pins, ports, etc */
#include <util/delay.h> /* Functions to waste time */
#define DELAYTIME 1000 /* milliseconds */
#define LED_PORTB PORTB
#define LED_PINB PINB
#define LED_DDRB DDRB
#define LED_PORTD PORTD
#define LED_PIND PIND
#define LED_DDRD DDRD
int main(void) {
// -------- Inits --------- //
uint8_t i = 0;
uint8_t j = 0;
LED_DDRB = 0xff; /* Data Direction Register B: all set up for output */
LED_DDRD = 0xff;
// ------ Event loop ------ //
while (1) {
while (i < 7) {
LED_PORTB = (1 << i); /* illuminate only i'th pin */
LED_PORTD = (1 << j);
_delay_ms(DELAYTIME); /* wait */
i = i + 1; /* move to the next LED */
j = i;
}
while (i > 0) {
LED_PORTB = (1 << i); /* illuminate only i'th pin */
LED_PORTD = (1 << j);
_delay_ms(DELAYTIME); /* wait */
i = i - 1; /* move to the previous LED */
j = i;
}
} /* End event loop */
return (0);
}
// Example 4-1. cylonEyes.c modified listing 3
// ------- Preamble -------- //
#include <avr/io.h> /* Defines pins, ports, etc */
#include <util/delay.h> /* Functions to waste time */
#define DELAYTIME 1000 /* milliseconds */
#define LED_PORTB PORTB
#define LED_PINB PINB
#define LED_DDRB DDRB
#define LED_PORTD PORTD
#define LED_PIND PIND
#define LED_DDRD DDRD
int main(void) {
// -------- Inits --------- //
uint8_t i = 0;
uint8_t j = 7;
LED_DDRB = 0xff; /* Data Direction Register B: all set up for output */
LED_DDRD = 0xff;
// ------ Event loop ------ //
while (1) {
while ((i < 7)&&(j > 0)) {
LED_PORTB = (1 << i); /* illuminate only i'th pin */
LED_PORTD = (1 << j);
_delay_ms(DELAYTIME); /* wait */
i = i + 1; /* move to the next LED */
j = j - 1;
}
while ((i > 0)&&(j < 7)) {
LED_PORTB = (1 << i); /* illuminate only i'th pin */
LED_PORTD = (1 << j);
_delay_ms(DELAYTIME); /* wait */
i = i - 1; /* move to the previous LED */
j = j + 1;
}
} /* End event loop */
return (0);
}
// Example 4-1. cylonEyes.c modified listing 1
// ------- Preamble -------- //
#include <avr/io.h> /* Defines pins, ports, etc */
#include <util/delay.h> /* Functions to waste time */
#define DELAYTIME 1000 /* milliseconds */
#define LED_PORT PORTB
#define LED_PIN PINB
#define LED_DDR DDRB
int main(void) {
// -------- Inits --------- //
uint8_t i = 0;
LED_DDR = 0xff; /* Data Direction Register B: all set up for output */
// ------ Event loop ------ //
while (1) {
while (i < 7) {
LED_PORT = (1 << i); /* illuminate only i'th pin */
_delay_ms(DELAYTIME); /* wait */
i = i + 1; /* move to the next LED */
}
while (i > 0) {
LED_PORT = (1 << i); /* illuminate only i'th pin */
_delay_ms(DELAYTIME); /* wait */
i = i - 1; /* move to the previous LED */
}
} /* End event loop */
return (0);
}
// Example 4-1. cylonEyes.c modified listing 2
// ------- Preamble -------- //
#include <avr/io.h> /* Defines pins, ports, etc */
#include <util/delay.h> /* Functions to waste time */
#define DELAYTIME 1000 /* milliseconds */
#define LED_PORTB PORTB
#define LED_PINB PINB
#define LED_DDRB DDRB
#define LED_PORTD PORTD
#define LED_PIND PIND
#define LED_DDRD DDRD
int main(void) {
// -------- Inits --------- //
uint8_t i = 0;
uint8_t j = 0;
LED_DDRB = 0xff; /* Data Direction Register B: all set up for output */
LED_DDRD = 0xff;
// ------ Event loop ------ //
while (1) {
while (i < 7) {
LED_PORTB = (1 << i); /* illuminate only i'th pin */
LED_PORTD = (1 << j);
_delay_ms(DELAYTIME); /* wait */
i = i + 1; /* move to the next LED */
j = i;
}
while (i > 0) {
LED_PORTB = (1 << i); /* illuminate only i'th pin */
LED_PORTD = (1 << j);
_delay_ms(DELAYTIME); /* wait */
i = i - 1; /* move to the previous LED */
j = i;
}
} /* End event loop */
return (0);
}
// Example 4-1. cylonEyes.c modified listing 3
// ------- Preamble -------- //
#include <avr/io.h> /* Defines pins, ports, etc */
#include <util/delay.h> /* Functions to waste time */
#define DELAYTIME 1000 /* milliseconds */
#define LED_PORTB PORTB
#define LED_PINB PINB
#define LED_DDRB DDRB
#define LED_PORTD PORTD
#define LED_PIND PIND
#define LED_DDRD DDRD
int main(void) {
// -------- Inits --------- //
uint8_t i = 0;
uint8_t j = 7;
LED_DDRB = 0xff; /* Data Direction Register B: all set up for output */
LED_DDRD = 0xff;
// ------ Event loop ------ //
while (1) {
while ((i < 7)&&(j > 0)) {
LED_PORTB = (1 << i); /* illuminate only i'th pin */
LED_PORTD = (1 << j);
_delay_ms(DELAYTIME); /* wait */
i = i + 1; /* move to the next LED */
j = j - 1;
}
while ((i > 0)&&(j < 7)) {
LED_PORTB = (1 << i); /* illuminate only i'th pin */
LED_PORTD = (1 << j);
_delay_ms(DELAYTIME); /* wait */
i = i - 1; /* move to the previous LED */
j = j + 1;
}
} /* End event loop */
return (0);
}
Monday, April 11, 2016
ICEET 2016 Conference Participation as Author and Session Chair
The ICEET 2016 conference was held at Lahore 7-8 April [PRESENTATION]. Some photos from this event are courtesy of conference organizers.
Best Session Paper Award at SMIC 2016 Dubai 9 January
Unable to get visa for Dubai due delay in passport renewal, however, the presentation was delivered on Skype (thanks to Dr. Aqeel Ur Rehman for his kind assistance). The presentation is available [LINK].
Friday, January 22, 2016
Monday, January 18, 2016
Lecture Slides: GIS and Remote Sensing Applications for Environment
The course, "GIS and Remote Sensing Applications for Environment," was offered in Fall 2015 semester at GSESIT, Hamdard University.
Lecture # 01 Introduction
Lecture # 02 Basic Concepts
Lecture # 03 Aerial Photography
Lecture # 04 Photogrammetry - 1
Lecture # 05 Photogrammetry - 2
Lecture # 06 Sensing Systems
Lecture # 07 Earth Resource Satellites
Lecture # 08 Visual Image Interpretation
Lecture # 09 Essential Digital Image Processing
Lecture # 10 GIS Demysti ed
Lecture # 11 Coordinate Space and Map Projection with an Introduction to Geostatistics
Lecture # 12 Remote Sensing and GIS Integration
Lecture # 13 Future Trends and Challenges
Lecture # 01 Introduction
Lecture # 02 Basic Concepts
Lecture # 03 Aerial Photography
Lecture # 04 Photogrammetry - 1
Lecture # 05 Photogrammetry - 2
Lecture # 06 Sensing Systems
Lecture # 07 Earth Resource Satellites
Lecture # 08 Visual Image Interpretation
Lecture # 09 Essential Digital Image Processing
Lecture # 10 GIS Demysti ed
Lecture # 11 Coordinate Space and Map Projection with an Introduction to Geostatistics
Lecture # 12 Remote Sensing and GIS Integration
Lecture # 13 Future Trends and Challenges
Friday, November 27, 2015
Presentation: An Introduction to LaTeX for Engineers and Scientists
Finally, the initial version of this presentation is ready. This is an introduction level presentation on LaTeX -- the professional document preparation system. In addition to this presentation, I have created a project on overleaf for a practical demonstration. There are many useful online resources, my choices for interested LaTeX learners are Free & Interactive Online Introduction to LaTeX (three parts by Dr. John Lees-Miller) and TeXample.
Subscribe to:
Posts (Atom)