S w e d i s h c r. w e e b l y. c o m j a l i l a h m e l i v e. c o m Page 1

Size: px
Start display at page:

Download "S w e d i s h c r. w e e b l y. c o m j a l i l a h m e l i v e. c o m Page 1"

Transcription

1 ********************************************************************** This file is a basic code template for assembly code generation * on the PICmicro PIC12C508. This file contains the basic code * building blocks to build upon. * If the internal RC oscillator is not implemented then the first * instruction after the ORG 0x000 directive is not required. * Refer to the MPASM User's Guide for additional information on * features of the assembler (Document DS33014). * Refer to the respective PICmicro data sheet for additional * information on the instruction set. * Template file assembled with MPASM V * ********************************************************************** Filename: door.asm * Date: * File Version: * Author: el@jap.hu * Company: * ********************************************************************** Files required: * ********************************************************************** Notes: * ********************************************************************** #3 veglegesnek szant valtozat, setup moddal digitek: doortime XX delaytime XX hexa, tizedmasodpercben #define F84 #define C508 #ifdef C508 list p=12c508 list directive to define processor #include <p12c508.inc> processor specific variable definitions CONFIG _CP_OFF & _WDT_OFF & _MCLRE_OFF & _IntRC_OSC ' CONFIG' directive is used to embed configuration word within.asm file. The lables following the directive are located in the respective.inc file. See respective data sheet for additional information on configuration word. S w e d i s h c r. w e e b l y. c o m j a l i l a h m e l i v e. c o m Page 1

2 #ifdef F84 list p=16f84 list directive to define processor #include <p16f84.inc> processor specific variable definitions CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _HS_OSC ' CONFIG' directive is used to embed configuration data within.asm file. The lables following the directive are located in the respective.inc file. See respective data sheet for additional information on configuration word. ***** VARIABLE DEFINITIONS #ifdef C508 freemem EQU 0x07 #ifdef F84 freemem EQU 0x100x0c temp EQU freemem+0x00 button EQU freemem+0x01 prevbut EQU freemem+0x02 btcnt EQU freemem+0x03 button counter doorcnt EQU freemem+0x04 relay ON counter delaycnt EQU freemem+0x05 delay before door open counter dlcnt0 EQU freemem+0x06 delay sub counter 0 dlcnt1 EQU freemem+0x07 delay sub counter 1 ringer EQU freemem+0x08 prevring EQU freemem+0x09 ringcnt EQU freemem+0x0a switch EQU freemem+0x0b ledcnt EQU freemem+0x0c iobuf EQU freemem+0x0d IOPORT buffer ledpwm EQU freemem+0x0e ledstate1 EQU freemem+0x0f ledstate2 EQU freemem+0x10 ledtemp1 EQU freemem+0x11 ledtemp2 EQU freemem+0x12 flashdir EQU freemem+0x13 flash direction doortime EQU freemem+0x14 door open time delaytime EQU freemem+0x15 delay time prevsw EQU freemem+0x16 previous state of switch ***** I/O structure my F84 testpanel properties RB0 testled DB25/16 OUT RB1 testled DB25/4 OUT RB2 testled RB3 DB25/15 IN RA2 serial OUT RA4 DB25/13 S w e d i s h c r. w e e b l y. c o m j a l i l a h m e l i v e. c o m Page 2

3 GP0 O RED LED GP1 I BUTTON GP2 O GREEN LED GP3 I SWITCH GP4 I RINGER GP5 O RELAY CTL #ifdef C508 IOPORT EQU GPIO #ifdef F84 IOPORT EQU PORTB #ifdef C508 ********************************************************************** ORG 0x1FF processor reset vector Internal RC calibration value is placed at location 0x1FF by Microchip as a movlw kk, where the kk is a literal value. ORG 0x000 coding begins here movwf OSCCAL update register with factory cal value clrf GPIO movlw 0x1a tris GPIO GP4, GP3, GP1 input movlw 0x80 option wakeup DIS, pullup EN take care of other internal hardware here remaining code goes here #ifdef F84 clrf PORTB clrf PORTA movlw 0x1a tris PORTB movlw 0xff tris PORTA not used movlw 0 pullup EN option LED_GRN EQU 0x31 LED_YEL EQU 0x18 LED_RED EQU 0x00 cold movlw.30 movwf doortime movlw.200 movwf delaytime S w e d i s h c r. w e e b l y. c o m j a l i l a h m e l i v e. c o m Page 3

4 warm reset test green led ON clrf iobuf movlw 4 movwf ledstate1 movlw 1 movwf ledstate2 movlw LED_RED movlw 5 movwf temp test0 call delay decfsz temp goto test0 green+red led ON movlw LED_YEL movlw 5 movwf temp test1 call delay decfsz temp goto test1 clrf IOPORT reset test end YEL init variables clrf clrf clrf clrf btcnt doorcnt delaycnt ringcnt clrf button clrf ringer movlw 5 movwf flashdir main cycle cycle call delay clrf iobuf movf button,w movwf prevbut movf IOPORT,W andlw 2 movwf button store button status movf ringer,w movwf prevring movf IOPORT,W andlw 0x10 movwf ringer store ringer status S w e d i s h c r. w e e b l y. c o m j a l i l a h m e l i v e. c o m Page 4

5 movf IOPORT,W andlw 8 movwf switch auto switch status call call button_sub door_sub btfsc switch,3 no ringercheck if switch is OFF call ringer_sub call led_sub movf iobuf,w movwf IOPORT call setup_sub optional setup for timers goto cycle delay movf iobuf,w iorwf ledstate1,w movwf ledtemp1 movf iobuf,w iorwf ledstate2,w movwf ledtemp2 movlw.250 movwf dlcnt1 delay1 movlw 0x30 movwf dlcnt0 delay2 movf ledpwm,w subwf dlcnt0,w movf ledtemp1,w btfsc STATUS, C movf ledtemp2,w movwf IOPORT decfsz dlcnt0 goto delay2 decfsz dlcnt1 goto delay1 bcf IOPORT, 2 button_sub movf xorwf bz button,w prevbut,w bt_unchanged button status changed btfss button,1 test button status goto bt_release button release button pressed, reset counter S w e d i s h c r. w e e b l y. c o m j a l i l a h m e l i v e. c o m Page 5

6 clrf btcnt bt_unchanged btfsc button,1 test button status incf btcnt measure pressing time bt_release if the button is just released movlw 5 subwf btcnt,w check pressing time clrf btcnt bc bt_long less than half second, immediate ON relay but only if not already in progress movf doorcnt,w bnz bt_skip clrf delaycnt clear delays movf doortime,w movwf doorcnt set relay ON time bsf iobuf, 5 bt_skip bt_long movf delaytime,w set delay time movwf delaycnt door_sub delay movf delaycnt,w bz dr_nodelay delay is counting decfsz delaycnt goto dr_nodelay reached zero movf doortime,w movwf doorcnt bsf iobuf, 5 dr_nodelay door movf doorcnt,w bz dr_nodoor btfss STATUS, Z set relay ON time decf doorcnt dr_nodoor set relay movf doorcnt,w btfss STATUS, Z bz dr_off S w e d i s h c r. w e e b l y. c o m j a l i l a h m e l i v e. c o m Page 6

7 bsf iobuf, 5 relay ON dr_off bcf iobuf, 5 relay OFF ringer_sub check if the status changed movf ringer,w xorwf prevring,w bz rg_unchanged ringer status changed btfss ringer,4 test status goto rg_release release ringer pressed, reset counter clrf ringcnt rg_unchanged btfsc ringer,4 test button status incf ringcnt measure pressing time rg_release if the ringer is just released movlw 4 subwf ringcnt,w check pressing time bnc rg_skip long enough ringing, open door movf doortime,w movwf doorcnt set relay ON time rg_skip led_sub movf delaycnt,w iorwf doorcnt,w idle? bnz led_notidle RED in idle or flashing in auto idle movf switch,w bnz led_flash clrf ledpwm RED led_notidle indicate YEL in delay or GRN in opening mode movf doorcnt,w bnz led_door delay mode movlw LED_YEL YEL S w e d i s h c r. w e e b l y. c o m j a l i l a h m e l i v e. c o m Page 7

8 led_doordoor opening mode movlw LED_GRN GRN led_flash flash in auto idle mode movf flashdir,w addwf ledpwm,w andlw 0xe0 overflow to the upper 3 bits? btfss STATUS, Z comf flashdir,f negate direction movf flashdir,w addwf ledpwm,f setup_sub call setup0 movf switch,w movwf prevsw setup0 optional setup for timers btfss button,1 test button status check if pressed button is pressed movf switch,w xorwf prevsw,w btfsc STATUS, Z check if the switch state changed switch state changed, enter setup mode clrf iobuf immediate OFF door relay clrf ledstate2 clrf ledpwm setup1 call delay btfsc IOPORT, 1 wait for button release goto setup1 incf ledstate2 set RED LED color call readbyte movf temp,w movwf doortime call readbyte movf temp,w movwf delaytime goto warm readbyte S w e d i s h c r. w e e b l y. c o m j a l i l a h m e l i v e. c o m Page 8

9 clrf temp nop BUG!! call read1 first 4 bits, then second half nop BUG!! swapf temp,f read1 clrf btcnt read0 call delay incf btcnt movlw.20 subwf btcnt,w bc read_timeout timeout=2 seconds btfss IOPORT, 1 wait for button press goto read0 button pressed incf temp increase value read2 call delay btfsc IOPORT, 1 wait for button release goto read2 goto read1 read_timeout movlw LED_GRN call delay call delay clrf ledpwm indicate timeout nop BUG!! PATCH for the STACKOFL bug (only 12c508) swapf temp,f read1b clrf btcnt read0b call delay incf btcnt movlw.20 timeout=2 seconds subwf btcnt,w bc read_timeout_b btfss IOPORT, 1 wait for button press goto read0b button pressed incf temp increase value read2b call delay btfsc IOPORT, 1 wait for button release goto read2b goto read1b read_timeout_b movlw LED_GRN call delay call delay indicate timeout S w e d i s h c r. w e e b l y. c o m j a l i l a h m e l i v e. c o m Page 9

10 clrf ledpwm PATCH for the STACKOFL bug (only 12c508) end directive 'end of program' S w e d i s h c r. w e e b l y. c o m j a l i l a h m e l i v e. c o m Page 10

D:\PICstuff\PartCounter\PartCounter.asm

D:\PICstuff\PartCounter\PartCounter.asm 1 ;********************************************************************** 2 ; This file is a basic code template for assembly code generation * 3 ; on the PICmicro PIC16F84A. This file contains the basic

More information

Lecture (04) PIC16F84A (3)

Lecture (04) PIC16F84A (3) Lecture (04) PIC16F84A (3) By: Dr. Ahmed ElShafee ١ Central Processing Unit Central processing unit (CPU) is the brain of a microcontroller responsible for finding and fetching the right instruction which

More information

CENG 336 INT. TO EMBEDDED SYSTEMS DEVELOPMENT. Spring 2006

CENG 336 INT. TO EMBEDDED SYSTEMS DEVELOPMENT. Spring 2006 CENG 336 INT. TO EMBEDDED SYSTEMS DEVELOPMENT Spring 2006 Recitation 01 21.02.2006 CEng336 1 OUTLINE LAB & Recitation Program PIC Architecture Overview PIC Instruction Set PIC Assembly Code Structure 21.02.2006

More information

Application Note - PIC Source Code v1.1.doc

Application Note - PIC Source Code v1.1.doc Programmable, RGB-backlit LCD Keyswitches APPLICATION NOTE PIC SOURCE CODE 2004-2006 copyright [E³] Engstler Elektronik Entwicklung GmbH. All rights reserved. PIC Source Code The following Assembler source

More information

PIC 16F84A programming (II)

PIC 16F84A programming (II) Lecture (05) PIC 16F84A programming (II) Dr. Ahmed M. ElShafee ١ Introduction to 16F84 ٣ PIC16F84 belongs to a class of 8-bit microcontrollers of RISC architecture. Program memory (FLASH) EEPROM RAM PORTA

More information

Embedded Systems. PIC16F84A Sample Programs. Eng. Anis Nazer First Semester

Embedded Systems. PIC16F84A Sample Programs. Eng. Anis Nazer First Semester Embedded Systems PIC16F84A Sample Programs Eng. Anis Nazer First Semester 2017-2018 Development cycle (1) Write code (2) Assemble / compile (3) Simulate (4) Download to MCU (5) Test Inputs / Outputs PIC16F84A

More information

16.317: Microprocessor Systems Design I Fall 2013 Exam 3 Solution

16.317: Microprocessor Systems Design I Fall 2013 Exam 3 Solution 16.317: Microprocessor Systems Design I Fall 2013 Exam 3 Solution 1. (20 points, 5 points per part) Multiple choice For each of the multiple choice questions below, clearly indicate your response by circling

More information

PIC16F87X 13.0 INSTRUCTION SET SUMMARY INSTRUCTIONS DESCRIPTIONS

PIC16F87X 13.0 INSTRUCTION SET SUMMARY INSTRUCTIONS DESCRIPTIONS PIC6F87X 3.0 INSTRUCTION SET SUMMARY Each PIC6F87X instruction is a 4bit word, divided into an OPCODE which specifies the instruction type and one or more operands which further specify the operation of

More information

Chapter 4 Sections 1 4, 10 Dr. Iyad Jafar

Chapter 4 Sections 1 4, 10 Dr. Iyad Jafar Starting to Program Chapter 4 Sections 1 4, 10 Dr. Iyad Jafar Outline Introduction Program Development Process The PIC 16F84A Instruction Set Examples The PIC 16F84A Instruction Encoding Assembler Details

More information

A Better Mouse Trap. Consumer Appliance, Widget, Gadget APPLICATION OPERATION: Ontario, Canada

A Better Mouse Trap. Consumer Appliance, Widget, Gadget APPLICATION OPERATION: Ontario, Canada A Better Mouse Trap Author: APPLICATION OPERATION: My application uses a PIC12C508 to produce realistic sounding mouse-like coos that all mice are sure to find seductive. The entire circuit should be imbedded

More information

Assembly Language Instructions

Assembly Language Instructions Assembly Language Instructions Content: Assembly language instructions of PIC16F887. Programming by assembly language. Prepared By- Mohammed Abdul kader Assistant Professor, EEE, IIUC Assembly Language

More information

movwf prevcod ; a new button is pressed - rcnt=3 movwf (mtx_buffer+1) movlw 3 movwf rcnt

movwf prevcod ; a new button is pressed - rcnt=3 movwf (mtx_buffer+1) movlw 3 movwf rcnt movlw 0x20 #endif call scan movlw 0xfd tris PORTB ; select colb (RB1) #ifdef MODE_CH8 movlw 0x04 #endif #ifdef MODE_CH4 movlw 0x30 #endif call scan movf cod, W bz loop2 ; if no buton is pressed, skip subwf

More information

TOPIC 3 INTRODUCTION TO PIC ASSEMBLY LANGUAGE. E4160 Microprocessor & Microcontroller System. Prepared by : Puziah Yahaya JKE, POLISAS / DEC 2010

TOPIC 3 INTRODUCTION TO PIC ASSEMBLY LANGUAGE. E4160 Microprocessor & Microcontroller System. Prepared by : Puziah Yahaya JKE, POLISAS / DEC 2010 TOPIC 3 INTRODUCTION TO PIC ASSEMBLY LANGUAGE Prepared by : Puziah Yahaya JKE, POLISAS / DEC 2010 E4160 Microprocessor & Microcontroller System Learning Outcomes 2 At the end of this topic, students should

More information

Flow Charts and Assembler Programs

Flow Charts and Assembler Programs Flow Charts and Assembler Programs Flow Charts: A flow chart is a graphical way to display how a program works (i.e. the algorithm). The purpose of a flow chart is to make the program easier to understand.

More information

ECE Test #1: Name

ECE Test #1: Name ECE 376 - Test #1: Name Closed Book, Closed Notes. Calculators Permitted. September 23, 2016 20 15 10 5 0

More information

Dept. of Computer Engineering Final Exam, First Semester: 2016/2017

Dept. of Computer Engineering Final Exam, First Semester: 2016/2017 Philadelphia University Faculty of Engineering Course Title: Embedded Systems (630414) Instructor: Eng. Anis Nazer Dept. of Computer Engineering Final Exam, First Semester: 2016/2017 Student Name: Student

More information

Chapter 13. PIC Family Microcontroller

Chapter 13. PIC Family Microcontroller Chapter 13 PIC Family Microcontroller Lesson 15 Instruction Set Most instructions execution Time One instruction cycle If XTAL frequency = 20 MHz, then instruction cycle time is 0.2 s or 200 ns (= 4/20

More information

/* PROGRAM FOR BLINKING LEDs CONEECTED TO PORT-D */

/* PROGRAM FOR BLINKING LEDs CONEECTED TO PORT-D */ /* PROGRAM FOR BLINKING LEDs CONEECTED TO PORT-D */ CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_ON & _HS_OSC & _WRT_OFF & _LVP_OFF & _CPD_OFF ;***** VARIABLE DEFINITIONS COUNT_L EQU 0x01 ;**********************************************************************

More information

Instuction set

Instuction set Instuction set http://www.piclist.com/images/www/hobby_elec/e_pic3_1.htm#1 In PIC16 series, RISC(Reduced Instruction Set Computer) is adopted and the number of the instructions to use is 35 kinds. When

More information

LAB WORK 2. 1) Debugger-Select Tool-MPLAB SIM View-Program Memory Trace the program by F7 button. Lab Work

LAB WORK 2. 1) Debugger-Select Tool-MPLAB SIM View-Program Memory Trace the program by F7 button. Lab Work LAB WORK 1 We are studying with PIC16F84A Microcontroller. We are responsible for writing assembly codes for the microcontroller. For the code, we are using MPLAB IDE software. After opening the software,

More information

Lesson 14. Title of the Experiment: Introduction to Microcontroller (Activity number of the GCE Advanced Level practical Guide 27)

Lesson 14. Title of the Experiment: Introduction to Microcontroller (Activity number of the GCE Advanced Level practical Guide 27) Lesson 14 Title of the Experiment: Introduction to Microcontroller (Activity number of the GCE Advanced Level practical Guide 27) Name and affiliation of the author: N W K Jayatissa Department of Physics,

More information

Introduction to PIC Programming

Introduction to PIC Programming Introduction to PIC Programming Baseline Architecture and Assembly Language by David Meiklejohn, Gooligum Electronics Lesson 5: Using Timer0 The lessons until now have covered the essentials of baseline

More information

Controller Provides Display of Monitored Process Deviation

Controller Provides Display of Monitored Process Deviation Controller Provides Display of Monitored Process Deviation The gadget, shown in Figure 1.0, is implemented with a controller based process which continuously monitors two, discrete, momentary switch inputs

More information

SOLUTIONS!! DO NOT DISTRIBUTE!!

SOLUTIONS!! DO NOT DISTRIBUTE!! THE UNIVERSITY OF THE WEST INDIES EXAMINATIONS OF FEBRUARY MID-TERM 2005 Code and Name of Course: EE25M Introduction to Microprocessors Paper: Date and Time: Duration: One Hour INSTRUCTIONS TO CANDIDATES:

More information

Discrete Logic Replacement Message Dispatch Engine

Discrete Logic Replacement Message Dispatch Engine Message Dispatch Engine Author: OVERVIEW As we all know, the 8-pin PICmicro has limited resources. A nice way of using interrupts is for queuing events, prioritizing them, or even buffering them. This

More information

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING. EE6008 Microcontroller based system design

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING. EE6008 Microcontroller based system design Year: IV DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING EE6008 Microcontroller based system design Semester : VII UNIT I Introduction to PIC Microcontroller

More information

16.317: Microprocessor-Based Systems I Summer 2012

16.317: Microprocessor-Based Systems I Summer 2012 16.317: Microprocessor-Based Systems I Summer 2012 Exam 3 Solution 1. (20 points, 5 points per part) Multiple choice For each of the multiple choice questions below, clearly indicate your response by circling

More information

University of Jordan Faculty of Engineering and Technology Department of Computer Engineering Embedded Systems Laboratory

University of Jordan Faculty of Engineering and Technology Department of Computer Engineering Embedded Systems Laboratory University of Jordan Faculty of Engineering and Technology Department of Computer Engineering Embedded Systems Laboratory 0907334 6 Experiment 6:Timers Objectives To become familiar with hardware timing

More information

EEE111A/B Microprocessors

EEE111A/B Microprocessors EEE111A/B Microprocessors Revision Notes Lecture 1: What s it all About? Covers the basic principles of digital signals. The intelligence of virtually all communications, control and electronic devices

More information

EECE.3170: Microprocessor Systems Design I Summer 2017 Homework 5 Solution

EECE.3170: Microprocessor Systems Design I Summer 2017 Homework 5 Solution For each of the following complex operations, write a sequence of PIC 16F1829 instructions that performs an equivalent operation. Assume that X, Y, and Z are 16-bit values split into individual bytes as

More information

16.317: Microprocessor-Based Systems I Spring 2012

16.317: Microprocessor-Based Systems I Spring 2012 16.317: Microprocessor-Based Systems I Spring 2012 Exam 3 Solution 1. (20 points, 5 points per part) Multiple choice For each of the multiple choice questions below, clearly indicate your response by circling

More information

Section 31. Instruction Set

Section 31. Instruction Set 31 HIGHLIGHTS Section 31. Instruction Set Instruction Set This section of the manual contains the following major topics: 31.1 Introduction... 31-2 31.2 Data Memory Map... 31-3 31.3 Instruction Formats...

More information

More (up a level)... Connecting the Nokia 3510i LCD to a Microchip PIC16F84 microcontroller

More (up a level)... Connecting the Nokia 3510i LCD to a Microchip PIC16F84 microcontroller 1 von 8 24.02.2010 21:53 More (up a level)... Connecting the Nokia 3510i LCD to a Microchip PIC16F84 microcontroller As with the FPGA board previously, the connections are made by soldering standard IDC

More information

Introduction to PIC Programming

Introduction to PIC Programming Introduction to PIC Programming Midrange Architecture and Assembly Language by David Meiklejohn, Gooligum Electronics Lesson 5: Assembler Directives and Macros As the programs presented in these tutorials

More information

APPLICATION NOTE Wire Communication with a Microchip PICmicro Microcontroller

APPLICATION NOTE Wire Communication with a Microchip PICmicro Microcontroller Maxim > App Notes > 1-Wire DEVICES BATTERY MANAGEMENT Keywords: 1-wire, PICmicro, Microchip PIC, 1-Wire communication, PIC microcontroller, PICmicro microcontroller, 1 wire communication, PICs, micros,

More information

AN587. Interfacing to an LCD Module. Interfacing to an LCD Module INTRODUCTION OPERATION CONTROL SIGNAL FUNCTIONS TABLE 2: CONDITIONAL ASSEMBLY FLAGS

AN587. Interfacing to an LCD Module. Interfacing to an LCD Module INTRODUCTION OPERATION CONTROL SIGNAL FUNCTIONS TABLE 2: CONDITIONAL ASSEMBLY FLAGS Interfacing to an LCD Module AN587 INTRODUCTION TABLE 1: CONTROL SIGNAL FUNCTIONS This application note interfaces a PIC16CXX device to the Hitachi LM02L LCD character display module. This module is a

More information

ECE Homework #3

ECE Homework #3 ECE 376 - Homework #3 Flow Charts, Binary Inputs, Binary Outputs (LEDs). Due Monday, January 29th The temperature sensor in your lab kits has the temperature-resistance relationship of R = 1000 exp 3965

More information

4.5.1) The Label Field ) The Mnemonic Field. 4.5) Assembly Language Program Structure A PIC18 ALP consists of 3 type of statements:

4.5.1) The Label Field ) The Mnemonic Field. 4.5) Assembly Language Program Structure A PIC18 ALP consists of 3 type of statements: 4.5) Assembly Language Program Structure A PIC18 ALP consists of 3 type of statements: 1) Assembler Directives To control the assembler: its input, output, and data allocation. Must be terminated with

More information

UNIVERSITY OF ULSTER UNIVERSITY EXAMINATIONS : 2001/2002. Semester 2. Year 2 MICROCONTROLLER SYSTEMS. Module Code: EEE305J2. Time allowed: 3 Hours

UNIVERSITY OF ULSTER UNIVERSITY EXAMINATIONS : 2001/2002. Semester 2. Year 2 MICROCONTROLLER SYSTEMS. Module Code: EEE305J2. Time allowed: 3 Hours UNIVERSITY OF ULSTER UNIVERSITY EXAMINATIONS : 2001/2002 Semester 2 Year 2 MICROCONTROLLER SYSTEMS Module Code: EEE305J2 Time allowed: 3 Hours Answer as many questions as you can. Not more than TWO questions

More information

Arithmetic,logic Instruction and Programs

Arithmetic,logic Instruction and Programs Arithmetic,logic Instruction and Programs 1 Define the range of numbers possible in PIC unsigned data Code addition and subtraction instructions for unsigned data Perform addition of BCD Code PIC unsigned

More information

Chapter 5 Sections 1 6 Dr. Iyad Jafar

Chapter 5 Sections 1 6 Dr. Iyad Jafar Building Assembler Programs Chapter 5 Sections 1 6 Dr. Iyad Jafar Outline Building Structured Programs Conditional Branching Subroutines Generating Time Delays Dealing with Data Example Programs 2 Building

More information

PIC16F84A 7.0 INSTRUCTION SET SUMMARY INSTRUCTIONS DESCRIPTIONS

PIC16F84A 7.0 INSTRUCTION SET SUMMARY INSTRUCTIONS DESCRIPTIONS PI6F84A 7.0 INSTRUTION SET SUMMARY Each PI6XX instruction is a 4bit word, divided into an OPODE which specifies the instruction type and one or more operands which further specify the operation of the

More information

/ 40 Q3: Writing PIC / 40 assembly language TOTAL SCORE / 100 EXTRA CREDIT / 10

/ 40 Q3: Writing PIC / 40 assembly language TOTAL SCORE / 100 EXTRA CREDIT / 10 16.317: Microprocessor-Based Systems I Summer 2012 Exam 3 August 13, 2012 Name: ID #: Section: For this exam, you may use a calculator and one 8.5 x 11 double-sided page of notes. All other electronic

More information

SOLAR TRACKING SYSTEM USING PIC16F84A STEPPER MOTOR AND 555TIMER

SOLAR TRACKING SYSTEM USING PIC16F84A STEPPER MOTOR AND 555TIMER SOLAR TRACKING SYSTEM USING PIC16F84A STEPPER MOTOR AND 555TIMER Amey Arvind Madgaonkar 1, Sumit Dhere 2 & Rupesh Ratnakar Kadam 3 1. Block diagram International Journal of Latest Trends in Engineering

More information

Week1. EEE305 Microcontroller Key Points

Week1. EEE305 Microcontroller Key Points Week1 Harvard Architecture Fig. 3.2 Separate Program store and Data (File) stores with separate Data and Address buses. Program store Has a 14-bit Data bus and 13-bit Address bus. Thus up to 2 13 (8K)

More information

Hardware Interfacing. EE25M Introduction to microprocessors. Part V. 15 Interfacing methods. original author: Feisal Mohammed

Hardware Interfacing. EE25M Introduction to microprocessors. Part V. 15 Interfacing methods. original author: Feisal Mohammed EE25M Introduction to microprocessors original author: Feisal Mohammed updated: 18th February 2002 CLR Part V Hardware Interfacing There are several features of computers/microcontrollers which have not

More information

Chapter 5. Problems All programming problems should include design pseudo code either as a separate design document on embedded comments in the code.

Chapter 5. Problems All programming problems should include design pseudo code either as a separate design document on embedded comments in the code. Chapter 5. Problems All programming problems should include design pseudo code either as a separate design document on embedded comments in the code. 1S. Prior to execution of the following code segment,

More information

UNIVERSITY OF ULSTER UNIVERSITY EXAMINATIONS : 2001/2002 RESIT. Year 2 MICROCONTROLLER SYSTEMS. Module Code: EEE305J1. Time allowed: 3 Hours

UNIVERSITY OF ULSTER UNIVERSITY EXAMINATIONS : 2001/2002 RESIT. Year 2 MICROCONTROLLER SYSTEMS. Module Code: EEE305J1. Time allowed: 3 Hours UNIVERSITY OF ULSTER UNIVERSITY EXAMINATIONS : 2001/2002 RESIT Year 2 MICROCONTROLLER SYSTEMS Module Code: EEE305J1 Time allowed: 3 Hours Answer as many questions as you can. Not more than TWO questions

More information

CONNECT TO THE PIC. A Simple Development Board

CONNECT TO THE PIC. A Simple Development Board CONNECT TO THE PIC A Simple Development Board Ok, so you have now got your programmer, and you have a PIC or two. It is all very well knowing how to program the PIC in theory, but the real learning comes

More information

Binary Outputs and Timing

Binary Outputs and Timing Binary Outputs and Timing Each of the I/O pins on a PIC can be inputs or ourputs As an input, the pin is high impedance (meaning it is passive and draws very little current). If you apply 0V to that pin,

More information

Here is a sample of the Hellschrieber sent by this project: Following is the PIC MPASM Source Code for Version 0.03 of the Beacon:

Here is a sample of the Hellschrieber sent by this project: Following is the PIC MPASM Source Code for Version 0.03 of the Beacon: 1 of 16 12/16/2010 20:49 This is a simple circuit that does a fair bit of work. The core of the circuit is my favourite IC - the Microchip PIC 16F84 Microcontroller / RISC Microprocessor. This project

More information

Section 4. Architecture

Section 4. Architecture M Section 4. Architecture HIGHLIGHTS This section of the manual contains the following major topics: 4. Introduction...4-2 4.2 Clocking Scheme/Instruction Cycle...4-5 4.3 Instruction Flow/Pipelining...4-6

More information

Performance & Applications

Performance & Applications EE25M Introduction to microprocessors original author: Feisal Mohammed updated: 15th March 2002 CLR Part VI Performance & Applications It is possible to predict the execution time of code, on the basis

More information

Figure 1: Pushbutton without Pull-up.

Figure 1: Pushbutton without Pull-up. Chapter 7: Using the I/O pins as Inputs. In addition to working as outputs and being able to turn the I/O pins on and off, these same pins can be used as inputs. In this mode the PIC is able to determine

More information

Chapter 3: Further Microcontrollers

Chapter 3: Further Microcontrollers Chapter 3: Further Microcontrollers Learning Objectives: At the end of this topic you will be able to: recall and describe the structure of microcontrollers as programmable assemblies of: memory; input

More information

Hi Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan

Hi Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan Bank Switching, Table, Macros & Modules Hi Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan chanhl@mail.cgu.edu.twcgu PIC18 memory access up to 2 MB of program memory Inside the

More information

SOLUTIONS!! DO NOT DISTRIBUTE PRIOR TO EXAM!!

SOLUTIONS!! DO NOT DISTRIBUTE PRIOR TO EXAM!! THE UNIVERSITY OF THE WEST INDIES EXAMINATIONS OF APRIL MID-TERM 2005 Code and Name of Course: EE25M Introduction to Microprocessors Paper: MidTerm Date and Time: Thursday April 14th 2005 8AM Duration:

More information

When JP1 is cut, baud rate is Otherwise, baud rate is Factory default is that JP1 is shorted. (JP1 is jumper type in some model)

When JP1 is cut, baud rate is Otherwise, baud rate is Factory default is that JP1 is shorted. (JP1 is jumper type in some model) ELCD SERIES INTRODUCTION ALCD is Serial LCD module which is controlled through Serial communication. Most of existing LCD adopts Parallel communication which needs lots of control lines and complicated

More information

Interfacing PIC Microcontrollers. ADC8BIT2 Schematic. This application demonstrates analogue input sampling

Interfacing PIC Microcontrollers. ADC8BIT2 Schematic. This application demonstrates analogue input sampling Interfacing PIC Microcontrollers ADC8BIT2 Schematic This application demonstrates analogue input sampling A manually adjusted test voltage 0-5V is provided at AN0 input A reference voltage of 2.56V is

More information

ECE 354 Introduction to Lab 2. February 23 rd, 2003

ECE 354 Introduction to Lab 2. February 23 rd, 2003 ECE 354 Introduction to Lab 2 February 23 rd, 2003 Fun Fact Press release from Microchip: Microchip Technology Inc. announced it provides PICmicro field-programmable microcontrollers and system supervisors

More information

Discrete Logic Replacement A Keypad Controller for Bi-directional Key Matrix

Discrete Logic Replacement A Keypad Controller for Bi-directional Key Matrix A Keypad Controller for Bi-directional Key Matrix Author: Vladimir Velchev AVEX - Vladimir Velchev Sofia, Bulgaria email:avex@iname.com APPLICATION OPERATION: The PIC microcontroller can replace the traditional

More information

APPLICATION NOTE 2361 Interfacing an SPI-Interface RTC with a PIC Microcontroller

APPLICATION NOTE 2361 Interfacing an SPI-Interface RTC with a PIC Microcontroller Maxim/Dallas > App Notes > REAL-TIME CLOCKS Keywords: DS1305, SPI, PIC, real time clock, RTC, spi interface, pic microcontroller Aug 20, 2003 APPLICATION NOTE 2361 Interfacing an SPI-Interface RTC with

More information

President Alan VK6ZWZ Acting Sec. Don VK6HK Vice President Terry VK6ZLT Treasurer Ces VK6AO

President Alan VK6ZWZ Acting Sec. Don VK6HK Vice President Terry VK6ZLT Treasurer Ces VK6AO The West Australian VHF Group Bulletin JANUARY 2002 THE WEST AUSTRALIAN VHF GROUP (INC) PO BOX 189 APPLECROSS e-mail for editor to: pi@multiline.com.au President Alan VK6ZWZ Acting Sec. Don VK6HK Vice

More information

PIC PROGRAMMING START. The next stage is always the setting up of the PORTS, the symbol used to indicate this and all Processes is a Rectangle.

PIC PROGRAMMING START. The next stage is always the setting up of the PORTS, the symbol used to indicate this and all Processes is a Rectangle. PIC PROGRAMMING You have been introduced to PIC chips and the assembly language used to program them in the past number of lectures. The following is a revision of the ideas and concepts covered to date.

More information

PTK8756B 8 Bit Micro-controller Data Sheet

PTK8756B 8 Bit Micro-controller Data Sheet PTK8756B 8 Bit Micro-controller DEC 15, 2008 Ver1.1 普泰半導體股份有限公司 PORTEK Technology Corporation 公司地址 : 臺北縣新店市寶橋路 235 巷 120 號 4 樓 聯絡電話 : 886-2-89121055 傳真號碼 : 886-2-89121473 公司網址 : www.portek.com.tw Page1

More information

Lesson 4 Fun with W and F

Lesson 4 Fun with W and F Elmer 160 Lesson 4 Overview Lesson 4 Introduction In this section This lesson introduces the first few PIC instructions. The following is a list of topics in this section: Description See Page Writing

More information

Weekly Report: Interactive Wheel of Fortune Week 4 02/014/07-02/22/07 Written by: Yadverinder Singh

Weekly Report: Interactive Wheel of Fortune Week 4 02/014/07-02/22/07 Written by: Yadverinder Singh Work Completed: Weekly Report: Interactive Wheel of Fortune Week 4 02/014/07-02/22/07 Written by: Yadverinder Singh Last week started with the goal to complete writing the overall program for the game.

More information

Outlines. PIC Programming in C and Assembly. Krerk Piromsopa, Ph.D. Department of Computer Engineering Chulalongkorn University

Outlines. PIC Programming in C and Assembly. Krerk Piromsopa, Ph.D. Department of Computer Engineering Chulalongkorn University PIC ming in C and Assembly Outlines Microprocessor vs. MicroController PIC in depth PIC ming Assembly ming Krerk Piromsopa, Ph.D. Department of Computer Engineering Chulalongkorn University Embedded C

More information

Arithmetic and Logic Instructions. Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan

Arithmetic and Logic Instructions. Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan Arithmetic and Logic Instructions Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan chanhl@mail.cgu.edu.tw Find the sum of the values from 40H to 43H. Put the sum in filereg locations

More information

EECE.3170: Microprocessor Systems Design I Summer 2017

EECE.3170: Microprocessor Systems Design I Summer 2017 EECE.3170: Microprocessor Systems Design I Summer 2017 1. What is an interrupt? What is an exception? Lecture 13: Key Questions June 19, 2017 2. For what purposes are interrupts useful? 3. Describe the

More information

ECE 354 Computer Systems Lab II. Interrupts, Strings, and Busses

ECE 354 Computer Systems Lab II. Interrupts, Strings, and Busses ECE 354 Computer Systems Lab II Interrupts, Strings, and Busses Fun Fact Press release from Microchip: Microchip Technology Inc. announced it provides PICmicro field-programmable microcontrollers and system

More information

Section 11. Timer0. Timer0 HIGHLIGHTS. This section of the manual contains the following major topics:

Section 11. Timer0. Timer0 HIGHLIGHTS. This section of the manual contains the following major topics: M 11 Section 11. HIGHLIGHTS This section of the manual contains the following major topics: 11.1 Introduction...11-2 11.2 Control Register...11-3 11.3 Operation...11-4 11.4 TMR0 Interrupt...11-5 11.5 Using

More information

PIC Discussion. By Eng. Tamar Jomaa

PIC Discussion. By Eng. Tamar Jomaa PIC Discussion By Eng. Tamar Jomaa Chapter#2 Programming Microcontroller Using Assembly Language Quiz#1 : Time: 10 minutes Marks: 10 Fill in spaces: 1) PIC is abbreviation for 2) Microcontroller with..architecture

More information

Introduction to PIC Programming

Introduction to PIC Programming Introduction to PIC Programming Programming Baseline PICs in C by David Meiklejohn, Gooligum Electronics Lesson 3: Using Timer 0 As demonstrated in the previous lessons, C can be a viable choice for programming

More information

Electromechanical Timer Replacement

Electromechanical Timer Replacement Electromechanical Timer Replacement Reminder Timer for Changing Chemicals in a Water Softener (IRON) Author: Michael MacDonald Mikaurie Prescott, WI USA email: mikemd@pressenter.com APPLICATION OPERATION:

More information

Electromechanical Switch Replacement Smart Switch for Car Windscreen Wiper Control

Electromechanical Switch Replacement Smart Switch for Car Windscreen Wiper Control Electromechanical Switch Replacement Smart Switch for Car Windscreen Wiper Control Author: Marc Hoffknecht Aachen, Germany email: hofknecht@online.de OPERATION FLOWCHART dry wet windscreen unit on PIC12C508

More information

Q1: Multiple choice / 20 Q2: Protected mode memory accesses. / 40 Q3: Reading PIC. / 40 assembly language TOTAL SCORE / 100

Q1: Multiple choice / 20 Q2: Protected mode memory accesses. / 40 Q3: Reading PIC. / 40 assembly language TOTAL SCORE / 100 16.317: Microprocessor-Based Systems I Fall 2012 Exam 2 November 7, 2012 Name: ID #: For this exam, you may use a calculator and one 8.5 x 11 double-sided page of notes. All other electronic devices (e.g.,

More information

Jordan University of Science and Technology Electrical Engineering Department Microcontrollers and Embedded Systems Spring 2011

Jordan University of Science and Technology Electrical Engineering Department Microcontrollers and Embedded Systems Spring 2011 Jordan University of Science and Technology Electrical Engineering Department Microcontrollers and Embedded Systems Spring 2011 Microcontrollers andembedded Systems and and EE445 Embedded Embedded Microcontrollers

More information

PICDEM-1 USER S GUIDE

PICDEM-1 USER S GUIDE PICDEM- USER S GUIDE Information contained in this publication regarding device applications and the like is intended by way of suggestion only. No representation or warranty is given and no liability

More information

The University of Texas at Arlington Lecture 5

The University of Texas at Arlington Lecture 5 The University of Texas at Arlington Lecture 5 CSE 3442/5442 LCD Discussed in Chapter 12 RS, R/W, E Signals Are Used to Send/Receive Data on D0-D7 2 PIC PROGRAMMING IN C CHAPTER 7 Chapter 7 discusses the

More information

Section 30. In-Circuit Serial Programming (ICSP )

Section 30. In-Circuit Serial Programming (ICSP ) Section 30. In-Circuit Serial Programming (ICSP ) HIGHLIGHTS This section of the manual contains the following major topics: 30. Introduction... 30-2 30.2 Entering In-Circuit Serial Programming Mode...

More information

Appendix D: Source Codes. PDF created with pdffactory Pro trial version

Appendix D: Source Codes. PDF created with pdffactory Pro trial version Appendix D: Source Codes Accelerometer Acquisition program (MPLAB) List p=16f877a include "p16f877a.inc" config _cp_off & _wdt_off & _xt_osc & _pwrte_on ;Reading Accelerometer duty cycle value ;This subroutine

More information

EECE.3170: Microprocessor Systems Design I Spring 2016

EECE.3170: Microprocessor Systems Design I Spring 2016 EECE.3170: Microprocessor Systems Design I Spring 2016 Lecture 31: Key Questions April 20, 2016 1. (Review) Explain how interrupts can be set up and managed in the PIC microcontrollers. 1 EECE.3170: Microprocessor

More information

Wireless Model Rocket Igniter, William Grill, Riverhead Systems

Wireless Model Rocket Igniter, William Grill, Riverhead Systems Wireless Model Rocket Igniter, William Grill, Riverhead Systems Modified from an earlier Gadget, Gadget Freak Case #124: Controlling the Rocket Fire, the simple controller based igniter monitor published

More information

Hi Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan

Hi Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan Interrupts and Resets Hi Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan chanhl@mail.cgu.edu.twcgu Interrupts An event that will cause the CPU to stop the normal program execution

More information

EXPERIMENT 4: Parallel Input/Output. Objectives Introduction to the Parallel Input/Output (I/O) Familiarization to Interfacing

EXPERIMENT 4: Parallel Input/Output. Objectives Introduction to the Parallel Input/Output (I/O) Familiarization to Interfacing EXPERIMENT 4: Parallel Input/Output Objectives Introduction to the Parallel Input/Output (I/O) Familiarization to Interfacing Components' List: 1. Protoboard 2. 4 x pushbutton 3. 4 x 330Ω resistor 4. 4

More information

Bright Idea Light Timer, Junior

Bright Idea Light Timer, Junior Bright Idea Light Timer, Junior Electromechanical Switch Replacement Author: APPLICATION OPERATION Overview The Bright Idea Light Timer, Jr. (BILTJR) is a digital version of the venerable lamp on/off timers

More information

Fortune. Semiconductor Corporation 富晶半導體股份有限公司. 8-bit MCU with 1k program ROM, 64-byte RAM, 1 R2F module and 3 13 LCD driver. TD Rev. 1.

Fortune. Semiconductor Corporation 富晶半導體股份有限公司. 8-bit MCU with 1k program ROM, 64-byte RAM, 1 R2F module and 3 13 LCD driver. TD Rev. 1. Fortune 1 R2F module and 3 13 LCD driver. Data Sheet TD-0410001 Rev. 1.2 This manual contains new product information. Fortune reserves the rights to modify the product specification without further notice.

More information

MPASM 5.46 AT89C2051_PROGRAMMER.ASM :21:50 PAGE 1 VALUE

MPASM 5.46 AT89C2051_PROGRAMMER.ASM :21:50 PAGE 1 VALUE MPASM 5.46 AT89C2051_PROGRAMMER.ASM 7-30-2013 8:21:50 PAGE 1 00001 LIST N=102 00002 ; 00003 ; 00004 ; 00005 ; 00006 ; 00007 ; 00008 ; 00009 ; 00010 ; 00011 ; 00012 ; 00013 ; 00014 ; 00015 ; 00016 ; 00017

More information

Introduction to PIC Programming

Introduction to PIC Programming Introduction to PIC Programming Programming Baseline PICs in C by David Meiklejohn, Gooligum Electronics Lesson 3: Sleep Mode and the Watchdog Timer Continuing the series on C programming, this lesson

More information

Experiment 7:The USART

Experiment 7:The USART University of Jordan Faculty of Engineering and Technology Department of Computer Engineering Embedded Systems Laboratory 0907334 7 Experiment 7:The USART Objectives Introduce the USART module of the PIC

More information

CHAPTER 0: INTRODUCTION TO COMPUTING SECTION 0.1: NUMBERING AND CODING SYSTEMS 1. (a) 1210 = 11002 (b) 12310 = 0111 10112 (c) 6310 = 0011 11112 (d) 12810 = 1000 00002 (e) 100010 = 0011 1110 10002 2. (a)

More information

PIC16C63A/65B/73B/74B

PIC16C63A/65B/73B/74B PI663A/65B/73B/74B 4.0 MEMORY ORGANIATION 4. Program Memory Organization The PI663A/65B/73B/74B has a 3bit program counter capable of addressing an 8K x 4 program memory space. All devices covered by this

More information

Embedded System Design

Embedded System Design ĐẠI HỌC QUỐC GIA TP.HỒ CHÍ MINH TRƯỜNG ĐẠI HỌC BÁCH KHOA KHOA ĐIỆN-ĐIỆN TỬ BỘ MÔN KỸ THUẬT ĐIỆN TỬ Embedded System Design : Microcontroller 1. Introduction to PIC microcontroller 2. PIC16F84 3. PIC16F877

More information

Embedded Systems Programming and Architectures

Embedded Systems Programming and Architectures Embedded Systems Programming and Architectures Lecture No 10 : Data acquisition and data transfer Dr John Kalomiros Assis. Professor Department of Post Graduate studies in Communications and Informatics

More information

Chapter 11: Interrupt On Change

Chapter 11: Interrupt On Change Chapter 11: Interrupt On Change The last two chapters included examples that used the external interrupt on Port C, pin 1 to determine when a button had been pressed. This approach works very well on most

More information

Beacon Keyers Using PIC s. Dave Powis, DL/G4HUP

Beacon Keyers Using PIC s. Dave Powis, DL/G4HUP Beacon Keyers Using PIC s Dave Powis, DL/G4HUP What are PIC s PIC s (Programmable Intelligent Controllers?) are the range of embedded microcontroller parts manufactured by Arizona Microchip [1]. Similar

More information

Tutorial for PICMON18 Debug Monitor

Tutorial for PICMON18 Debug Monitor Tutorial for PICMON18 Debug Monitor Version 2.6 DRAFT Shu-Jen Chen 5/26/2004 Copyright 2004 Shu-Jen Chen 1. What is PICMON18? PICMON18 is a ROM resident debug monitor program for the Microchip PIC18 family

More information

AN530. Interfacing 93CX6 Serial EEPROMs to PIC16C5X Microcontrollers INTRODUCTION THE HARDWARE CONNECTION THE SOFTWARE CONNECTION

AN530. Interfacing 93CX6 Serial EEPROMs to PIC16C5X Microcontrollers INTRODUCTION THE HARDWARE CONNECTION THE SOFTWARE CONNECTION Interfacing 93CX6 Serial EEPROs to PIC16C5X icrocontrollers Authors: Stan D'Souza icrochip Technology Inc. Bob Ward icrochip Technology Inc. INTRODUCTION icrochip Technology Inc. s popular 93C46/56/66

More information

Programmable Lights. Each Line In and Line Out terminal must have its own grounding terminal.

Programmable Lights. Each Line In and Line Out terminal must have its own grounding terminal. Programmable s Electromechanical Switch Replacement Author: Kirill Yelizarov V Moscow Power Engineering Institute Moscow, Russia email: tihonov@srv-vmssmpeiacru APPLICATION OPERATION The electronic switch

More information