Embedded systems. chapter 7

Size: px
Start display at page:

Download "Embedded systems. chapter 7"

Transcription

1 Embedded systems chapter 7

2 Embedded systems definition Embedded systems can be defined as systems that: directly control some hardware designed to a specific task only we will consider that an Embedded systems is a computer system designed for specific control functions possibly within a larger system So when designing Embedded systems it must be decided what is implemented by: hardware software It is common, but not required, that Embedded systems have real time computing constraints 20-Apr-14 Real Time Systems - Helder Daniel 2

3 Embedded systems complexity Embedded systems complexity depend on its purpose: Simple Embedded systems can have only one processor or microcontroller Complex Embedded systems can have several processors, DSPs, microcontrollers, analogue or digital interfaces and even peripherals They can be portable devices: Digital watches, Media players (MP3, MP4) or large unmovable devices like traffic light controllers, factory controllers The key characteristic that defines and Embedded system is that they are designed to handle a specific task only 20-Apr-14 Sistemas de tempo real - Helder Daniel 3

4 Embedded systems examples Some car systems (ECUs): ignition control, suspension, Some avionics (aircraft control systems) Medical equipment Portable navigation systems like GPS Media Players, video cameras, remote controllers Network routers, modems, printers, video subsystem (embedded in a larger computational system) Although some times cited as example of Embedded systems, today Mobile phones models are NOT designed to a single task (make phone calls) They can be used as all purpose computing systems, so they are NOT embedded systems. 20-Apr-14 Real Time Systems - Helder Daniel 4

5 Intro to Embedded system design I Embedded systems have a specific purpose Low cost systems can be designed to accomplish this specific purpose (we do not need an all purpose PC to control a micro-wave oven) Designers can take advantage of the sole purpose to develop a low cost system, yet fulfilling specifications, such as: Reliability Temporal constrains (real time or NOT) Physical dimensions Power consumption deciding which functions are implemented by hardware or by software 20-Apr-14 Sistemas de tempo real - Helder Daniel 5

6 Intro to Embedded system design II Specific hardware can be designed or the system can be assembled from components available in the market: Microcontrollers, DSPs, FPGAs, Memory, Some low cost small boards have a microprocessor (up) or a microcontroller (uc) assembled with some memory and some I/O capabilities (to be connect to other parts, or to control some hardware) Normally the cost grows with the complexity Choosing the parts required depends on the purpose and specifications for some embedded system 20-Apr-14 Sistemas de tempo real - Helder Daniel 6

7 Intro to Embedded system design III Developing software for some boards that include a processor can be done in an all purpose PC with a Software Development Kit, eg: For PIC uc based boards can be used the MPLAB IDE For boards running Android can be used Eclipse IDE with ADT plugin These kits includes tools like: cross-compiler (compile in the PC code to run in the hardware of the board) Emulator, simulator, debugger, After tested the code can be uploaded and ran in the board 20-Apr-14 Sistemas de tempo real - Helder Daniel 7

8 Intro to Embedded system design IV Programming languages commonly used: C/C++ Ada Java (commonly used with android) Assembly VHDL (FPGAs) Depending on the system and the library or framework used Assembly may be the only option to access some hardware functions Assembly can be embedded inside C/C++ or ADA code 20-Apr-14 Sistemas de tempo real - Helder Daniel 8

9 Intro to Embedded system design V In this chapter we will briefly address some tools and hardware that can be used to design and develop real time and embedded systems we will briefly address Microcontrollers (PIC) Android devices and finally some system modelling techniques 20-Apr-14 Sistemas de tempo real - Helder Daniel 9

10 Choosing a CPU When choosing the hardware for an embedded system, an important decision is the CPU Factors of choice may be: CPU have enough performance for the specifications CPU power consumption CPU supports the required operating system Software development tools available Processor classes that can be chosen: Microprocessors Microcontrollers DSPS 20-Apr-14 Sistemas de tempo real - Helder Daniel 10

11 Choosing a CPU: Microcontrollers and DSPs Normally microprocessors (ups) have in the chip only the core(s) (which might include FPU(S) or NOT) Microcontrollers (ucs) can have more devices in the chip, such as analogue and/or digital interfaces or other I/O capabilities and devices This way there is no need for extra chips (like I/O chips) This may reduce system cost and since signals do not need to cross the board More efficient More reliable DSPs, besides being designed for fast signal processing, may have in the chip some I/O devices too 20-Apr-14 Sistemas de tempo real - Helder Daniel 11

12 Choosing a CPU: Microcontrollers Microcontrollers and DSPs can be: very simple or very complex Microcontrollers can be specially designed (such as PIC family) or based on common microprocessors core (such as Motorola 68k based microcontrollers) The decision on which microcontroller to use depends on project requirements The huge variety of microcontroller families allows the designers to choose a suitable microcontroller balancing performance/cost as required 20-Apr-14 Sistemas de tempo real - Helder Daniel 12

13 Choosing a CPU: FPGAs Additionally some functions can be implemented in programmable hardware like: FPGAs FPGAs (Field-Programmable Gate Arrays) contain programmable logic components: logic blocks logic blocks can be programmed to implement logical gates and wired according to the requirements, thus implementing logic functions This devices are programmed by an Hardware Description Language such as VHDL With FPGAs even soft processors can be implemented like: MicroBlaze is a 32-bit RISC soft processor core designed for Xilinx FPGAs Nios II is a 32-bit RISC soft core architecture implemented entirely in the programmable logic and memory blocks of Altera FPGAs 20-Apr-14 Sistemas de tempo real - Helder Daniel 13

14 PIC Microcontroller I When designing embedded and real time systems, many times the choice of the CPU fall on microcontrollers (Or microcontrollers along with other devices, such as FPGAs) The Microchip Technology Inc., PIC (Peripheral Interface Controller) family have a wide range of microcontrollers, with different features (and different costs): Main differences are: Devices integrated in the chip On chip Data memory length On chip Program memory length Number of I/O lines (digital interface) and Input lines (analogue interface) Interrupt lines and number of interrupt vectors (entries in interrupt vector table)) Depending on the requirements a suitable microcontroller can be chosen from this family 20-Apr-14 Sistemas de tempo real - Helder Daniel 14

15 PIC Microcontroller II PIC microcontrollers are grouped by sub-families: PIC10XX, PIC12XX, PIC16XX, PIC17XX, PIC18XX PIC24 (16 bit) dspic (some DSP capabilities: hardware MAC multiply and accumulate: a = a + (b * c) PIC32 (32 bit) Some general features: Separate code and data buses (Harvard architecture) for devices other than PIC32 A small number of fixed length instructions (RISC like) 1 clock cycle instructions (2 cycles, or 4 cycles in 8-bit models) with exception of one delay cycle on branches and skips Sleep mode (for power saving) Watchdog timer Digital I/O lines or/and analogue input lines 20-Apr-14 Sistemas de tempo real - Helder Daniel 15

16 PIC Microcontroller III I/O Digital Port A I/O Digital Port A Analogue Input Port: AN0 - AN4 I/O Digital Port B I/O Digital Port B Analogue Input Port: AN5 - AN6 20-Apr-14 Sistemas de tempo real - Helder Daniel 16

17 PIC Microcontroller IV 1 Digital I/O ports 6 lines (Port A) 1 Digital I/O ports 3 lines (Port E) 1 Digital Analogue input Port 8 lines (across Port A and E) 3 Digital I/O ports 8 lines (Port B, C, D) Some port lines can be used to connect other signals such as external interrupt source or clocks 20-Apr-14 Sistemas de tempo real - Helder Daniel 17

18 PIC Microcontroller V Through digital or analogue lines the microcontroller can communicate and control devices or peripherals In PIC family this lines are connected to on chip Digital I/O interfaces or Analogue input interfaces This lines are grouped in I/O digital ports and input analogue ports (Not to be confused with I/O ports: a separate address space in CPU families such as x86 where peripheral registers can be mapped) In fact in x86 access to digital or analogue interface registers can be made through I/O ports In PIC access to these ports is made by specific registers Let s see how digital I/O ports can be accessed using as example a PIC16C55 20-Apr-14 Sistemas de tempo real - Helder Daniel 18

19 PIC Microcontroller VI PIC16C55 has 3 digital I/O ports Each port as 2 registers (eg. port C): data register (PORTC) direction register (TRISC) Direction register can be used to set the direction of each line in the port: 1 - input 0 - output For digital I/O port C (8 lines) each register has 8 bits Data register PORTC Direction register TRISC Digital I/O port C 20-Apr-14 Sistemas de tempo real - Helder Daniel 19

20 PIC Microcontroller VII PIC16C55 has 512 bytes on chip memory for programs (PIC16C57 has 2048) has some special registers and 25 all purpose registers (this is data memory) TRISX and PORTX registers can be mapped in on data chip memory: PORTA: 0x05 PORTB: 0x06 PORTC: 0x07 ( ) TRISA: 0x085 TRISB: 0x086 TRISC: 0x087 (NOT mapped on pic16c55) Different PICs can have different registers and different memory mappings Data register PORTC Direction register TRISC Digital I/O port C 20-Apr-14 Sistemas de tempo real - Helder Daniel 20

21 Program memory Two level stack Data memory: PIC16C5X block diagram Digital I/O ports 20-Apr-14 21

22 Special registers PIC16C5X program and data memory (registers) Data memory map General purpose registers (F registers) 20-Apr-14 Sistemas de tempo real - Helder Daniel 22

23 PIC digital I/O ports I Let s see an example of using digital I/O ports, a program that: 1) sets lines (pins) 7-4 of digital I/O port C for input and lines 3-0 to output 2) reads input from PORTC lines 7-4 3) inverts bits (NOT) 4) writes inverted bits to PORTC lines 3-0. A few notes: When the user writes a value to a port, all 8 bits are modified at the same time. However only the bits configured as outputs make it to the outside world. If willing to turn just a single line on or off, writing a value to the port will cause all outputs to change, not just the one the user is interested in (to change individual lines bitwise operations can be used over the previous port value) 20-Apr-14 Sistemas de tempo real - Helder Daniel 23

24 PIC digital I/O ports II Let s first see how this is done near the hardware in assembly to understand the PIC operation, and then we will see how to do it in C First we need to set port C input (7-4) and output line (3-0) This is done by setting the corresponding bit in TRISC register to 1 for input and to 0 for output However TRIS registers can not be accessed directly, even with assembler in PIC16C55 A value must be written in the special register W (an accumulator) and then transferred for the corresponding TRIS register with a tris instruction (2 cycles) SET_C equ b' ' ; port C input and output lines movlw SET_C ; copy TRIS_SET constant to W register tris PORTC ; copy W register to TRISC register 20-Apr-14 Sistemas de tempo real - Helder Daniel 24

25 PIC digital I/O ports III Now we must read port C 4 MSBits, the input lines (actually we have to read all bits) to a working register to manipulate data before sending out and invert the 4 MSBits (actually we have to invert all bits) But remember PIC is a RISK (like) processor so instruction set is reduced Port registers data can only be transferred to W register there is no NOT (or complement) operation for W register (there is for F registers) (We can XOR the contents of W register with 1s. This has the same effect of a NOT) PortC: 1010XXXX W: 1010XXXX 0101XXXX movf PORTC, W ; copy PORTC register to W register xorlw b ; NOT W 20-Apr-14 Sistemas de tempo real - Helder Daniel 25

26 PIC digital I/O ports IV Finally we need to move the inverted 4 MSbits to the 4 LSbits of I/O Port C (the output lines) But not all operations are possible with the W register (like swap nibbles) So we have to copy data to a general purpose (file) register f (Different PICs have a different number of f registers. Let s assume register f0a is available) portcvalue equ d'10 ; register f0a PortC: XXXX0101 W: 0101XXXX XXXX0101 movwf portcvalue ; copy W register to f0a register swapf portcvalue, W ; swap 4 MSbits with 4 Lsbits, leave ; result in W register ; could also be done with 4 RRF ; instructions movwf PORTC ; copy W register to PORTC register ; only output lines are affected f0a: 1010XXXX 20-Apr-14 Sistemas de tempo real - Helder Daniel 26

27 PIC digital I/O ports V Finally we need to move the inverted 4 MSbits to the 4 LSbits of I/O Port C (the output lines) But not all operations are possible with the W register (like rotate bits) So we have to copy data to a general purpose (file) register f (Different PICs have a different number of f registers. Let s assume register f0a is available) portcvalue equ d'10 ; register f0a PortC: XXXX0101 W: 0101XXXX XXXX0101 movwf portcvalue ; copy W register to f0a register RRF portcvalue, F ; rotate bits to the right RRF portcvalue, F ; 4 times RRF portcvalue, F ; RRF portcvalue, W ; leave result in W register movwf PORTC ; copy W register to PORTC register ; only output lines are affected f0a: 1010XXXX X1010XXX XX1010XX XXX1010X 20-Apr-14 Sistemas de tempo real - Helder Daniel 27

28 PIC digital I/O ports IVa The complete assembler program: SET_C equ b' ' ; port C input and output lines portcvalue equ d'10' ; register f0a start movlw SET_C ; Set Port C I/O lines direction tris PORTC movf PORTC, W ; read Port C xorlw b' ' ; Invert bits (NOT) movwf portcvalue swapf portcvalue, W ; swap 4 Msbits with 4 LSbits movwf PORTC ; send inverted bits to Port C 4 LSbits 20-Apr-14 Sistemas de tempo real - Helder Daniel 28

29 PIC digital I/O ports IVb The complete assembler program (alternate version, same Ci): SET_C equ b' ' ; port C input and output lines portcvalue equ d'10' ; register f0a start movlw SET_C ; Set Port C I/O lines direction tris PORTC movf PORTC, W ; read Port C movwf portcvalue comf portcvalue, F ; Invert bits (NOT) swapf portcvalue, W ; swap 4 Msbits with 4 LSbits movwf PORTC ; send inverted bits to Port C 4 LSbits 20-Apr-14 Sistemas de tempo real - Helder Daniel 29

30 PIC digital I/O ports VII In C it is not possible to access directly the PIC registers (It is however possible to embed assembler code in C code to do the trick) However since PORT and TRIS registers are mapped in data memory we can access these registers trough memory Since port C registers are mapped in: PORTC = 0x07 and TRISC = 0x87 We can define some macros to do the trick: volatile unsigned char *PORTCadr = 0x07 #define PORTC (* PORTCadr) volatile unsigned char *TRISCadr = 0x87 #define PORTC (* TRISCadr) 20-Apr-14 Sistemas de tempo real - Helder Daniel 30

31 PIC digital I/O ports VIII Now when found on C code: PORTC = 0x22; C pre-processor expands it to: when found : (* PORTCadr) = 0x22; //write value: 0x22 to data memory location: 0x07 unsigned char c = PORTC; It is expanded to: unsigned char c = (* PORTCadr); //read value at data memory location: //0x07 into c variable 20-Apr-14 Sistemas de tempo real - Helder Daniel 31

32 PIC digital I/O ports IX If Port registers are not mapped in data memory a special C may be used to locate them in the register file (data memory): volatile unsigned char 0x06; volatile control unsigned char 0x06; Note the special keyword control to indicate control register TRIS for PortB (at 0x06) Now when found: TRISB = 0xF0; //set Port B I/O lines direction Compiler (for PIC16C55) generates assembler code: MOVLW 0xF0 TRIS 0x06 Code generated for: PORTB = 0x22 is equal to previous slide 20-Apr-14 Sistemas de tempo real - Helder Daniel 32

33 PIC digital I/O ports X Now using this macros we can access port C: main () { unsigned char portcvalue; } TRISC = 0xF0; portcvalue = PORTC; portcvalue = ~ portcvalue; portcvalue = portcvalue>>4; PORTC = portcvalue ; //Set port C input and output lines //set PORTC bits 7-4 to input //3-0 to output, in binary: //read PORTC only 4 MSBits are //meaningful //invert bits (NOT) //shift to put value in output pins //write PORTC, only 4 LSBits are //outputted 20-Apr-14 Sistemas de tempo real - Helder Daniel 33

34 PIC digital I/O ports XI However register mapping can be different in different PIC versions So it is better to rely on the C compiler: C compilers, like Hi-Tech C, provide global variables to access registers: PORTA, TRISA, PORTB, TRISB, just include: #include <pic.h> //or <htc.h> for Hi-Tech C compiler the header for the PIC version (eg. <pic16c55.h>) is automatically loaded if defined in a MPLAB IDE project MPLAB IDE (or MPLAB IDE X) and simulator can be set to compile and simulate a specific PIC version, let s see a bit of this IDE Id=1406&dDocName=en019469&part=SW Apr-14 Sistemas de tempo real - Helder Daniel 34

35 PIC MPLAB IDE I 20-Apr-14 Sistemas de tempo real - Helder Daniel 35

36 PIC MPLAB IDE II Besides watches for register contents and variables while debugging the simulator as other features such as timing a segment of code to find (Ci): In this example the whole program takes 34 cycles (at 20 MHz clock -> 6.8 micro secs) (slower than the assembler implementation, cause rotate was implemented with a loop, a general solution for code like: variable >> n) 20-Apr-14 Sistemas de tempo real - Helder Daniel 36

37 PIC MPLAB IDE III In order to test the application on the simulator, signals can be applied to pins This stimulus can be edited in a stimulus Dialog (and saved to a file) While Dialog Open the stimulus defined are applied to the simulator In this example Port C Pins 7 and 6 are set to 1 at cycle 0 (others to 0) (so when previous example program ends Port C pin 0 and 1 are also 1 in hexa at the start Port C have value 0xC0 and at the end: 0xC3) Note: Stimulus can be applied to individual pins or to a whole port in hexadecimal (in the example all PortA pins are set to 1) 20-Apr-14 Sistemas de tempo real - Helder Daniel 37

38 PIC MPLAB IDE IV Stimulus can also be set periodically In this example PortB pin 0 will start high during 10 cycles, then low during the next 10 cycles This behaviour will be repeated in each 20 cycle period 20-Apr-14 Sistemas de tempo real - Helder Daniel 38

39 Practical cases We have seen just a brief overview of PIC microcontroller family yet only with this info we can implement some real life projects We will address briefly two examples: Vending machine logic 7 segment BCD display 20-Apr-14 Sistemas de tempo real - Helder Daniel 39

40 Vending machine I A vending machine logic can be implemented with a microcontroller In this very simple example the vending machine just releases one product when 1,50 were inserted uc digital I/O ports are connected to the coin identifying mechanism (inputs: fifty and hundred) uc digital I/O ports are connected to product release mechanism (or drawer) and the change release mechanism (outputs: open and change) Coin id mechanism fifty (RA0) hundred (RA1) reset clock FSM (Pic) open (RB0) change (RB1) Product release mechanism change release mechanism 20-Apr-14 Sistemas de tempo real - Helder Daniel 40

41 Vending machine II Allowed coins are only 50 cents and 1 Euro There are several ways to insert 1,50 (150 cents) with these two coins: (50 cents change) (50 cents change) The Finite State Machine (FSM) is at the right A simplified C implementation of the FSM is in the next slide (no timing issues) 20-Apr-14 Sistemas de tempo real - Helder Daniel 41

42 Vending machine III #include <pic.h> //FSM states enum FSMstate { s00, s50, s100, s150, s200 } state; //Input and output lines #define fifty (PORTA & 0x01) //RA0 #define hundred (PORTA & 0x02) //RA1 #define open (PORTB = 0x01) //RB0 #define openchange (PORTB = 0x03) //RB0 & RB1 int main(int argc, char** argv) { TRISA = 0xFF; //Set all port A lines for input TRISB = 0x00; //Set all port B lines for output state = s00; //reset 20-Apr-14 Sistemas de tempo real - Helder Daniel 42

43 Vending machine IV //FSM implementation while(1) { //wait next period //(can be done using a timer) switch (state) { case s00 : if (fifty) state=s50; else if (hundred) state=s100; break; case s50 : if (fifty) state=s100; else if (hundred) state=s150; break; case s100 : if (fifty) state=s150; else if (hundred) state=s200; break; case s150 : open; state=s00; break; case s200 : openchange; state=s00; break; } } return (EXIT_SUCCESS); } 20-Apr-14 Sistemas de tempo real - Helder Daniel 43

44 7 segment display I BCD inputs (PortA) segment outputs (Port C) RA3 RA2 RA1 RA0 RC6 RC5 RC4 RC3 RC2 RC1 RC0 Hex Fh h Bh Fh h Dh Ch h Fh h display 20-Apr-14 Sistemas de tempo real - Helder Daniel 44

45 7 segment display II #include <pic.h> //7 segment BCD display lookup table //C compiler stores it in a set of f registers unsigned char bcd7[] = { 0x3F, 0x05, 0x5B, 0x4F, 0x66, 0x6D, 0x7C, 0x07, 0x8F, 0x67 }; int main(int argc, char** argv) { unsigned char Alsb; TRISA = 0xFF; TRISC = 0x00; //Set all port A lines for input //Set all port C lines for output Alsb = PORTA & 0x0F; //read port A 4 LSBits (BCD digit) PORTC = bcd7[alsb]; //set display (indirect addressing) } return (EXIT_SUCCESS); 20-Apr-14 Sistemas de tempo real - Helder Daniel 45

46 7 segment display III What if lookup table can not fit in the available registers? (pic16c55 data memory is only 25 general purpose F registers to store all variables) //7 segment BCD display lookup table unsigned char bcd7[] = { 0x3F, 0x05, 0x5B, 0x4F, 0x66, 0x6D, 0x7C, 0x07, 0x8F, 0x67 }; The lookup table can be implemented in program memory as a function returning a value depending on the argument: //PRE: idx >= 0 && idx <= 9 unsigned char lookup (unsigned char idx) { switch (idx) { case 0: return 0x3F; case 1: return 0x05; // default : return 00; //Not really needed since Pre-condition } //specifies argument range, but... } 20-Apr-14 Sistemas de tempo real - Helder Daniel 46

47 unsigned char bcd7(unsigned char idx) { 005 BB0 GOTO 0x1b0 1B0 029 MOVWF 0x9 switch (idx) { 1B1 BDE GOTO 0x1de 1DE 209 MOVF 0x9, W 1DF F00 XORLW 0 1E0 643 BTFSC 0x3, 0x2 1E1 BB2 GOTO 0x1b2 1E2 F01 XORLW 0x1 1E3 643 BTFSC 0x3, 0x2 1E4 BB6 GOTO 0x1b6 1E5 F03 XORLW 0x3 1E6 643 BTFSC 0x3, 0x2 1E7 BBA GOTO 0x1ba 1E8 F01 XORLW 0x1 1E9 643 BTFSC 0x3, 0x2 1EA BBE GOTO 0x1be 1EB F07 XORLW 0x7 1EC 643 BTFSC 0x3, 0x2 1ED BC2 GOTO 0x1c2 1EE F01 XORLW 0x1 1EF 643 BTFSC 0x3, 0x2 1F0 BC6 GOTO 0x1c6 1F1 F03 XORLW 0x3 1F2 643 BTFSC 0x3, 0x2 1F3 BCA GOTO 0x1ca 1F4 F01 XORLW 0x1 1F5 643 BTFSC 0x3, 0x2 1F6 BCE GOTO 0x1ce 1F7 F0F XORLW 0xf 1F8 643 BTFSC 0x3, 0x2 7 segment display IV 1F9 BD2 GOTO 0x1d2 1FA F01 XORLW 0x1 1FB 643 BTFSC 0x3, 0x2 1FC BD6 GOTO 0x1d6 1FD BDA GOTO 0x1da 34: case 0: return 0x3F; 1B2 C3F MOVLW 0x3f 1B3 028 MOVWF 0x8 1B4 BFE GOTO 0x1fe 1B5 BFE GOTO 0x1fe ; cases 1 to 9 44: default : return 0; 1DA 068 CLRF 0x8 1DB BFE GOTO 0x1fe 1DC BFE GOTO 0x1fe ; end function 45: } 1DD BFE GOTO 0x1fe 46: } 1FE 800 RETLW 0 This the assembly code compiled by free Hi-Tech C lite compiler Functions introduces some overhead 2 instructions to get function argument Since jumps take 2 cycles this 2 instructions take 3 cycles 20-Apr-14 Sistemas de tempo real - Helder Daniel 47

48 unsigned char bcd7(unsigned char idx) { 005 BB0 GOTO 0x1b0 1B0 029 MOVWF 0x9 switch (idx) { 1B1 BDE GOTO 0x1de 1DE 209 MOVF 0x9, W 1DF F00 XORLW 0 1E0 643 BTFSC 0x3, 0x2 1E1 BB2 GOTO 0x1b2 1E2 F01 XORLW 0x1 1E3 643 BTFSC 0x3, 0x2 1E4 BB6 GOTO 0x1b6 1E5 F03 XORLW 0x3 1E6 643 BTFSC 0x3, 0x2 1E7 BBA GOTO 0x1ba 1E8 F01 XORLW 0x1 1E9 643 BTFSC 0x3, 0x2 1EA BBE GOTO 0x1be 1EB F07 XORLW 0x7 1EC 643 BTFSC 0x3, 0x2 1ED BC2 GOTO 0x1c2 1EE F01 XORLW 0x1 1EF 643 BTFSC 0x3, 0x2 1F0 BC6 GOTO 0x1c6 1F1 F03 XORLW 0x3 1F2 643 BTFSC 0x3, 0x2 1F3 BCA GOTO 0x1ca 1F4 F01 XORLW 0x1 1F5 643 BTFSC 0x3, 0x2 1F6 BCE GOTO 0x1ce 1F7 F0F XORLW 0xf 1F8 643 BTFSC 0x3, 0x2 7 segment display IV 1F9 BD2 GOTO 0x1d2 1FA F01 XORLW 0x1 1FB 643 BTFSC 0x3, 0x2 1FC BD6 GOTO 0x1d6 1FD BDA GOTO 0x1da 34: case 0: return 0x3F; 1B2 C3F MOVLW 0x3f 1B3 028 MOVWF 0x8 1B4 BFE GOTO 0x1fe 1B5 BFE GOTO 0x1fe ; cases 1 to 9 44: default : return 0; 1DA 068 CLRF 0x8 1DB BFE GOTO 0x1fe 1DC BFE GOTO 0x1fe ; end function 45: } 1DD BFE GOTO 0x1fe 46: } 1FE 800 RETLW 0 Also there is an extra goto to the next instruction Free compilers do not optimize much the code Hi-tech C Pro generates code 40% smaller (which may be faster) than Hi- Tech C lite (the free version) 20-Apr-14 Sistemas de tempo real - Helder Daniel 48

49 unsigned char bcd7(unsigned char idx) { 005 BB0 GOTO 0x1b0 1B0 029 MOVWF 0x9 switch (idx) { 1B1 BDE GOTO 0x1de 1DE 209 MOVF 0x9, W 1DF F00 XORLW 0 1E0 643 BTFSC 0x3, 0x2 1E1 BB2 GOTO 0x1b2 1E2 F01 XORLW 0x1 1E3 643 BTFSC 0x3, 0x2 1E4 BB6 GOTO 0x1b6 1E5 F03 XORLW 0x3 1E6 643 BTFSC 0x3, 0x2 1E7 BBA GOTO 0x1ba 1E8 F01 XORLW 0x1 1E9 643 BTFSC 0x3, 0x2 1EA BBE GOTO 0x1be 1EB F07 XORLW 0x7 1EC 643 BTFSC 0x3, 0x2 1ED BC2 GOTO 0x1c2 1EE F01 XORLW 0x1 1EF 643 BTFSC 0x3, 0x2 1F0 BC6 GOTO 0x1c6 1F1 F03 XORLW 0x3 1F2 643 BTFSC 0x3, 0x2 1F3 BCA GOTO 0x1ca 1F4 F01 XORLW 0x1 1F5 643 BTFSC 0x3, 0x2 1F6 BCE GOTO 0x1ce 1F7 F0F XORLW 0xf 1F8 643 BTFSC 0x3, 0x2 7 segment display IV 1F9 BD2 GOTO 0x1d2 1FA F01 XORLW 0x1 1FB 643 BTFSC 0x3, 0x2 1FC BD6 GOTO 0x1d6 1FD BDA GOTO 0x1da 34: case 0: return 0x3F; 1B2 C3F MOVLW 0x3f 1B3 028 MOVWF 0x8 1B4 BFE GOTO 0x1fe 1B5 BFE GOTO 0x1fe ; cases 1 to 9 44: default : return 0; 1DA 068 CLRF 0x8 1DB BFE GOTO 0x1fe 1DC BFE GOTO 0x1fe ; end function 45: } 1DD BFE GOTO 0x1fe 46: } 1FE 800 RETLW 0 The switch also introduces an overhead 33 instructions just to find the correct case The worst case of execution time (Ci) happens when finding the last value in the table (idx==9) This takes 34 cycles The whole function takes 78 instructions And its worst execution time is 43 cycles 20-Apr-14 Sistemas de tempo real - Helder Daniel 49

50 unsigned char bcd7(unsigned char idx) { 005 BB0 GOTO 0x1b0 1B0 029 MOVWF 0x9 switch (idx) { 1B1 BDE GOTO 0x1de 1DE 209 MOVF 0x9, W 1DF F00 XORLW 0 1E0 643 BTFSC 0x3, 0x2 1E1 BB2 GOTO 0x1b2 1E2 F01 XORLW 0x1 1E3 643 BTFSC 0x3, 0x2 1E4 BB6 GOTO 0x1b6 1E5 F03 XORLW 0x3 1E6 643 BTFSC 0x3, 0x2 1E7 BBA GOTO 0x1ba 1E8 F01 XORLW 0x1 1E9 643 BTFSC 0x3, 0x2 1EA BBE GOTO 0x1be 1EB F07 XORLW 0x7 1EC 643 BTFSC 0x3, 0x2 1ED BC2 GOTO 0x1c2 1EE F01 XORLW 0x1 1EF 643 BTFSC 0x3, 0x2 1F0 BC6 GOTO 0x1c6 1F1 F03 XORLW 0x3 1F2 643 BTFSC 0x3, 0x2 1F3 BCA GOTO 0x1ca 1F4 F01 XORLW 0x1 1F5 643 BTFSC 0x3, 0x2 1F6 BCE GOTO 0x1ce 1F7 F0F XORLW 0xf 1F8 643 BTFSC 0x3, 0x2 7 segment display IV 1F9 BD2 GOTO 0x1d2 1FA F01 XORLW 0x1 1FB 643 BTFSC 0x3, 0x2 1FC BD6 GOTO 0x1d6 1FD BDA GOTO 0x1da 34: case 0: return 0x3F; 1B2 C3F MOVLW 0x3f 1B3 028 MOVWF 0x8 1B4 BFE GOTO 0x1fe 1B5 BFE GOTO 0x1fe ; cases 1 to 9 44: default : return 0; 1DA 068 CLRF 0x8 1DB BFE GOTO 0x1fe 1DC BFE GOTO 0x1fe ; end function 45: } 1DD BFE GOTO 0x1fe 46: } 1FE 800 RETLW 0 Each case has 4 instructions (default case has 3) There is an extra goto never executed (even a free compiler could avoid this) Each case takes 4 cycles: 1 for each mov and 2 for the goto (default takes 3) 20-Apr-14 Sistemas de tempo real - Helder Daniel 50

51 unsigned char bcd7(unsigned char idx) { 005 BB0 GOTO 0x1b0 1B0 029 MOVWF 0x9 switch (idx) { 1B1 BDE GOTO 0x1de 1DE 209 MOVF 0x9, W 1DF F00 XORLW 0 1E0 643 BTFSC 0x3, 0x2 1E1 BB2 GOTO 0x1b2 1E2 F01 XORLW 0x1 1E3 643 BTFSC 0x3, 0x2 1E4 BB6 GOTO 0x1b6 1E5 F03 XORLW 0x3 1E6 643 BTFSC 0x3, 0x2 1E7 BBA GOTO 0x1ba 1E8 F01 XORLW 0x1 1E9 643 BTFSC 0x3, 0x2 1EA BBE GOTO 0x1be 1EB F07 XORLW 0x7 1EC 643 BTFSC 0x3, 0x2 1ED BC2 GOTO 0x1c2 1EE F01 XORLW 0x1 1EF 643 BTFSC 0x3, 0x2 1F0 BC6 GOTO 0x1c6 1F1 F03 XORLW 0x3 1F2 643 BTFSC 0x3, 0x2 1F3 BCA GOTO 0x1ca 1F4 F01 XORLW 0x1 1F5 643 BTFSC 0x3, 0x2 1F6 BCE GOTO 0x1ce 1F7 F0F XORLW 0xf 1F8 643 BTFSC 0x3, 0x2 7 segment display IV 1F9 BD2 GOTO 0x1d2 1FA F01 XORLW 0x1 1FB 643 BTFSC 0x3, 0x2 1FC BD6 GOTO 0x1d6 1FD BDA GOTO 0x1da 34: case 0: return 0x3F; 1B2 C3F MOVLW 0x3f 1B3 028 MOVWF 0x8 1B4 BFE GOTO 0x1fe 1B5 BFE GOTO 0x1fe ; cases 1 to 9 44: default : return 0; 1DA 068 CLRF 0x8 1DB BFE GOTO 0x1fe 1DC BFE GOTO 0x1fe ; end function 45: } 1DD BFE GOTO 0x1fe 46: } 1FE 800 RETLW 0 The goto 0x1FE could also be avoided (it is a goto a return) And substituted by a return with a value, eg.: RETLW 0x3F This will reduce each case and return from 6 cycles to just 2 20-Apr-14 Sistemas de tempo real - Helder Daniel 51

52 7 segment display V An efficient implementation of a lookup table, in program memory, as a function, can be as shown below, using the return value instruction (RETLW) (fnc bcd7 takes only 3 cycles whatever the element to access + 2 for the call = 5 cycles) bcd7 ; W register is argument idx of fnc addwf _PCL, F ; _PCL is program counter retlw 0x3F ; leave return value in W register retlw 0x05 retlw 0x5B retlw 0x4F retlw 0x66 retlw 0x6D retlw 0x7C retlw 0x07 retlw 0x8F retlw 0x67 start (main) movwf PORTA, W ; read port A andlw 0x0F ; make sure 4 MSBits are 0 call bcd7 ; get 7 segment display value movwf PORTC ; write to port C (7 segment display) 20-Apr-14 Sistemas de tempo real - Helder Daniel 52

53 7 segment display V unsigned char bcd7[] = { 0x3F, 0x05, 0x5B, 0x4F, 0x66 Using a look up table in data memory each access takes also 5 cycles but is it necessary code to initialize the look up table (20 instructions since there is no way to store a literal in F registers) So init lookup takes more program memory than the function in previous slide (and adds 20 cycles overhead at the beginning of the program) idx equ d'09 ; prot A bcd value (idx) bcd7 equ d'10 ; bcd7 table from register 10 to 19 initlookup ; possible look up table init routine movlw 0x3f movwf bcd7 movlw 0x05 movwf bcd7+1 ;... More 8 elements initialization start (main) movwf PORTA, W ; read port A andlw 0x0F ; make sure 4 MSBits are 0 movwf idx ; store index in F register movwl bcd7 ; get bcd7 table base address addwf idx ; add index movwf FSR ; set index register movf INDF, W ; get indexed value movwf PORTC ; write to port C (7 segment display) 20-Apr-14 53

54 Single Board Computer (SBC) I PicKits includes, in a board, some devices along a pic microcontroller However current technology allows the deployment of a full computer in a small board Along the CPU and main memory these board can have: SSD drive (secondary memory) SD memory card Ethernet adapter Wireless Network adapter Bluetooth adapter HDMI and/or CVBS Video adapter Audio adapter (IN/OUT) Serial Port USB ports Some expansion Connectors 20-Apr-14 Real Time Systems - Helder Daniel 54

55 SBC Snowball I CPU: ARM Dual Cortex 1GHz Main Mem: 1 GByte LP-DDR2 Secondary Mem: 4/8 GByte e-mmc Operating system: Linux 2.6; MeeGo; Ubuntu; Android GPS 3 Axis Accelerometer 3 Axis Magnetometer 3 Axis Gyrometer Pressure sensor 85 mm + all features listed in previous slide SBC example: SKY-S9500-ULP-CXX (SNOWBALL) 20-Apr-14 Real Time Systems - Helder Daniel 55

56 SBC Snowball II Snowball has built in flash memory (emmc) with 4 or 8 Gbytes Also an SD memory card slot A full operating system can be installed in the emmc or SD-Card: Linux Android The snowball have an ARM processor. Adeos-ipipe patches are available for Linux ARM version Xenomai can be compiled for ARM based systems 20-Apr-14 Sistemas de tempo real - Helder Daniel 56

57 SBC Snowball III The snowball is a general purpose computer We can also connect an USB keyboard and a Monitor (hdmi or cvbs interface) However if used for a sole purpose only (like vehicle control) it can be seen as an embedded system A MIEET project to develop a controller for an aircraft model, using a snowball board was concluded last year. 20-Apr-14 Sistemas de tempo real - Helder Daniel 57

58 Android I Android is based on Linux OS It is not a real time system But have a framework to handle many devices like: GPS Accelerometer Magnetometer Gyrometer Pressure sensor Android can be installed in an SBC like snowball or in a smartphone, a tablet PC 20-Apr-14 Sistemas de tempo real - Helder Daniel 58

59 Android II 20-Apr-14 Sistemas de tempo real - Helder Daniel 59

60 Android III Dalvik is the process virtual machine (VM) for Android operating system, that runs apps on Android devices Programs are commonly written in a dialect of Java and compiled to bytecode java Then they are converted from Java Virtual Machine-compatible *.class files to Dalvik-compatible *.dex (Dalvik Executable) files before installation on an Android device. Java VMs are stack machines the Dalvik VM is a register-based architecture. The compact Dalvik executable format (.dex) is designed to be suitable for systems that are constrained in terms of memory and processor speed. 20-Apr-14 Sistemas de tempo real - Helder Daniel 60

61 Android IV In Android access to devices like GPS is made through the framework: class LocationManager Below is a simplified example of a Java method that returns in a string the Longitude and Latitude coordinates from current location, using GPS. public String getlocationcoord() { protected LocationManager lm; lm = (LocationManager) getsystemservice(context.location_service); Location l = lm.getlastknownlocation(locationmanager.gps_provider); } return "Long:" + l.getlongitude() + Lat: + l.getlatitude()); 20-Apr-14 Sistemas de tempo real - Helder Daniel 61

62 Android V Eclipse IDE have a plugin for android apps development: Android Development Tools (ADT) It includes a cross compiler and a simulator Programs developed on a PC with Eclipse and ADT can then be uploaded for an Android device Let s take a brief look at these IDE and tools 20-Apr-14 Sistemas de tempo real - Helder Daniel 62

63 Android VI 20-Apr-14 Sistemas de tempo real - Helder Daniel 63

64 Android VII 20-Apr-14 Sistemas de tempo real - Helder Daniel 64

65 Android VII 20-Apr-14 Sistemas de tempo real - Helder Daniel 65

66 Embedded system modelling I Some tools and frameworks can generate an application from a specification and a model: specification code generation Model In this chapter a modelling technology for real time or embedded systems will be presented: State charts (or state flow) (in portuguese: Cartas de estado (ou fluxo de estados)) There are other techniques for modelling and code generation, such as: Grafcets UML (with or without real time extensions) 20-Apr-14 Sistemas de tempo real - Helder Daniel 66

67 State flow modelling I This methodology was introduced by D. Harel A state chart consists of: states events Finite state machines (FSM) or just state machines Statechart = FSM + depth + orthogonality + communication 20-Apr-14 Sistemas de tempo real - Helder Daniel 67

68 State flow modelling II Statechart = FSM + depth + orthogonallty + communication 1) FSM is represented by state transition diagrams 2) depth allows decomposition of states in sub-states 3) Orthogonality allows to represent independent (concurrent) systems (or tasks), ie. AND states 4) Communication allows orthogonal states (or tasks) to respond to shared events 20-Apr-14 Sistemas de tempo real - Helder Daniel 68

69 State charts I State charts combine: Data Flow Diagrams (diagramas de fluxo de dados) State transition diagrams These charts are considered excellent to represent real time systems since: Time can be expressed Concurrency can be expressed modularity is preserved 20-Apr-14 Sistemas de tempo real - Helder Daniel 69

70 State charts II primeiro A state chart may include: States (XOR): boxes with rounded corners Concurrent states or orthogonal states (AND): dashed boxes or boxes separated by dashed lines A C y[p] b d b B a State transitions (arrows) depth is expressed decomposing high-level states Printed 20-May :54:54 20-Apr-14 Sistemas de tempo real - Helder Daniel 70

71 State charts III Actions can be associated to states or transitions primeiro Transitions can occur upon an event or a condition A transition may also occurs depending on an event and a condition In the example: 1) Upon event b if system is in state A or C it flow to state B A C y[p] b d b B a 2) if system in state B upon event a it flows to state A and upon event d it flows to state C 3) if system is in state A upon event y and only if condition P is TRUE it flows to state C Sistemas de tempo real - Helder Daniel 71 Printed 20-May :54:54

72 State decomposition Ia In previous chart, event b makes system change from states A or C to state B This behaviour can be grouped in a super state D primeiro A b a y[p] b B C d 20-Apr-14 72

73 State decomposition Ib In previous chart, event b makes system change from states A or C to state B This behaviour can be grouped in a super state D State D semantics is XOR (exclusive OR) which means that if system is in superstate D it is only in one of its sub states A or C (never in both) primeiro D A A b a a B y[p] b B y[p] b C d C d 20-Apr-14 73

74 State decomposition Ic In previous chart, event b makes system change from states A or C to state B This behaviour can be grouped in a super state D State D semantics is XOR (exclusive OR) which means that if system is in superstate D it is only in one of its sub states A or C (never in both) Inside a superstate a default transition is used to set initial state primeiro D A A b a a B y[p] b B y[p] b C d C d 20-Apr-14 74

75 State decomposition II In this example superstate J is decomposed in 3 orthogonal (AND) states A, B and C Each of these 3 states are decomposed in two XOR states When system enters in state J, enters simultaneously in states A, B and C Inside these states it enters the XOR state with the default transition: H, G, D 20-Apr-14 Sistemas de tempo real - Helder Daniel 75

76 State decomposition III If event h occurs there are 3 simultaneous state transitions: H -> I G -> F D -> E 20-Apr-14 Sistemas de tempo real - Helder Daniel 76

77 State decomposition IV In a transition an event can be generated (so an event can generate another event) The chart below models a chain reaction: event e triggers event f and event f triggers event g 20-Apr-14 Sistemas de tempo real - Helder Daniel 77

78 Matlab stateflow toolbox I Matlab includes a toolbox to model and simulate with state charts State charts can interact with simulink diagrams and matlab workspace Events and data can be generated by simulink blocks data to a state chart can be imported form workspace variables This toolbox allows the simulation and debugging of a state chart: step by step with some delay Also it is possible to generate C (or ADA) code from a state chart to some target like s-functions or even for the Real Time Workshop 20-Apr-14 Sistemas de tempo real - Helder Daniel 78

79 Matlab stateflow toolbox II This diagram shows how stateflow toolbox is integrated with other Matlab components: Stateflow diagrams can exchange data with Matlab and Simulink Stateflow coder can generate source code (C or ADA) from the stateflow diagram Code can be executed with the Real Time Workshop (RTW) 20-Apr-14 Sistemas de tempo real - Helder Daniel 79

80 Matlab stateflow toolbox III To use a state chart in a simulink model a state flow block must be inserted A state flow diagram is the direct representation of a chart with: states junctions transitions data events The state machine has also an associated target to generate code 20-Apr-14 Sistemas de tempo real - Helder Daniel 80

81 Matlab stateflow toolbox IV State flow diagram example: 20-Apr-14 Sistemas de tempo real - Helder Daniel 81

82 Matlab stateflow: states I Every state has a father (or superstate), except the root state (in the previous diagram state A is the root state) States can have a tag to specify actions and when to execute them: eg: when entering the state when leaving the state States can have an history junction (With this junction future activity can take in account past activity) The state properties editor: 20-Apr-14 Sistemas de tempo real - Helder Daniel 82

83 Matlab stateflow: states II Set breakpoints for debugger Display 0 Discrete Pulse Generator A1 Scope 20-Apr-14 Chart Sistemas de tempo real - Helder Daniel 83

84 Label Matlab stateflow: states III Description URL Display 0 Discrete Pulse Generator A1 Scope 20-Apr-14 Chart Sistemas de tempo real - Helder Daniel 84

85 Matlab stateflow: states IV Output state activity to simulink: 0 if non active (off) 1 if active (on) One output port appear in the chart block It can be connected to a scope 0 Display Discrete Pulse Generator A1 Scope 20-Apr-14 Chart Sistemas de tempo real - Helder Daniel 85

86 Matlab stateflow: state transition An arrow that connects two states The label (y) indicates the event that triggers the condition An additional condition for the transition to occur can be expressed between [] 20-Apr-14 Sistemas de tempo real - Helder Daniel 86

87 Matlab stateflow: conditions If event occurs and condition is TRUE the system transits A transition may only depended of: an event or a condition 20-Apr-14 Sistemas de tempo real - Helder Daniel 87

88 Matlab stateflow: default transition Solve ambiguities in XOR state decomposition An arrow from nowhere points the initial state Default transitions can also point a junction, ie. a decision point (each branch depending on a condition) 20-Apr-14 Sistemas de tempo real - Helder Daniel 88

89 Matlab stateflow: events I Events are NOT graphical objects Events can trigger transitions Events can be triggered by signal rising edge or falling edge Events are applied from top level diagrams down to lower levels Events can be defined from stateflow explorer menu: add Events can be: Local to stateflow diagram External (from / to simulink) (may be provided by a pulse generated) 20-Apr-14 Sistemas de tempo real - Helder Daniel 89

90 Matlab stateflow: events II 20-Apr-14 Sistemas de tempo real - Helder Daniel 90

91 Matlab stateflow: data I Data are also NOT graphical objects Matlab data types can be used Places to store data can also be defined from stateflow explorer menu: add Variable scope can be: Local to stateflow diagram External (from / to simulink) Defined in Matlab workspace Temporary Constant 20-Apr-14 Sistemas de tempo real - Helder Daniel 91

92 Matlab stateflow: data II 20-Apr-14 Sistemas de tempo real - Helder Daniel 92

93 Matlab stateflow: events and data Input event (step 0/1) Output data (to scopes) Output event Input data (sine waves) 20-Apr-14 Sistemas de tempo real - Helder Daniel 93

94 Matlab stateflow: History junction I History junctions are represented by an H inside a circle: If a super state with XOR decomposition have one of this junctions when revisited transition for XOR sub-state is made for the most recently visited History junction have priority over the default transition Suppose an automatic gearbox with two top level states Neutral and engaged: 20-Apr-14 Sistemas de tempo real - Helder Daniel 94

95 Matlab stateflow: History junction II When state changes from Neutral to Engaged If a default transition exists The XOR substate system enters is the one pointed by the default transition: first 20-Apr-14 Sistemas de tempo real - Helder Daniel 95

96 Matlab stateflow: History junction III When state changes from Neutral to Engaged If an history junction exists (even with a default transition present) enters the most recent visited substate: first or second 20-Apr-14 Sistemas de tempo real - Helder Daniel 96

97 Matlab stateflow: event sending send keyword can be used to generate an event and sent it to some state If data1 == 1 event E_one is generated and sent to state B Alternative syntax: [data == 1] / B.E_one 20-Apr-14 Sistemas de tempo real - Helder Daniel 97

98 Matlab stateflow: actions I Actions can be performed in a transition or in a state In a transition follows the general syntax: event [condition] {conditional action} / {transition action} If an event occurs and condition is TRUE the system transits - Conditional action is executed if condition is TRUE - Transition action light_off is executed only if transition is made: 20-Apr-14 Sistemas de tempo real - Helder Daniel 98

99 Matlab stateflow: actions II States can have a tag to specify an action and when to execute it: entry: execute action when entering the state (last slide transition action could be in the entry of state Power_off) Power_off entry: light_off of the state during: execute action in each simulation step when system remains in this same state again exit: execute action when leaving the state on <event>: execute action when in this state and event (switch_off) occurs 20-Apr-14 Sistemas de tempo real - Helder Daniel 99

100 Matlab stateflow: Connective junctions I These junctions can represent decision points Example below uses these junction to implement an if else structure: 20-Apr-14 Sistemas de tempo real - Helder Daniel 100

101 Matlab stateflow: Connective junctions II Connective junctions can be used to create self loops: One way to execute an action without state change Both figures below are equivalent: When event e occurs and condition c1 is FALSE a2 action is executed 20-Apr-14 Sistemas de tempo real - Helder Daniel 101

102 Matlab stateflow: Connective junctions III Connective junctions can be used to implement loops Below an example of a FOR loop: - When event E occurs loop counter variable is initialized with i=0 - While i < 0 func1() is executed (10 times) - When i == 10 system changes to state B 20-Apr-14 Sistemas de tempo real - Helder Daniel 102

103 Matlab stateflow: Graphical functions I Allows code reutilization Let s considere this twin system For both entries the sign of the variable is measured If < 0 then a 0 is presented in the corresponding display If >=0 then a 1 is presented 20-Apr-14 Sistemas de tempo real - Helder Daniel 103

104 Matlab stateflow: Graphical functions II The chart requires only one state When entering the state (which happens at system start since is the only one) function sign() is called to compute variables OUT0 and OUT1 form the inputs IN0 and IN1 Function sign is a graphical function It has a decision point if its argument x < 0 returns 0 else (x>=0) returns 1 20-Apr-14 Sistemas de tempo real - Helder Daniel 104

105 Stateflow example: Integer adder I The following example shows how to express through a statechart the sum of two positive integers X and Y: X and Y are variables from simulink Result is sent to simulink in variables Xo and Yo All variables are int32 Only operations available are increment(++) and decrement (--) No events are required 9 0 X X Xo X Y Yo 9 Chart 18 Y The system can end in two final states: Operation successful: Xo = 0 and Yo = Y + X Error if X<0 or Y<0 Xo=Yo=-1 20-Apr-14 Sistemas de tempo real - Helder Daniel 105 Y

106 Stateflow example: Integer adder II The state chart: Xo = X and Yo = Y if and only if X and Y >=0 else system enters state Erro The operation is performed incrementing Yo as many times as the value of Xo in a connective junction When operation finished (X0==0) system enters state OK 20-Apr-14 Sistemas de tempo real - Helder Daniel 106

107 Stateflow example: Integer adder III An alternate statechart: Xo = X and Yo = Y if and only if X and Y >=0 else system enters state Erro The operation is performed incrementing Yo as many times as the value of Xo in a self loop around state OK The self loop executes while Xo > 0 (condition is TRUE) We could also increment Yo and decrement Xo at the entry of state OK Sistemas de tempo real - Helder Daniel 107

108 Stateflow example: Integer adder IV It is also possible to model in a state chart the increment and decrement operation to run concurrently (as modelled by the Petri Net at the right) 20-Apr-14 Sistemas de tempo real - Helder Daniel 108

109 Stateflow example: Vending Machine FSM I The vending machine implemented with a PIC uc can be modelled with state flow. The connection with a PIC uc were: reset Product fifty (RA0) open (RB0) release mechanism Coin id mechanism hundred (RA1) clock FSM (Pic) change (RB1) change release mechanism The connection with a Simulink model are: fifty, hundred and reset are events triggered when input is high. Open and change are output variables, when high product or change drawer opens. 20-Apr-14 Sistemas de tempo real - Helder Daniel 109

110 Stateflow example: Vending Machine FSM II The FSM is modelled by a state chart (very similar to the FSM diagram). 20-Apr-14 Sistemas de tempo real - Helder Daniel 110

PIC Programming in Assembly. (http://www.mstracey.btinternet.co.uk/index.htm)

PIC Programming in Assembly. (http://www.mstracey.btinternet.co.uk/index.htm) PIC Programming in Assembly (http://www.mstracey.btinternet.co.uk/index.htm) Tutorial 1 Good Programming Techniques. Before we get to the nitty gritty of programming the PIC, I think now is a good time

More information

An Introduction to MPLAB Integrated Development Environment

An Introduction to MPLAB Integrated Development Environment An Introduction to MPLAB Integrated Development Environment 2004 Microchip Technology Incorporated An introduction to MPLAB Integrated Development Environment Slide 1 This seminar is an introduction to

More information

Section 29. Instruction Set

Section 29. Instruction Set M Section 29. Instruction Set HIGHLIGHTS This section of the manual contains the following major topics: 29. Introduction...29-2 29.2 Instruction Formats...29-4 29.3 Special Function Registers as Source/Destination...29-6

More information

SPI. Overview and Use of the PICmicro Serial Peripheral Interface. Getting Started: SPI

SPI. Overview and Use of the PICmicro Serial Peripheral Interface. Getting Started: SPI SPI Overview and Use of the PICmicro Serial Peripheral Interface In this presentation, we will look at what the Serial Peripheral Interface, otherwise known as the SPI, is, and how it is used to communicate

More information

Lecture N -1- PHYS 3330. Microcontrollers

Lecture N -1- PHYS 3330. Microcontrollers Lecture N -1- PHYS 3330 Microcontrollers If you need more than a handful of logic gates to accomplish the task at hand, you likely should use a microcontroller instead of discrete logic gates 1. Microcontrollers

More information

Digitale Signalverarbeitung mit FPGA (DSF) Soft Core Prozessor NIOS II Stand Mai 2007. Jens Onno Krah

Digitale Signalverarbeitung mit FPGA (DSF) Soft Core Prozessor NIOS II Stand Mai 2007. Jens Onno Krah (DSF) Soft Core Prozessor NIOS II Stand Mai 2007 Jens Onno Krah Cologne University of Applied Sciences www.fh-koeln.de jens_onno.krah@fh-koeln.de NIOS II 1 1 What is Nios II? Altera s Second Generation

More information

Fondamenti su strumenti di sviluppo per microcontrollori PIC

Fondamenti su strumenti di sviluppo per microcontrollori PIC Fondamenti su strumenti di sviluppo per microcontrollori PIC MPSIM ICE 2000 ICD 2 REAL ICE PICSTART Ad uso interno del corso Elettronica e Telecomunicazioni 1 2 MPLAB SIM /1 MPLAB SIM is a discrete-event

More information

Programming PIC Microcontrollers in PicBasic Pro Lesson 1 Cornerstone Electronics Technology and Robotics II

Programming PIC Microcontrollers in PicBasic Pro Lesson 1 Cornerstone Electronics Technology and Robotics II Programming PIC Microcontrollers in PicBasic Pro Lesson 1 Cornerstone Electronics Technology and Robotics II Administration: o Prayer PicBasic Pro Programs Used in This Lesson: o General PicBasic Pro Program

More information

Keil C51 Cross Compiler

Keil C51 Cross Compiler Keil C51 Cross Compiler ANSI C Compiler Generates fast compact code for the 8051 and it s derivatives Advantages of C over Assembler Do not need to know the microcontroller instruction set Register allocation

More information

A+ Guide to Managing and Maintaining Your PC, 7e. Chapter 1 Introducing Hardware

A+ Guide to Managing and Maintaining Your PC, 7e. Chapter 1 Introducing Hardware A+ Guide to Managing and Maintaining Your PC, 7e Chapter 1 Introducing Hardware Objectives Learn that a computer requires both hardware and software to work Learn about the many different hardware components

More information

Computer Automation Techniques. Arthur Carroll

Computer Automation Techniques. Arthur Carroll Computer Automation Techniques Arthur Carroll 1 Three Types of Computers Micro-Controller Single Board Computer Desktop Computer 2 The Micro-Controller Small inexpensive DIP or surface mount chips Roughly

More information

DsPIC HOW-TO GUIDE Creating & Debugging a Project in MPLAB

DsPIC HOW-TO GUIDE Creating & Debugging a Project in MPLAB DsPIC HOW-TO GUIDE Creating & Debugging a Project in MPLAB Contents at a Glance 1. Introduction of MPLAB... 4 2. Development Tools... 5 3. Getting Started... 6 3.1. Create a Project... 8 3.2. Start MPLAB...

More information

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Question Bank Subject Name: EC6504 - Microprocessor & Microcontroller Year/Sem : II/IV

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Question Bank Subject Name: EC6504 - Microprocessor & Microcontroller Year/Sem : II/IV DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Question Bank Subject Name: EC6504 - Microprocessor & Microcontroller Year/Sem : II/IV UNIT I THE 8086 MICROPROCESSOR 1. What is the purpose of segment registers

More information

C Programming. for Embedded Microcontrollers. Warwick A. Smith. Postbus 11. Elektor International Media BV. 6114ZG Susteren The Netherlands

C Programming. for Embedded Microcontrollers. Warwick A. Smith. Postbus 11. Elektor International Media BV. 6114ZG Susteren The Netherlands C Programming for Embedded Microcontrollers Warwick A. Smith Elektor International Media BV Postbus 11 6114ZG Susteren The Netherlands 3 the Table of Contents Introduction 11 Target Audience 11 What is

More information

Lecture 1 Introduction to Android

Lecture 1 Introduction to Android These slides are by Dr. Jaerock Kwon at. The original URL is http://kettering.jrkwon.com/sites/default/files/2011-2/ce-491/lecture/alecture-01.pdf so please use that instead of pointing to this local copy

More information

Freescale Semiconductor, I

Freescale Semiconductor, I nc. Application Note 6/2002 8-Bit Software Development Kit By Jiri Ryba Introduction 8-Bit SDK Overview This application note describes the features and advantages of the 8-bit SDK (software development

More information

Evo Laser Firmware Developer s Manual

Evo Laser Firmware Developer s Manual Evo Laser Firmware Developer s Manual Table of Content Chapter 1 Introduction Chapter 2 Hardware Overview and Subsystems 2.1 Overview 2.2 Evo Laser Hardware Core System 2.3 Evo Laser Smartport TM Chapter

More information

7a. System-on-chip design and prototyping platforms

7a. System-on-chip design and prototyping platforms 7a. System-on-chip design and prototyping platforms Labros Bisdounis, Ph.D. Department of Computer and Communication Engineering 1 What is System-on-Chip (SoC)? System-on-chip is an integrated circuit

More information

Software based Finite State Machine (FSM) with general purpose processors

Software based Finite State Machine (FSM) with general purpose processors Software based Finite State Machine (FSM) with general purpose processors White paper Joseph Yiu January 2013 Overview Finite state machines (FSM) are commonly used in electronic designs. FSM can be used

More information

Microcontroller Basics A microcontroller is a small, low-cost computer-on-a-chip which usually includes:

Microcontroller Basics A microcontroller is a small, low-cost computer-on-a-chip which usually includes: Microcontroller Basics A microcontroller is a small, low-cost computer-on-a-chip which usually includes: An 8 or 16 bit microprocessor (CPU). A small amount of RAM. Programmable ROM and/or flash memory.

More information

SKP16C62P Tutorial 1 Software Development Process using HEW. Renesas Technology America Inc.

SKP16C62P Tutorial 1 Software Development Process using HEW. Renesas Technology America Inc. SKP16C62P Tutorial 1 Software Development Process using HEW Renesas Technology America Inc. 1 Overview The following tutorial is a brief introduction on how to develop and debug programs using HEW (Highperformance

More information

Von der Hardware zur Software in FPGAs mit Embedded Prozessoren. Alexander Hahn Senior Field Application Engineer Lattice Semiconductor

Von der Hardware zur Software in FPGAs mit Embedded Prozessoren. Alexander Hahn Senior Field Application Engineer Lattice Semiconductor Von der Hardware zur Software in FPGAs mit Embedded Prozessoren Alexander Hahn Senior Field Application Engineer Lattice Semiconductor AGENDA Overview Mico32 Embedded Processor Development Tool Chain HW/SW

More information

Tutorial for MPLAB Starter Kit for PIC18F

Tutorial for MPLAB Starter Kit for PIC18F Tutorial for MPLAB Starter Kit for PIC18F 2006 Microchip Technology Incorporated. All Rights Reserved. WebSeminar Title Slide 1 Welcome to the tutorial for the MPLAB Starter Kit for PIC18F. My name is

More information

Computer Organization and Components

Computer Organization and Components Computer Organization and Components IS1500, fall 2015 Lecture 5: I/O Systems, part I Associate Professor, KTH Royal Institute of Technology Assistant Research Engineer, University of California, Berkeley

More information

EMBEDDED SYSTEM BASICS AND APPLICATION

EMBEDDED SYSTEM BASICS AND APPLICATION EMBEDDED SYSTEM BASICS AND APPLICATION TOPICS TO BE DISCUSSED System Embedded System Components Classifications Processors Other Hardware Software Applications 2 INTRODUCTION What is a system? A system

More information

Analog-to-Digital Converters

Analog-to-Digital Converters Analog-to-Digital Converters In this presentation we will look at the Analog-to-Digital Converter Peripherals with Microchip s midrange PICmicro Microcontrollers series. 1 Analog-to-Digital Converters

More information

SABRE Lite Development Kit

SABRE Lite Development Kit SABRE Lite Development Kit Freescale i.mx 6Quad ARM Cortex A9 processor at 1GHz per core 1GByte of 64-bit wide DDR3 @ 532MHz UART, USB, Ethernet, CAN, SATA, SD, JTAG, I2C Three Display Ports (RGB, LVDS

More information

Friendly ARM MINI2440 & Dalvik Virtual Machine with Android

Friendly ARM MINI2440 & Dalvik Virtual Machine with Android e t International Journal on Emerging Technologies (Special Issue on NCRIET-2015) 6(2): 197-202(2015) ISSN No. (Print) : 0975-8364 ISSN No. (Online) : 2249-3255 Friendly ARM MINI2440 & Dalvik Virtual Machine

More information

8051 hardware summary

8051 hardware summary 8051 hardware summary 8051 block diagram 8051 pinouts + 5V ports port 0 port 1 port 2 port 3 : dual-purpose (general-purpose, external memory address and data) : dedicated (interfacing to external devices)

More information

Programing the Microprocessor in C Microprocessor System Design and Interfacing ECE 362

Programing the Microprocessor in C Microprocessor System Design and Interfacing ECE 362 PURDUE UNIVERSITY Programing the Microprocessor in C Microprocessor System Design and Interfacing ECE 362 Course Staff 1/31/2012 1 Introduction This tutorial is made to help the student use C language

More information

Embedded Software development Process and Tools: Lesson-4 Linking and Locating Software

Embedded Software development Process and Tools: Lesson-4 Linking and Locating Software Embedded Software development Process and Tools: Lesson-4 Linking and Locating Software 1 1. Linker 2 Linker Links the compiled codes of application software, object codes from library and OS kernel functions.

More information

Chapter 13. PIC Family Microcontroller

Chapter 13. PIC Family Microcontroller Chapter 13 PIC Family Microcontroller Lesson 01 PIC Characteristics and Examples PIC microcontroller characteristics Power-on reset Brown out reset Simplified instruction set High speed execution Up to

More information

RAPID PROTOTYPING OF DIGITAL SYSTEMS Second Edition

RAPID PROTOTYPING OF DIGITAL SYSTEMS Second Edition RAPID PROTOTYPING OF DIGITAL SYSTEMS Second Edition A Tutorial Approach James O. Hamblen Georgia Institute of Technology Michael D. Furman Georgia Institute of Technology KLUWER ACADEMIC PUBLISHERS Boston

More information

Computer Performance. Topic 3. Contents. Prerequisite knowledge Before studying this topic you should be able to:

Computer Performance. Topic 3. Contents. Prerequisite knowledge Before studying this topic you should be able to: 55 Topic 3 Computer Performance Contents 3.1 Introduction...................................... 56 3.2 Measuring performance............................... 56 3.2.1 Clock Speed.................................

More information

The BSN Hardware and Software Platform: Enabling Easy Development of Body Sensor Network Applications

The BSN Hardware and Software Platform: Enabling Easy Development of Body Sensor Network Applications The BSN Hardware and Software Platform: Enabling Easy Development of Body Sensor Network Applications Joshua Ellul jellul@imperial.ac.uk Overview Brief introduction to Body Sensor Networks BSN Hardware

More information

Reminders. Lab opens from today. Many students want to use the extra I/O pins on

Reminders. Lab opens from today. Many students want to use the extra I/O pins on Reminders Lab opens from today Wednesday 4:00-5:30pm, Friday 1:00-2:30pm Location: MK228 Each student checks out one sensor mote for your Lab 1 The TA will be there to help your lab work Many students

More information

8051 MICROCONTROLLER COURSE

8051 MICROCONTROLLER COURSE 8051 MICROCONTROLLER COURSE Objective: 1. Familiarization with different types of Microcontroller 2. To know 8051 microcontroller in detail 3. Programming and Interfacing 8051 microcontroller Prerequisites:

More information

Java Embedded Applications

Java Embedded Applications TM a One-Stop Shop for Java Embedded Applications GeeseWare offer brings Java in your constrained embedded systems. You develop and simulate your Java application on PC, and enjoy a seamless hardware validation.

More information

Technical Note. Micron NAND Flash Controller via Xilinx Spartan -3 FPGA. Overview. TN-29-06: NAND Flash Controller on Spartan-3 Overview

Technical Note. Micron NAND Flash Controller via Xilinx Spartan -3 FPGA. Overview. TN-29-06: NAND Flash Controller on Spartan-3 Overview Technical Note TN-29-06: NAND Flash Controller on Spartan-3 Overview Micron NAND Flash Controller via Xilinx Spartan -3 FPGA Overview As mobile product capabilities continue to expand, so does the demand

More information

Soft processors for microcontroller programming education

Soft processors for microcontroller programming education Soft processors for microcontroller programming education Charles Goetzman Computer Science University of Wisconsin La Crosse goetzman.char@uwlax.edu Jeff Fancher Electronics Western Technical College

More information

FLYPORT Wi-Fi 802.11G

FLYPORT Wi-Fi 802.11G FLYPORT Wi-Fi 802.11G System on module 802.11g WIFI - Infrastructure mode - softap mode - Ad hoc mode Microchip PIC 24F 16 bit processor Microchip MRF24WG0MA/MB - Native WiFi 802.11g transceiver - PCB

More information

Applications Development on the ARM Cortex -M0+ Free On-line Development Tools Presented by William Antunes

Applications Development on the ARM Cortex -M0+ Free On-line Development Tools Presented by William Antunes Applications Development on the ARM Cortex -M0+ Free On-line Development Tools Presented by William Antunes Agenda Cortex M0+ architecture Introduction to Kinetis L Freedom board Arrow Cloud Connect Internet

More information

Understand and Build Android Programming Environment. Presented by: Che-Wei Chang

Understand and Build Android Programming Environment. Presented by: Che-Wei Chang Real Time System Project 1 Understand and Build Android Programming Environment Advisor: Prof. Tei-Wei i Kuo Presented by: Che-Wei Chang Outline Introduction to Android Framework What is Android Android

More information

AUTOMATIC NIGHT LAMP WITH MORNING ALARM USING MICROPROCESSOR

AUTOMATIC NIGHT LAMP WITH MORNING ALARM USING MICROPROCESSOR AUTOMATIC NIGHT LAMP WITH MORNING ALARM USING MICROPROCESSOR INTRODUCTION This Project "Automatic Night Lamp with Morning Alarm" was developed using Microprocessor. It is the Heart of the system. The sensors

More information

Using the HCS12 Serial Monitor on Wytec Dragon-12 boards. Using Motorola s HCS12 Serial Monitor on Wytec s Dragon-12 boards

Using the HCS12 Serial Monitor on Wytec Dragon-12 boards. Using Motorola s HCS12 Serial Monitor on Wytec s Dragon-12 boards Using Motorola s HCS12 Serial Monitor on Wytec s Dragon-12 boards Wytec s Dragon-12 development boards are pre-installed with DBug-12, a small monitor program which allows a user to interact with the board

More information

Embedded C Programming

Embedded C Programming Microprocessors and Microcontrollers Embedded C Programming EE3954 by Maarten Uijt de Haag, Tim Bambeck EmbeddedC.1 References MPLAB XC8 C Compiler User s Guide EmbeddedC.2 Assembly versus C C Code High-level

More information

Simple Alarm System WIRELESS AND REMOTE CONTROLLED PERSONAL APPLIANCE CODE WORD ORGANIZATION TRANSMISSION FORMAT

Simple Alarm System WIRELESS AND REMOTE CONTROLLED PERSONAL APPLIANCE CODE WORD ORGANIZATION TRANSMISSION FORMAT Simple Alarm System WIRELESS AND REMOTE CONTROLLED PERSONAL APPLIANCE Author: Kirill Yelizarov V. Moscow Power Engineering Institute Moscow, Russia email: tihonov@srv-vmss.mpei.ac.ru The alarm system discussed

More information

MICROPROCESSOR AND MICROCOMPUTER BASICS

MICROPROCESSOR AND MICROCOMPUTER BASICS Introduction MICROPROCESSOR AND MICROCOMPUTER BASICS At present there are many types and sizes of computers available. These computers are designed and constructed based on digital and Integrated Circuit

More information

Introduction to Microcontrollers

Introduction to Microcontrollers Introduction to Microcontrollers Motorola M68HC11 Specs Assembly Programming Language BUFFALO Topics of Discussion Microcontrollers M68HC11 Package & Pinouts Accumulators Index Registers Special Registers

More information

DESIGN AND IMPLEMENTATION OF ONLINE PATIENT MONITORING SYSTEM

DESIGN AND IMPLEMENTATION OF ONLINE PATIENT MONITORING SYSTEM DESIGN AND IMPLEMENTATION OF ONLINE PATIENT MONITORING SYSTEM Harsha G S Department of Electronics & Communication Channabasaveshwara Institute of Technology, Gubbi, 572216, India ABSTRACT Patient s condition

More information

Chapter 12. Development Tools for Microcontroller Applications

Chapter 12. Development Tools for Microcontroller Applications Chapter 12 Development Tools for Microcontroller Applications Lesson 01 Software Development Process and Development Tools Step 1: Development Phases Analysis Design Implementation Phase 1 Phase 2 Phase

More information

CB-OLP425 DEVELOPMENT KIT GETTING STARTED

CB-OLP425 DEVELOPMENT KIT GETTING STARTED CB-OLP425 DEVELOPMENT KIT GETTING STARTED Document Revision Document number: 9142285 Release: Jan 29, 2014 09:42 Document version: 12 Copyright 2014 u-blox AG. The contents of this document can be changed

More information

Developing an Application on Core8051s IP-Based Embedded Processor System Using Firmware Catalog Drivers. User s Guide

Developing an Application on Core8051s IP-Based Embedded Processor System Using Firmware Catalog Drivers. User s Guide Developing an Application on Core8051s IP-Based Embedded Processor System Using Firmware Catalog Drivers User s Guide Developing an Application on Core8051s IP-Based Embedded Processor System Using Firmware

More information

Microcontroller Based Low Cost Portable PC Mouse and Keyboard Tester

Microcontroller Based Low Cost Portable PC Mouse and Keyboard Tester Leonardo Journal of Sciences ISSN 1583-0233 Issue 20, January-June 2012 p. 31-36 Microcontroller Based Low Cost Portable PC Mouse and Keyboard Tester Ganesh Sunil NHIVEKAR *, and Ravidra Ramchandra MUDHOLKAR

More information

c0003 A Simple PIC Application CHAPTER 3

c0003 A Simple PIC Application CHAPTER 3 c0003 CHAPTER 3 A Simple PIC Application Chapter Outline 3.1. Hardware Design 46 3.1.1. PIC 16F84A Pin-Out 46 3.1.2. BIN Hardware Block Diagram 47 3.1.3. BIN Circuit Operation 48 3.2. Program Execution

More information

İSTANBUL AYDIN UNIVERSITY

İSTANBUL AYDIN UNIVERSITY İSTANBUL AYDIN UNIVERSITY FACULTY OF ENGİNEERİNG SOFTWARE ENGINEERING THE PROJECT OF THE INSTRUCTION SET COMPUTER ORGANIZATION GÖZDE ARAS B1205.090015 Instructor: Prof. Dr. HASAN HÜSEYİN BALIK DECEMBER

More information

Android, Bluetooth and MIAC

Android, Bluetooth and MIAC Android, Bluetooth and MIAC by Ben Rowland, June 2012 Abstract Discover how easy it is to use TCP network communications to link together high level systems. This article demonstrates techniques to pass

More information

Byte code Interpreter for 8051 Microcontroller

Byte code Interpreter for 8051 Microcontroller Byte code Interpreter for 8051 Microcontroller N. Jeenjun S. Khuntaweetep and S. Somkuarnpanit Abstract This paper proposes a design of byte code interpreter for 8051 microcontroller. We developed a program

More information

Flash Microcontroller. Memory Organization. Memory Organization

Flash Microcontroller. Memory Organization. Memory Organization The information presented in this chapter is collected from the Microcontroller Architectural Overview, AT89C51, AT89LV51, AT89C52, AT89LV52, AT89C2051, and AT89C1051 data sheets of this book. The material

More information

Introduction to Android

Introduction to Android Introduction to Android Poll How many have an Android phone? How many have downloaded & installed the Android SDK? How many have developed an Android application? How many have deployed an Android application

More information

Serial Communications

Serial Communications Serial Communications 1 Serial Communication Introduction Serial communication buses Asynchronous and synchronous communication UART block diagram UART clock requirements Programming the UARTs Operation

More information

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

Hi Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan PIC18 Timer Programming g Hi Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan chanhl@mail.cgu.edu.twcgu Functions of PIC18 timer Functions of the timer Generate a time delay As

More information

Why using ATmega16? University of Wollongong Australia. 7.1 Overview of ATmega16. Overview of ATmega16

Why using ATmega16? University of Wollongong Australia. 7.1 Overview of ATmega16. Overview of ATmega16 s schedule Lecture 7 - C Programming for the Atmel AVR School of Electrical, l Computer and Telecommunications i Engineering i University of Wollongong Australia Week Lecture (2h) Tutorial (1h) Lab (2h)

More information

Chapter 7D The Java Virtual Machine

Chapter 7D The Java Virtual Machine This sub chapter discusses another architecture, that of the JVM (Java Virtual Machine). In general, a VM (Virtual Machine) is a hypothetical machine (implemented in either hardware or software) that directly

More information

Fachbereich Informatik und Elektrotechnik SunSPOT. Ubiquitous Computing. Ubiquitous Computing, Helmut Dispert

Fachbereich Informatik und Elektrotechnik SunSPOT. Ubiquitous Computing. Ubiquitous Computing, Helmut Dispert Ubiquitous Computing Ubiquitous Computing The Sensor Network System Sun SPOT: The Sun Small Programmable Object Technology Technology-Based Wireless Sensor Networks a Java Platform for Developing Applications

More information

PIC in Practice. A Project-Based Approach. D. W. Smith

PIC in Practice. A Project-Based Approach. D. W. Smith PIC in Practice PIC in Practice A Project-Based Approach D. W. Smith AMSTERDAM BOSTON HEIDELBERG LONDON NEW YORK OXFORD PARIS SAN DIEGO SAN FRANCISCO SINGAPORE SYDNEY TOKYO Newnes is an imprint of Elsevier

More information

AN727. Credit Card Reader Using a PIC12C509 DATA ENCODING INTRODUCTION FIGURE 1: POSITION OF ISO TRACKS 1, 2 AND 3. Andrew M Errington

AN727. Credit Card Reader Using a PIC12C509 DATA ENCODING INTRODUCTION FIGURE 1: POSITION OF ISO TRACKS 1, 2 AND 3. Andrew M Errington Credit Using a PIC12C509 AN727 Author: INTRODUCTION Andrew M Errington Many people carry one or more magnetically encoded cards with them for accessing a range of services. Perhaps the most common example

More information

ARM Thumb Microcontrollers. Application Note. Software ISO 7816 I/O Line Implementation. Features. Introduction

ARM Thumb Microcontrollers. Application Note. Software ISO 7816 I/O Line Implementation. Features. Introduction Software ISO 7816 I/O Line Implementation Features ISO 7816-3 compliant (direct convention) Byte reception and transmission with parity check Retransmission on error detection Automatic reception at the

More information

How To Program A Microcontroller With Memory On A Microchip Microcontroller

How To Program A Microcontroller With Memory On A Microchip Microcontroller Getting Started with On-chip Memory 2001 Microchip Technology Incorporated. All Rights Reserved. S0001A RAM/ROM(x14) 1 In this Getting Started tutorial you will learn about the various memory types found

More information

A highly integrated UAV avionics system 8 Fourth Street PO Box 1500 Hood River, OR 97031 (541) 387-2120 phone (541) 387-2030 fax CCT@gorge.

A highly integrated UAV avionics system 8 Fourth Street PO Box 1500 Hood River, OR 97031 (541) 387-2120 phone (541) 387-2030 fax CCT@gorge. A highly integrated UAV avionics system 8 Fourth Street PO Box 1500 Hood River, OR 97031 (541) 387-2120 phone (541) 387-2030 fax CCT@gorge.net Bill Vaglienti Ross Hoag April 10, 2003 Table of contents

More information

CHAPTER 6: Computer System Organisation 1. The Computer System's Primary Functions

CHAPTER 6: Computer System Organisation 1. The Computer System's Primary Functions CHAPTER 6: Computer System Organisation 1. The Computer System's Primary Functions All computers, from the first room-sized mainframes, to today's powerful desktop, laptop and even hand-held PCs, perform

More information

Università Degli Studi di Parma. Distributed Systems Group. Android Development. Lecture 1 Android SDK & Development Environment. Marco Picone - 2012

Università Degli Studi di Parma. Distributed Systems Group. Android Development. Lecture 1 Android SDK & Development Environment. Marco Picone - 2012 Android Development Lecture 1 Android SDK & Development Environment Università Degli Studi di Parma Lecture Summary - 2 The Android Platform Android Environment Setup SDK Eclipse & ADT SDK Manager Android

More information

Small Hardware Development and Prototyping Board for the SX28

Small Hardware Development and Prototyping Board for the SX28 Project Report: Small Hardware Development and Prototyping Board for the SX28 Project Number: PR57 1. Project Description 2. Schematic Diagram 3. Physical Diagram 4. Component Layout Diagram 5. Bill of

More information

Board also Supports MicroBridge

Board also Supports MicroBridge This product is ATmega2560 based Freeduino-Mega with USB Host Interface to Communicate with Android Powered Devices* like Android Phone or Tab using Android Open Accessory API and Development Kit (ADK)

More information

Faculty of Engineering Student Number:

Faculty of Engineering Student Number: Philadelphia University Student Name: Faculty of Engineering Student Number: Dept. of Computer Engineering Final Exam, First Semester: 2012/2013 Course Title: Microprocessors Date: 17/01//2013 Course No:

More information

EC313 - VHDL State Machine Example

EC313 - VHDL State Machine Example EC313 - VHDL State Machine Example One of the best ways to learn how to code is seeing a working example. Below is an example of a Roulette Table Wheel. Essentially Roulette is a game that selects a random

More information

Jonathan Worthington Scarborough Linux User Group

Jonathan Worthington Scarborough Linux User Group Jonathan Worthington Scarborough Linux User Group Introduction What does a Virtual Machine do? Hides away the details of the hardware platform and operating system. Defines a common set of instructions.

More information

Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C

Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C 1 An essential part of any embedded system design Programming 2 Programming in Assembly or HLL Processor and memory-sensitive

More information

Networking Remote-Controlled Moving Image Monitoring System

Networking Remote-Controlled Moving Image Monitoring System Networking Remote-Controlled Moving Image Monitoring System First Prize Networking Remote-Controlled Moving Image Monitoring System Institution: Participants: Instructor: National Chung Hsing University

More information

Product Development Flow Including Model- Based Design and System-Level Functional Verification

Product Development Flow Including Model- Based Design and System-Level Functional Verification Product Development Flow Including Model- Based Design and System-Level Functional Verification 2006 The MathWorks, Inc. Ascension Vizinho-Coutry, avizinho@mathworks.fr Agenda Introduction to Model-Based-Design

More information

FlowKit in-circuit debug system

FlowKit in-circuit debug system FlowKit in-circuit debug system www.matrixmultimedia.com HP299 Contents About this document 3 Board layout 3 General information 4 Detailed operation 4 Circuit diagram 7 2 Copyright About this document

More information

ELEC 5260/6260/6266 Embedded Computing Systems

ELEC 5260/6260/6266 Embedded Computing Systems ELEC 5260/6260/6266 Embedded Computing Systems Spring 2016 Victor P. Nelson Text: Computers as Components, 3 rd Edition Prof. Marilyn Wolf (Georgia Tech) Course Topics Embedded system design & modeling

More information

SECTION C [short essay] [Not to exceed 120 words, Answer any SIX questions. Each question carries FOUR marks] 6 x 4=24 marks

SECTION C [short essay] [Not to exceed 120 words, Answer any SIX questions. Each question carries FOUR marks] 6 x 4=24 marks UNIVERSITY OF KERALA First Degree Programme in Computer Applications Model Question Paper Semester I Course Code- CP 1121 Introduction to Computer Science TIME : 3 hrs Maximum Mark: 80 SECTION A [Very

More information

EE8205: Embedded Computer System Electrical and Computer Engineering, Ryerson University. Multitasking ARM-Applications with uvision and RTX

EE8205: Embedded Computer System Electrical and Computer Engineering, Ryerson University. Multitasking ARM-Applications with uvision and RTX EE8205: Embedded Computer System Electrical and Computer Engineering, Ryerson University Multitasking ARM-Applications with uvision and RTX 1. Objectives The purpose of this lab is to lab is to introduce

More information

Atmel AVR4027: Tips and Tricks to Optimize Your C Code for 8-bit AVR Microcontrollers. 8-bit Atmel Microcontrollers. Application Note.

Atmel AVR4027: Tips and Tricks to Optimize Your C Code for 8-bit AVR Microcontrollers. 8-bit Atmel Microcontrollers. Application Note. Atmel AVR4027: Tips and Tricks to Optimize Your C Code for 8-bit AVR Microcontrollers Features Atmel AVR core and Atmel AVR GCC introduction Tips and tricks to reduce code size Tips and tricks to reduce

More information

Lesson 10:DESIGN PROCESS EXAMPLES Automatic Chocolate vending machine, smart card and digital camera

Lesson 10:DESIGN PROCESS EXAMPLES Automatic Chocolate vending machine, smart card and digital camera Lesson 10:DESIGN PROCESS EXAMPLES Automatic Chocolate vending machine, smart card and digital camera 1 Automatic Chocolate Vending Machine (ACVM) 2 Diagrammatic representation of ACVM Keypad for user Interface

More information

Embedded Software development Process and Tools:

Embedded Software development Process and Tools: Embedded Software development Process and Tools: Lesson-2 Integrated Development Environment (IDE) 1 1. IDE 2 Consists of Simulators editors, compilers, assemblers, etc., IDE 3 emulators logic analyzers

More information

Section 29. Real-Time Clock and Calendar (RTCC)

Section 29. Real-Time Clock and Calendar (RTCC) Section 29. Real-Time Clock and Calendar (RTCC) HIGHLIGHTS This section of the manual contains the following topics: 29.1 Introduction... 29-2 29.2 Status and Control Registers... 29-3 29.3 Modes of Operation...

More information

Hardware and Software Requirements

Hardware and Software Requirements C Compiler Real-Time OS Simulator Training Evaluation Boards Installing and Using the Keil Monitor-51 Application Note 152 May 31, 2000, Munich, Germany by Keil Support, Keil Elektronik GmbH support.intl@keil.com

More information

Design of a High Speed Communications Link Using Field Programmable Gate Arrays

Design of a High Speed Communications Link Using Field Programmable Gate Arrays Customer-Authored Application Note AC103 Design of a High Speed Communications Link Using Field Programmable Gate Arrays Amy Lovelace, Technical Staff Engineer Alcatel Network Systems Introduction A communication

More information

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives Introduction to Programming and Algorithms Module 1 CS 146 Sam Houston State University Dr. Tim McGuire Module Objectives To understand: the necessity of programming, differences between hardware and software,

More information

THREE YEAR DEGREE (HONS.) COURSE BACHELOR OF COMPUTER APPLICATION (BCA) First Year Paper I Computer Fundamentals

THREE YEAR DEGREE (HONS.) COURSE BACHELOR OF COMPUTER APPLICATION (BCA) First Year Paper I Computer Fundamentals THREE YEAR DEGREE (HONS.) COURSE BACHELOR OF COMPUTER APPLICATION (BCA) First Year Paper I Computer Fundamentals Full Marks 100 (Theory 75, Practical 25) Introduction to Computers :- What is Computer?

More information

CSC 2405: Computer Systems II

CSC 2405: Computer Systems II CSC 2405: Computer Systems II Spring 2013 (TR 8:30-9:45 in G86) Mirela Damian http://www.csc.villanova.edu/~mdamian/csc2405/ Introductions Mirela Damian Room 167A in the Mendel Science Building mirela.damian@villanova.edu

More information

AN1229. Class B Safety Software Library for PIC MCUs and dspic DSCs OVERVIEW OF THE IEC 60730 STANDARD INTRODUCTION

AN1229. Class B Safety Software Library for PIC MCUs and dspic DSCs OVERVIEW OF THE IEC 60730 STANDARD INTRODUCTION Class B Safety Software Library for PIC MCUs and dspic DSCs AN1229 Authors: Veena Kudva & Adrian Aur Microchip Technology Inc. OVERVIEW OF THE IEC 60730 STANDARD INTRODUCTION This application note describes

More information

10-bit Σ ADC from a PIC16F84

10-bit Σ ADC from a PIC16F84 1-bit Σ ADC from a PIC16F84 Jesús Arias 22nd November 23 1 The circuit +5V 1 + 1uF 1nF 1nF 33 4.7 V DTR U1 Analog Input ( 5 Volt) R3 68K R1 1K R2 1K C1 33nF PIC16F84 RB7 RA2 RA3 ad2.asm OSC1 OSC2 X1 R4

More information

Workshop on Android and Applications Development

Workshop on Android and Applications Development Workshop on Android and Applications Development Duration: 2 Days (8 hrs/day) Introduction: With over one billion devices activated, Android is an exciting space to make apps to help you communicate, organize,

More information

3. Programming the STM32F4-Discovery

3. Programming the STM32F4-Discovery 1 3. Programming the STM32F4-Discovery The programming environment including the settings for compiling and programming are described. 3.1. Hardware - The programming interface A program for a microcontroller

More information

Embedded Development Tools

Embedded Development Tools Embedded Development Tools Software Development Tools by ARM ARM tools enable developers to get the best from their ARM technology-based systems. Whether implementing an ARM processor-based SoC, writing

More information

Embedded Systems on ARM Cortex-M3 (4weeks/45hrs)

Embedded Systems on ARM Cortex-M3 (4weeks/45hrs) Embedded Systems on ARM Cortex-M3 (4weeks/45hrs) Course & Kit Contents LEARN HOW TO: Use of Keil Real View for ARM Use ARM Cortex-M3 MCU for professional embedded application development Understanding

More information

The Bus (PCI and PCI-Express)

The Bus (PCI and PCI-Express) 4 Jan, 2008 The Bus (PCI and PCI-Express) The CPU, memory, disks, and all the other devices in a computer have to be able to communicate and exchange data. The technology that connects them is called the

More information