Week1. EEE305 Microcontroller Key Points

Size: px
Start display at page:

Download "Week1. EEE305 Microcontroller Key Points"

Transcription

1 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) 14- bit instructions can be addressed. Data store Has an 8-bit Data bus and a maximum of a 9-bit Address bus. Thus up to 512 bytes of data can be addressed. Input and Output ports are part of this address space. Locations in the Data store are known as Files. Fetch and Execute Fig. 3.4 Concept of fetch and execute cycles. Parallel operation in Harvard architecture. Role of Program Counter, Pipeline, Instruction decoder, ALU and Working register. Each location in the Program store holds one 14-bit instruction. 1

2 Software Is aware of the principle of a program as a series of instructions. Understands the binary structure of a PIC instruction. Can read an instruction set for the mid-range PIC family Knows the purpose of the C and Z flags in the Status register (File 3) The Code Translation Process Figs. 8.1, 8.2, 8.5, 8.6, 8.7 Understands the function of an Assembler is to convert from Source code to Machine code. Appreciates the advantages of the use of Assembly-level source code as the coding medium as against raw machine code: Readibility: Errors: Mnemonics, labels, comments Less error prone, easier to spot errors Maintainability:Easier to modify and add extensions Reusability: Easier to use routines for more than one project 2

3 Understands the reason for and use of an Integrated Development Environment (IDE) in coding and testing software. Can use the MPLAB IDE to: Edit and save simple assembly-level programs. Make a Project. Assemble and correct syntax errors. Use the Simulator with a Watch window to Single-step through the program and monitor program variables. Set a Breakpoint and Animate the program execution. 3

4 Week2 PIC16F84 Architecture Fig. 4.1 Fetch Unit: Deals with fetching the appropriate 14-bit operation code from the Program store. 13-bit Program Counter and its relationship with the PCL (File 2) and PCLATH (File h 0A ). 2-stage pipeline leading to the Instruction decoder. 8-deep Stack. Figs 3.7, 4.2, 4.8. Execute Unit: Carries out commands as directed by the Execution circuitry. Loads and Stores 8-bit bytes from/to the Data store. The ALU carries out the logic/arithmetic in conjunction with the Working register and Status register (the Carry/Not Borrow and Zero flags). Data store is organised as two banks of up to 128 bytes each. The programmer can switch between them using the RP0 bit in the Status register. Figs 4.5, 4.7 4

5 5

6 Instruction Set Chapter 5 Move Table 5.1 Load from Data store to W e.g. movf h 20,w Load constant into W e.g. movlw 6 Store W to Data store e.g. movwf h 21 Swap file nybbles e.g. swapf h 30,f Key concepts: TIP movf affects the Z flag and thus movf **,f is a useful way of Testing if File** is all Zero ( ). Non of the other Move instructions affect flags. 6

7 Arithmetic Table 5.2 Addition (Note use of W or f as destination) e.g.: Clear addwf h 20,w ; W <- W+[Fh 20 ] addwf h 20,f ; [Fh'20'] <- W+[Fh'20'] addlw 6 ; Add literal 6 to W (max value 255) addlw -1 ; Subtract 1 from W (i.e. decrement W) TIP: DO NOT USE SUBLW to subtract a constant clrf h'20' ; Clears the specified file reg clrw Increment and Decrement incf ; Clear W h'20',f ; Increment the contents of File h'20' incf h'20',w ; Put the incremented value of the contents of File h'20' into W. File h'20' remains unchanged 7

8 Subtract e.g.: subwf h'20',w ; W <- [Fh'20']-W subwf h'20',f ; [Fh'20'] <- [Fh'20']-w Bit Banging bcf bsf h'20',7 ; Clears bit 7 of File h'20' h'20',4 ; Set bit 4 of File h'20' Program Counter Table 5.4 Jump to an instruction somewhere in Program store goto goto h 050 ; Jump to the h 050 FRED ; Jump to instruction labelled FRED Bit Test and Conditionally Skip btfsc h'20',6 ; Skip if bit6 of File h'20' is clear(0) btfss h'20',4 ; Skip if bit 4 of File h'20' is set (1) Increment/Decrement File and Skip on Zero incfsz h'20',f ; Increment File h'20' & skip if all zero decfsz h'20',f ; Decrement File h'20' & skip if all zero 8

9 Week3 Indirect Addressing Fig. 5.2 The datum s location in the Data store is pointed to by the File Select Register (FSR = File 04). The Indirect mechanism is triggered by specifying the phantom File register INDF (INDirect File register at File 00). For example: clrf 0 ; Actually clears the file POINTED TO by the FSR! So if the contents of the FSR happened to be h'20' at this time, then File h'20' would be the location cleared; not File 00. Logic/Shifting Instructions NOT (1 s complement) Inverts all bits in the specified File; e.g.: File h'20' comf h'20',f File h'20' AND (Used to clear bits) ANDs all bits in the specified File; e.g. to clear the lower four bits of the Working register leave the upper nybble unchanged: W andlw b W Anding with 0 always gives 0, ANDing with 1 gives no change. 9

10 E.g. to zero the upper two bits of File h'20': File h'20' movlw b ; Mask byte andwf h'20',f ; Zero bits File h'20' OR-Inclusive (Used to set bits) Inclusive-ORs all bits in the specified File; e.g. to set bit 7 of the Working register: W iorlw b W e.g. to set bits 2 and 3 of File h'20' File h'20' movlw b ; Mask iorwf h'20',f ; Zero bits File h'20' Inclusive-ORing with 1 always gives 1, with a 0 gives no change. 10

11 OR-eXclusive (Used to toggle bits; also to check two numbers for changes and to generate parity) Exclusive-ORs all bits in the specified File. e.g. to toggle bits 7 & 6 in the Working register: W xorlw b W e.g. to toggle bits 0 & 1 of File h'20': File h'20' movlw b ; Mask byte xorwf h'20',f ; Zero bits File h'20' exclusive-oring with 1 always toggles, with a 0 giving no change. 11

12 Rotate (Shift) Used to shift a File left or right one place in conjunction with the Carry flag. e.g. to rotate the contents of File h'20' right one place: C 1 File h'20' rrf h'20',f ; Rotate Note: To do a plain shift (with a 0 coming in from the right), then clear the Carry bit before doing a Rotate; e,g,: bcf STATUS,C ; Clear the carry bit rrf h'20',f ; Do the shift Note: rlf rotates left but otherwise is the same as rrf Note: If a multiple-precison shift (> 1 byte) is required then clear the Carry flag and then rotate each file in turn; e.g. to shift left a 2-byte object in File h 22 & h 23 : bcf STATUS,C ; Clear Carry rlf h 22,f ; Shift the Least Significant Byte rlf h 23,f ; Shift the Most Significant Byte C 0 File h'20'

13 Comparing two Numbers If you want to know if your byte in the Working register is HIGHER THAN, EQUAL TO or LOWER THAN either the contents of a File register or a constant, then subtract the two numbers. If they are the same then the outcome will be zero (Z flag will be 1). If the first number is higher or the same as the second then there will be NO borrow (Carry flag will be 1). If the second number is higher then there will be a borrow (Carry flag will be 0). E.g. to compare a byte in W with that in File h'20': subwf h'20',w ; Contents of W is [File h'20'] - W then: IF f is Equal to W outcome is zero: Z flag is 1 IF f is Higher or Same as W then f W will not generate a borrow: C = 1 IF f is Lower Than W then f W will generate a borrow: C = 0 TIP TIP Remember that the Carry flag is a NOT Borrow flag after a subtract. 13

14 Parallel ports Chapter 11 Define a port as a way into or out of a digital system A parallel port enables the program to read in or write to a number (typically up to 8) of pins at one time. Conceptually a parallel I/O port can be considered as a File connected to pins on the IC; as below: 14

15 A pin may be configured by software to be either an Input or Output. Pins are labelled (e.g. in Port B) as RB7 thru RB0 corresponding to bits 7 thru 0 in File 06. A pin set-up as an input reflects if the voltage is low (logic0, typ zero volts) or high (logic1, typ +5V) at the appropriate bit in the port File A pin set-up as an output will go high or low following the appropriate bit in the port File. Each pin may be individually set to input or output with the port s TRIS register in Bank1 according to the scheme: TRISX bit n = 1 TRISX bit n = 0 Pin n in Port X is Input Pin n in Port X is Output On Reset all TRIS bits are set to 1 and therefore all pins are inputs. 15

16 Example: To pulse pin RA0 low:high twice whenever pin RB7 goes high. include p16f84.inc bsf STATUS,RP0 ; Change to Bank 1 movlw b ; Prepare to set pin RA0 to Output movwf TRISA movlw b ; Set up PortB as IPs (default on Reset) movwf TRISB bcf STATUS,RP0 ; Back to Bank 0 ; bcf PORTA,0 ; Make pin RA0 low LOOP btfss PORTB,7 ; Skip if RA7 is high goto LOOP ; Keep looking bcf PORTA,0 ; RA0 goes low bsf PORTA,0 ; and high bcf PORTA,0 ; and low bsf PORTA,0 ; and high Skip if high 16

17 Week4 Subroutines Chapter 6 The modular nature of software. The call-return mechanism and the use of the Stack to automatically save the address of the jumping-off point (i.e. the next value of the PC). Subroutine return call call Main routine Subroutine instructions call, return in Table Use of the Stack to save jumping-off points. Passing parameters back and forth to subroutines. 17

18 Rules for calculating execution time of an instruction: A cycle is ¼ of the crystal frequency; e.g. 4MHz gives a 1µs delay. Normal instructions take one cycle Instructions that cause the Program Counter to skip or jump take two cycles; e.g. goto, call, return, btfss when a skip occurs. Single loop delay subroutine giving a fixed 1ms 4MHz. Knows how to calculate the value of the constant loaded into W and decremented. Double loop delay subroutine based on an extra loop of 100 passes with the 1ms loop as a core, giving a 100ms 4MHz Variable delay subroutine with three nested loops, giving K times 100ms, where K is passed in the Working register Binary-Coded Decimal representation of decimal numbers but in binary; for example decimal 63 (which in natural binary is ) can be represented as (i.e. 6 3). 18

19 Look-up tables implemented as a series of retlw instructions (RETurn with Literal in W). Implemented by adding the number in the Working register (n) to the low byte of the Program Counter (PCL) to force a jump of n instructions to return with the appropriate constant: For example: LOOK_UP addwf PCL,f ; Add n to the low byte of PC retlw b ; Return pattern if n = 0 retlw b ; Return pattern if n = retlw b ; Return pattern if n = 2 retlw b ; Return pattern if n = 3 retlw b ; Return pattern if n = 4 retlw b ; Return pattern if n = 5 retlw b ; Return pattern if n = 6 retlw b ; Return pattern if n = 7 ; etc If, say, the contents of W were 04 on entry; then the addwf instruction would add 04 to the Program Counter, which is already pointing to the first retlw instruction, causing it to skip down to the fifth retlw instruction. This causes a return from the subroutine with the value b in W. 19

20 Week 5 Interrupt Handling Chapter 7 Interrupts are events which can come from an event from either: Outside the device (e.g. an object breaking a light beam) Inside via a Peripheral module wanting service (e.g. a Timer overflowing) Interrupts can be disabled completely by clearing the GIE bit in the INTCON register. Each particular interrupt can be disabled by clearing its own local Enable (Mask) bit. On reset all interrupt Mask bits are cleared. Each source of interrupts has its own Interrupt Flag which is set when a request is made; even if that interrupt is masked out. 20

21 When an enabled interrupt request arrives, the PIC will respond after the current instruction has been completed: The GIE General Interrupt Enable bit is cleared to lock out any more interrupts. A copy of the PC is made on the Stack. The program will jump (vector) to location h 004 in the Program store in which the programmer should have placed a goto instruction to the start of the Interrupt Request Routine (a type of subroutine used to service interrupts. The ISR should save W and STATUS and determine the source of the interrupt by checking the appropriate Interrupt flags. Such flags should be cleared before completing the ISR. At the end of the ISR any saved system Files should be retrieved and the instruction retfie (RETurn From Interrupt and Enable further requests) used to return to the interrupted instruction and set GIE 21

22 22

23 Programming in CCS C Chapter 9 Structure of a C program Use of #include <16f84.h> header file Object definition and types Unsigned byte sized int unsigned 16-bit word-sized long Simple arithmetic in C The process of simulation C code with MPLAB Viewing decimal objects in Watch window of byte (int) and word (long) objects Names of non-global objects prefixed by function name; e.g. main.count if and if-else decisions while and for loops 23

24 C Function declarations Passing parameters to functions Definition of a function Returning a parameter from a function Global variables used by functions Binary to BCD conversion The #byte directive used to name specific File addresses; e.g. #byte FRED = 0x20 /* Name File h 20 as FRED */ The#bit directive used to name specific bits in a specific File; e.g. #bit FRED.7 = RELAY /* Bit7 of File h 20 is called RELAY*/ Example: To turn on the Relay (logic 1) for 6 seconds then turn it off. Assume an 8MHz crystal for the delay functions: #include <16f84.h> #delay (clock = ) /* Tell compiler 8MHz crystal */ main() { RELAY = 1; /* Turn it on (logic 1) */ delay_ms(6000); /* For 6 seconds */ RELAY = 0; /* and off */ } where delay_ms() is a built-in CCS C function 24

25 Can compare high-level C coding versus assembly language. Advantages of High-level code More compact and therefor more productive to code Syntax is more oriented to human problem solving, which makes it easier to document, debug, maintain and modify/extend Easier to port to different hardware platforms (processors), giving a longer productive life Better economics as being platform independent gives a larger customer base Disadvantages of High-level code compared to assembly Is less space efficient than assembler languages Runs more slowly Compilers cost more than assemblers Not the same intimate relationship to the hardware, so debugging interface with hardware can be more convoluted 25

26 Example: Example: To pulse pin RA0 low:high twice whenever pin RB7 goes high using CCS C (see Slide 16 for assembly version). #include <16f84.h> #byte PORTA = 05 /* PORTA is at File 05 */ #byte PORTB = 06 /* PORTB is at File 06 */ #bit OUT = PORTA.0/* Bit RA0 is to be used an input */ #bit IN = PORTB.7/* Bit RB7 is used as an input pin */ main() { set_tris_a(0xfe); /* Make pin RA0 and Output b */ Set_tris_b(0xFF); /* and all PORTB pins input */ while(in = 0) {;} /* Do nothing while RB7 stays low */ OUT = 0; OUT = 1; /* ELSE pulse RA0 low:high */ OUT = 0; OUT = 1; * and again pulse low:high */ } 26

27 Week 6 Watchdog timer (wdt) Fig Function: To automatically reset the microcontroller if it malfunctions (typically due to noise or software bug) How does it work? wdt is a (nominal) 18ms pulse generator; i.e. once started at Reset, it times out (oscillates ) with a period of about 18ms: It is possible to set the wdt by using the clrwdt instruction. Provided that the program does it more often than every 18ms the wdt will never timeout and the MCU will not reset If 18ms is too short it may be extended by selecting the Post/Prescaler using the PSA (PreScale Assign) in the OPTION_REG. The ratio can be selected by programming the PS2:1:0 bits at the start of the program to up to a factor of 128. NOTE: This scaler is shared between the wdt and TIMER0 Fig If the wdt does timeout it will clear the TO bit in STATUS, so the program can tell that a wdt reset occurred 18ms Reset MCU 27

28 config #fuses _wdt_on/_wdt_off wdt/nowdt ; Assembly /* CCS C */ 28

29 Timer 0 (Real-Time Counter/Clock) Fig 13.3 Function: To count either internal clock pulses or external events (pulses) at pin RA4/T0CKI How does it work? TMR0 is an 8-bit up counter at File 1. It can be Read from or Written to If the TMR0 counter overflows; e.g. FC FD FE FF 00, it will set the T0IF flag (Tmr0 Interrupt Flag) in the INTCON (INTerrupt CONtrol) register. This bit may be continually checked (polled) or else may be used to action an interrupt The source of counting pulses may be either the RA4 pin (called T0CKI, for Tmr0ClocKIn) or from the crystal clock 4 (e.g. 1µs for 4MHz) using the T0CS (Tmr0 Clock Select) bit in the OPTION_REG If external from T0CKI then the active edge or may be selected using the T0SE (Tmr0 Set Edge) bit in the OPTION_REG If bit PSA = 0 the Prescaler is chosen for the Timer rather than for the Watchdog timer. In this situation the clocking rate may be divided down as selected using the three PS[2:0] bits in OPTION_REG 29

30 30

31 Week 7 (Chapter 14) Most physical signals (e.g. music, video) are analog; computing machines are binary digital. Analog to digital conversion is the process of converting smooth continuous signals to a series of binary numbers. The process is characterised as: Sampling: Converting the signal on a regular basis at discrete points in time; for example a music CD contains digitized samples taken at a rate of 44,100 samples per second. Shannon s sampling theory gives a minimum sampling rate of twice the highest analog frequency component. Resolution: The number of levels and hence binary bits each sample is converted to; in general 2 n, where n is the number of bits: For 8 bits (telephone) the resolution is 256 (2 8 ) levels; for 16-bit conversion (e.g. CD music) the resolution is 65,536 (2 16 ) 31

32 32

33 Converting from digital to analog can be done by using a weighted network of resistors or capacitors with each bit contributing a current or voltage going up in powers of two. The circuit below is only useful where there are few bits, as a wide range of precision resistors is hard to implement. Other networks with only two values are resistors or capacitors are normal. 33

34 Converting from analog to digital is more complex. There are many techniques, of which a few are: Ramp generation: Here a voltage charges up a capacitor and the time taken is inversely proportional to the size of the analog voltage. The analog voltage causes a current to flow to the amplifier which charges up the capacitor giving a ramp. By measuring the time to reach a threshold voltage we can convert time to a digital number. Ramp converters are slow and not very accurate. Commercial versions are called dual-ramp and they measure the time for a precision reference voltage to charge up and then compare this to the time taken by the input discharging back to zero. 34

35 Counter ADCs use a binary counter with a DAC module to generate a staircase voltage. Using an analog comparator to compare this ramp with the input voltage gives a signal when equality is reached. The value of the counter is our digitized number. Counter ADCs are relatively slow but comparatively simple to construct. 35

36 Successive-approximation ADCs replace the counter by intelligent digital circuitry which tries each bit in turn, beginning with the highest bit. If the resulting analog voltage is too bit it is returned to 0 else it remains at 1. For an n-bit converter, only n tries are needed instead of 2 n for a counter type. Successive-approximation ADCs are medium speed and the most common. 36

37 The 10-bit ADC module in the PIC family has the following features: Up to 8 channels of analog input are available, shared with parallel port pins. At any one time ONE channel may be selected for conversion using the 3 Channel Select bits in ADCON0. The conversion is started by bringing the GO bit in ADCON0 to 1. This opens the sample and hold switch and the voltage is held on the sample capacitance during the conversion. After the conversion is complete, the GO/DONE bit goes to 0 (and the ADIF flag is set in the Peripheral Interrupt register) and the 10- bit datum is placed in the ADRESH (ADRESult High) and ADRESL (ADRESult Low) registers ready for reading. The clock for the converter is set using the two ADCS bits in ADCON0 either from the main processor clock or from a separate oscillator. The ADCON1 register is used to configure the pins to be digital or analog and to choose an internal reference or external reference voltages. 37

38 ADCON1 has an AD ForMat bit to store the 10-bit outcome in two possible formats; namely: Left justified with the upper 8 bits in ADRESH which can be used as a plain 8-bit outcome. Right justified with the lower 8 bits in ADRESL and ADRESH holding the two upper bits with padded zeros. In this case the two RESult registers can be treated as a double-byte 10-bit value. 38

39 39

40 Week 8 (Chapter 12) Asynchronous serial data transmission sends each datum as a separate frame Line goes to logic 0 for one period to signal the start of the frame (START) The datum bits are then transmitted one bit at a time least significant first Line goes to logic 1 for one period to signal the end of the frame (STOP) Line then idles at logic 1 until the next START pulse For example, transmitting the letter E (h 45 or b ) Idle START LS bit MS bit STOP Idle 40

41 Concepts Baud rate is a measure of information flow rate. In simple systems this is the same as bit rate. Baud rate is conventionally 110, 300, 600, 1200, 2400, Bit period is 1/(Baud rate); e.g. 1/600 = 1.666ms. With a single Start and Stop bit there are ten bits in a frame. Thus at 600 baud, 60 characters per second are send at maximum. The receiver is set to the same nominal rate as the transmitter to avoid having to transmit the clock signal via a separate channel. The clocks can differ by no more than ±½ (±50%) of a bit period in the ten bits to avoid loss of synchronization; that is ±5% A Simplex channel can only transmit in one direction. A half Duplex channel can transmit in either direction but not simultaneously. full Duplex channel can transmit simultaneously in both directions. 41

42 Normal logic voltages not suitable for transmission distances above around 30cm. Signalling techniques are used to modify the two signals to give longer ranges and suit the transmission channel (e.g. tones are used for telephone and wireless links). RS-232 is one of the most common of these signal standards. Two bipolar voltage levels are used; with the positive voltage representing logic 0 and the negative voltage logic 1. At the transmitter levels of typically ±12V with respect to ground. The receiver can sense voltages down to ±3V with respect to ground. Used for distances up to 15m at low speed Rather poor noise immunity, especially if there is any difference in the ground voltages between transmitter and receiver. Not designed for network use, which needs multiple transmitters and receivers sharing the one line. 42

43 43

44 RS485 uses two conductors (instead of relying on the ground connections at remote points), usually twisted together. This is known as differential signalling as opposed to single-ended signalling where voltages are measured with respect to ground. Transmitter uses ±5V (when idling B wire is more positive than A wire) across the conductors to signal either logic level. Receiver can detect differences across the wires down to ±200mV Good noise immunity, as any externally induced noise will effect both conductors equally and the receiver is only interested in differences. Long distances at high speed are possible. Each transmitter has an enable input, so more than one driver can be connected to the link, provided that only one is enabled at any time. Multiple receivers can be connected to the link, giving with the above a network (LAN) capability. 44

45 45

46 Handshaking or flow control is the protocol used by the transmitter to determine if the receiver is ready to accept a character. For an asynchronous link there are basically two different techniques: Hardware: Where there is a separate connection between transmitter and receiver, often labelled /CTS (Clear To Send) and /RTS (Ready To Send) where the signals are active logic When ready to TX, transmitter (Master) activates its /RTS line. 2. Master then checks the /CTS line from receiver (Slave). If now active goto Transmit the character. Advantages; fast, reliable and simple. Disadvantages; Needs two extra wires or channels. 46

47 47

48 Software: Where special reserved characters are sent to the Master by the Slave indicating the latter s readiness to accept more information. These characters are usually named XON (code b or h 11 ) and XOFF (code b or h 13 ). Basically the Master keeps transmitting until and if the Slave sends back an XOFF character. It doesn t start up again until an XON character is received. 1. Master sends a character. 2. Has the Slave sent an XOFF character? If not then goto Do not goto 1 until an XON character is received. Advantage: Doesn t need two dedicated handshake channels. Disadvantages: Needs a Duplex link, not as reliable as a hardware scheme as can lock up of an XON or XOFF character is lost due to noise. 48

49 49

50 How to generate asynchronous protocol signals. In software using bit twiddling; e.g. to code a subroutine to transmit a single character (putchar) at 4800 baud: 1. Output a low on a port pin for one baud delay (1/4800 = 208µs) to give the Start bit. 2. DO eight times: a) Shift datum right and set pin high or low according to the state of the bit that pops out into the Carry flag. b) Wait one baud delay. 3. Output a high on the port pin for one baud delay to give the Stop bit. A receive (getchar) subroutine is similar but waits for the line connected to a port pin to go low and then uses a ½ baud delay to find the middle point of the Start bit. The signal is then sampled eight times at baud delay intervals. 50

51 In hardware using shift registers and logic circuitry. A dedicated circuit to do this is called a Universal Asynchonous Receiver/ Transmitter (UART). A Basic UART will have the following properties: Baud-rate generator (sometimes an external BRG needs to be used) to generate shifting pulses at the appropriate clock rate to suit the baud rate. Transmit Shift and Buffer registers to hold the datum being shifted out with a Start and Stop bit appended. Transmit Buffer Empty flag to say when the Transmit Buffer register is empty and so can be updated. Receive Shift and Buffer registers. Receive Buffer Full flag to say when a new character has been shifted in and dumped into the Buffer ready for collection. 51

52 52

53 To transmit a character: 1. Software checks the TBUF flag. If active try again until Buffer is empty. 2. Copy code into the Transmit Data Buffer Register. 3. When the actual Transmit Data Register is empty, this datum will be automatically transferred from the Buffer and the TBUF flag reset. 4. The datum is shifted out LSB first from the TX pin 5. after which a Start bit is sent and a Stop bit is appended at the end. To receive a character: 1. Software checks the RBUF flag to check if the Receive Data Buffer Register is full. If not active, try again. 2. Copy the new datum into an internal register. This will automatically deactivate the RBUF flag. 3. When another Start pulse is sensed at the RX pin, it is shifted in, the Start and Stop bits stripped and the datum copied into the Buffer and RBUF activated. 53

54 PIC USART module 54

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

NH-67, TRICHY MAIN ROAD, PULIYUR, C.F , KARUR DT. DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING COURSE MATERIAL

NH-67, TRICHY MAIN ROAD, PULIYUR, C.F , KARUR DT. DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING COURSE MATERIAL NH-67, TRICHY MAIN ROAD, PULIYUR, C.F. 639 114, KARUR DT. DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING COURSE MATERIAL Subject Name : Embedded System Class/Sem : BE (ECE) / VII Subject Code

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

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

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

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

DERTS Design Requirements (1): Microcontroller Architecture & Programming

DERTS Design Requirements (1): Microcontroller Architecture & Programming Lecture (5) DERTS Design Requirements (1): Microcontroller Architecture & Programming Prof. Kasim M. Al-Aubidy Philadelphia University 1 Lecture Outline: Features of microcomputers and microcontrollers.

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

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

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

CENG-336 Introduction to Embedded Systems Development. Timers

CENG-336 Introduction to Embedded Systems Development. Timers CENG-336 Introduction to Embedded Systems Development Timers Definitions A counter counts (possibly asynchronous) input pulses from an external signal A timer counts pulses of a fixed, known frequency

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

which means that writing to a port implies that the port pins are first read, then this value is modified and then written to the port data latch.

which means that writing to a port implies that the port pins are first read, then this value is modified and then written to the port data latch. Introduction to microprocessors Feisal Mohammed 3rd January 2001 Additional features 1 Input/Output Ports One of the features that differentiates a microcontroller from a microprocessor is the presence

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

Micro II and Embedded Systems

Micro II and Embedded Systems 16.480/552 Micro II and Embedded Systems Introduction to PIC Microcontroller Revised based on slides from WPI ECE2801 Moving Towards Embedded Hardware Typical components of a PC: x86 family microprocessor

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

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

Outline. Micriprocessor vs Microcontroller Introduction to PIC MCU PIC16F877 Hardware:

Outline. Micriprocessor vs Microcontroller Introduction to PIC MCU PIC16F877 Hardware: HCMIU - DEE Subject: ERTS RISC MCU Architecture PIC16F877 Hardware 1 Outline Micriprocessor vs Microcontroller Introduction to PIC MCU PIC16F877 Hardware: Program Memory Data memory organization: banks,

More information

1 Introduction to Computers and Computer Terminology Programs Memory Processor Data Sheet Example Application...

1 Introduction to Computers and Computer Terminology Programs Memory Processor Data Sheet Example Application... Overview of the PIC 16F648A Processor: Part 1 EE 361L Lab 2.1 Last update: August 19, 2011 Abstract: This report is the first of a three part series that discusses the features of the PIC 16F684A processor,

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

Chapter 10 Sections 1,2,9,10 Dr. Iyad Jafar

Chapter 10 Sections 1,2,9,10 Dr. Iyad Jafar Starting with Serial Chapter 10 Sections 1,2,9,10 Dr. Iyad Jafar Outline Introduction Synchronous Serial Communication Asynchronous Serial Communication Physical Limitations Overview of PIC 16 Series The

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

Learning Objectives:

Learning Objectives: Topic 5.2.1 PIC microcontrollers Learning Objectives: At the end of this topic you will be able to; Recall the architecture of a PIC microcontroller, consisting of CPU, clock, data memory, program memory

More information

ME 6405 Introduction to Mechatronics

ME 6405 Introduction to Mechatronics ME 6405 Introduction to Mechatronics Fall 2006 Instructor: Professor Charles Ume Microchip PIC Manufacturer Information: Company: Website: http://www.microchip.com Reasons for success: Became the hobbyist's

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

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

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

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

PIC16C84. 8-bit CMOS EEPROM Microcontroller PIC16C84. Pin Diagram. High Performance RISC CPU Features: CMOS Technology: Peripheral Features:

PIC16C84. 8-bit CMOS EEPROM Microcontroller PIC16C84. Pin Diagram. High Performance RISC CPU Features: CMOS Technology: Peripheral Features: 8-bit CMOS EEPROM Microcontroller High Performance RISC CPU Features: Only 35 single word instructions to learn All instructions single cycle (400 ns @ 10 MHz) except for program branches which are two-cycle

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

EE6008-Microcontroller Based System Design Department Of EEE/ DCE

EE6008-Microcontroller Based System Design Department Of EEE/ DCE UNIT- II INTERRUPTS AND TIMERS PART A 1. What are the interrupts available in PIC? (Jan 14) Interrupt Source Enabled by Completion Status External interrupt from INT INTE = 1 INTF = 1 TMR0 interrupt T0IE

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

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

Embedded systems. Exercise session 3. Microcontroller Programming Lab Preparation

Embedded systems. Exercise session 3. Microcontroller Programming Lab Preparation Embedded systems Exercise session 3 Microcontroller Programming Lab Preparation Communications Contact Mail : michael.fonder@ulg.ac.be Office : 1.82a, Montefiore Website for the exercise sessions and the

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

Laboratory Exercise 5 - Analog to Digital Conversion

Laboratory Exercise 5 - Analog to Digital Conversion Laboratory Exercise 5 - Analog to Digital Conversion The purpose of this lab is to control the blinking speed of an LED through the Analog to Digital Conversion (ADC) module on PIC16 by varying the input

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

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

EEE394 Microprocessor and Microcontroller Laboratory Lab #6

EEE394 Microprocessor and Microcontroller Laboratory Lab #6 Exp. No #6 Date: INTERRUPTS AND ADC IN PIC MICROCONTROLLER OBJECTIVE The purpose of the experiment is to configure external interrupt and the ADC in PIC microcontrollers. (i) To flip the LED connected

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

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

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING. EE Microcontroller Based System Design

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING. EE Microcontroller Based System Design DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING EE6008 - Microcontroller Based System Design UNIT III PERIPHERALS AND INTERFACING PART A 1. What is an

More information

1 Introduction to Computers and Computer Terminology Programs Memory Processor Data Sheet... 4

1 Introduction to Computers and Computer Terminology Programs Memory Processor Data Sheet... 4 Overview of the PIC 16F648A Processor: Part 1 EE 361L Lab 2.1 Last update: August 1, 2016 Abstract: This report is the first of a three part series that discusses the features of the PIC 16F648A processor,

More information

Understanding the basic building blocks of a microcontroller device in general. Knows the terminologies like embedded and external memory devices,

Understanding the basic building blocks of a microcontroller device in general. Knows the terminologies like embedded and external memory devices, Understanding the basic building blocks of a microcontroller device in general. Knows the terminologies like embedded and external memory devices, CISC and RISC processors etc. Knows the architecture and

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

PIC16F8X 18-pin Flash/EEPROM 8-Bit Microcontrollers

PIC16F8X 18-pin Flash/EEPROM 8-Bit Microcontrollers 18-pin Flash/EEPROM 8-Bit Microcontrollers Devices Included in this Data Sheet: PIC16F83 PIC16F84 PIC16CR83 PIC16CR84 Extended voltage range devices available (PIC16LF8X, PIC16LCR8X) High Performance RISC

More information

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

Section 13. Timer0 HIGHLIGHTS. Timer0. This section of the manual contains the following major topics: Section 13. Timer0 HIGHLIGHTS This section of the manual contains the following major topics: 13.1 Introduction... 13-2 13.2 Control Register... 13-3 13.3 Operation... 13-4 13.4 Timer0 Interrupt... 13-5

More information

ALU and Arithmetic Operations

ALU and Arithmetic Operations EE25M Introduction to microprocessors original author: Feisal Mohammed updated: 6th February 2002 CLR Part IV ALU and Arithmetic Operations There are several issues connected with the use of arithmetic

More information

M PIC16F84A. 18-pinEnhanced FLASH/EEPROM 8-Bit Microcontroller. High Performance RISC CPU Features: Pin Diagrams. Peripheral Features:

M PIC16F84A. 18-pinEnhanced FLASH/EEPROM 8-Bit Microcontroller. High Performance RISC CPU Features: Pin Diagrams. Peripheral Features: M PIC6F84A 8-pinEnhanced FLASH/EEPROM 8-Bit Microcontroller High Performance RISC CPU Features: Pin Diagrams Only 35 single word instructions to learn All instructions single-cycle except for program branches

More information

Mod-5: PIC 18 Introduction 1. Module 5

Mod-5: PIC 18 Introduction 1. Module 5 Mod-5: PIC 18 Introduction 1 Module 5 Contents: Overview of PIC 18, memory organisation, CPU, registers, pipelining, instruction format, addressing modes, instruction set, interrupts, interrupt operation,

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

PIC16F8X. 8-Bit CMOS Flash/EEPROM Microcontrollers PIC16F8X PIC16CR8X. Pin Diagram. Devices Included in this Data Sheet:

PIC16F8X. 8-Bit CMOS Flash/EEPROM Microcontrollers PIC16F8X PIC16CR8X. Pin Diagram. Devices Included in this Data Sheet: This document was created with FrameMaker 404 PIC16F8X 8-Bit CMOS Flash/EEPROM Microcontrollers Devices Included in this Data Sheet: PIC16F83 PIC16CR83 PIC16F84 PIC16CR84 Extended voltage range devices

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

16.317: Microprocessor Systems Design I Fall Exam 3 December 15, Name: ID #:

16.317: Microprocessor Systems Design I Fall Exam 3 December 15, Name: ID #: 16.317: Microprocessor Systems Design I Fall 2014 Exam 3 December 15, 2014 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

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

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

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

ME 515 Mechatronics. A microprocessor

ME 515 Mechatronics. A microprocessor ME 515 Mechatronics Microcontroller Based Control of Mechanical Systems Asanga Ratnaweera Department of Faculty of Engineering University of Peradeniya Tel: 081239 (3627) Email: asangar@pdn.ac.lk A microprocessor

More information

PIC16C432 OTP 8-Bit CMOS MCU with LIN bus Transceiver

PIC16C432 OTP 8-Bit CMOS MCU with LIN bus Transceiver OTP 8-Bit CMOS MCU with LIN bus Transceiver Devices included in this Data Sheet: High Performance RISC CPU: Only 35 instructions to learn All single cycle instructions (200 ns), except for program branches

More information

MPLAB SIM. MPLAB IDE Software Simulation Engine Microchip Technology Incorporated MPLAB SIM Software Simulation Engine

MPLAB SIM. MPLAB IDE Software Simulation Engine Microchip Technology Incorporated MPLAB SIM Software Simulation Engine MPLAB SIM MPLAB IDE Software Simulation Engine 2004 Microchip Technology Incorporated MPLAB SIM Software Simulation Engine Slide 1 Welcome to this web seminar on MPLAB SIM, the software simulator that

More information

PART TWO LISTING 8 PROGRAM TK3TUT8 MOVF PORTA,W ANDLW B ADDWF COUNT,F MOVF COUNT,W MOVWF PORTB GOTO LOOP

PART TWO LISTING 8 PROGRAM TK3TUT8 MOVF PORTA,W ANDLW B ADDWF COUNT,F MOVF COUNT,W MOVWF PORTB GOTO LOOP EPE PIC TUTORIAL V2 JOHN BECKER PART TWO Quite simply the easiest low-cost way to learn about using PIC Microcontrollers! EPE PIC TUTORIAL In this part we play with switches, make noises, count times,

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

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

Introduction. Embedded system functionality aspects. Processing. Storage. Communication. Transformation of data Implemented using processors

Introduction. Embedded system functionality aspects. Processing. Storage. Communication. Transformation of data Implemented using processors Input/Output 1 Introduction Embedded system functionality aspects Processing Transformation of data Implemented using processors Storage Retention of data Implemented using memory Communication Transfer

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

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

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

DRPIC166X IP Core. High Performance 8-bit RISC Microcontroller v. 2.17

DRPIC166X IP Core. High Performance 8-bit RISC Microcontroller v. 2.17 2017 DRPIC166X IP Core High Performance 8-bit RISC Microcontroller v. 2.17 C O M P A N Y O V E R V I E W Digital Core Design is a leading IP Core provider and a System-on-Chip design house. The company

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

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

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 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

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

Laboratory 10. Programming a PIC Microcontroller - Part II

Laboratory 10. Programming a PIC Microcontroller - Part II Laboratory 10 Programming a PIC Microcontroller - Part II Required Components: 1 PIC16F88 18P-DIP microcontroller 1 0.1 F capacitor 3 SPST microswitches or NO buttons 4 1k resistors 1 MAN 6910 or LTD-482EC

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

Embedded Systems Design (630470) Lecture 4. Memory Organization. Prof. Kasim M. Al-Aubidy Computer Eng. Dept.

Embedded Systems Design (630470) Lecture 4. Memory Organization. Prof. Kasim M. Al-Aubidy Computer Eng. Dept. Embedded Systems Design (630470) Lecture 4 Memory Organization Prof. Kasim M. Al-Aubidy Computer Eng. Dept. Memory Organization: PIC16F84 has two separate memory blocks, for data and for program. EEPROM

More information

THE UNIVERSITY OF THE WEST INDIES

THE UNIVERSITY OF THE WEST INDIES THE UNIVERSITY OF THE WEST INDIES EXAMINATIONS OF MOCK 2004 Code and Name of Course: EE25M Introduction to Microprocessors Paper: Date and Time: Duration: Three Hours INSTRUCTIONS TO CANDIDATES: This paper

More information

Explanation of PIC 16F84A processor data sheet Part 1: overview of the basics

Explanation of PIC 16F84A processor data sheet Part 1: overview of the basics Explanation of PIC 16F84A processor data sheet Part 1: overview of the basics This report is the first of a three part series that discusses the features of the PIC 16F94A processor. The reports will refer

More information

Mechatronics and Measurement. Lecturer:Dung-An Wang Lecture 6

Mechatronics and Measurement. Lecturer:Dung-An Wang Lecture 6 Mechatronics and Measurement Lecturer:Dung-An Wang Lecture 6 Lecture outline Reading:Ch7 of text Today s lecture: Microcontroller 2 7.1 MICROPROCESSORS Hardware solution: consists of a selection of specific

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

Embedded Systems. PIC16F84A Internal Architecture. Eng. Anis Nazer First Semester

Embedded Systems. PIC16F84A Internal Architecture. Eng. Anis Nazer First Semester Embedded Systems PIC16F84A Internal Architecture Eng. Anis Nazer First Semester 2017-2018 Review Computer system basic components? CPU? Memory? I/O? buses? Instruction? Program? Instruction set? CISC,

More information

PIC Microcontroller Introduction

PIC Microcontroller Introduction PIC Microcontroller Introduction The real name of this microcontroller is PICmicro (Peripheral Interface Controller), but it is better known as PIC. Its first ancestor was designed in 1975 by General Instruments.

More information

Introduction to Embedded Systems

Introduction to Embedded Systems Stefan Kowalewski, 4. November 25 Introduction to Embedded Systems Part 2: Microcontrollers. Basics 2. Structure/elements 3. Digital I/O 4. Interrupts 5. Timers/Counters Introduction to Embedded Systems

More information

The University of Texas at Arlington Lecture 7

The University of Texas at Arlington Lecture 7 The University of Texas at Arlington Lecture 7 CSE 3442/5442 Agenda HW 2 due today Begin Chapter 5 In class assignment. Reading Assignment for Tuesday, Continue Reading Chapter 6. Assignment 3 and 4 due

More information