04EI 12.08.2013 Embedded Systems Page 1 164C L XTAL C166- C166- Core Core Port 5 Port 3 CPU Dual Port RAM 2 KByte Interrupt Controller Watchdog Peripheral Data External Instr./Data Instr./Data USART ASC BRG GPT1 16 16 16 16 32 PEC 64 K ROM (C164 CI-8RM) or OTP (C164CI-8EM) Interrupt Bus Data Data Port 8 BRG SSC Sync. Channe l (SPI) PLL-Oscillator prog. Multiplier: 0.5; 1; 1.5; 2; 2.5; 3; 4; 5 XBUS (16-bit NON MUX Data / Addresses) T2 T4 T3 13 ext. IR Full-CAN Interface V2.0B active RTC 10-Bit ADC Timer 7 Timer 8 Port 1 Timer 13 1 Comp. Channel 3/6 CAPCOM Channels CAPCOM6 Unit for PWM Generation 8 9 4 16 6 16 Port 4 8-Channels External Bus 8/16 bit MUX only & XBUS Control CAPCOM 2 8-Channel C164CI Block Diagram P4.6/ CAN TxD P4.5/ CAN RxD Port 0
27
Embed
12.08.2013Embedded SystemsPage 1 C166-Core Port 5 Port 3 CPU Dual Port RAM 2 KByte Interrupt Controller Watchdog Peripheral Data External Instr./Data Instr./Data.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
100ns effective execution time (20 MHz fCPU) Three Pre-Fetch-Steps in word size (Bus Controller) for supporting of the
Pipeline Optimized execution of jumps
–For jump instructions (Jump, Cond. Jump, Call, Return,...) usually only one additional machine cycle is necessary, to fetch the instruction at the destination address
Jump Cache
–For the execution of loops no additional machine cycle is necessary
– 4 programmable “Chip Selects” and programmable BUS-control signals help to avoid external logic.
Address Space
04EI
25.9.2013Embedded Systems Page 9
Internal and external address mapping of the C164CI
Bit-adressierbarer Bereich
X-Bus Peripheral
Segment 0 contains the internal memory
Internes RAM
512 BytesSFR’s
2kInternes
RAM
ExternerSpeicher
InternesROM /
Flash E²PROM(can be mapped to Segm. 1 )
512 BytesESFR’s
0x000000
0x008000
0x00FE00
0x00FA00
0x00F600
0x00F200
0x0100007 0
32k
0.5k
Reserviert
Up to 4 MBytes
Code Segments Daten Pages
0
1
2
3
3
2
1
0
7
6
5
4
11
10
9
8
15
14
13
12
InternalROM/
FLASH2*32k
0x010000
0x020000
0x030000
0x040000
Full -CANFull -CAN0x00F000
0x00E800Reserviert
0.5k
0x000000
04EI
12.8.2013Embedded Systems Page 10
The programming language C for the C164
C166 is the realisation of ANSI-C for the microcontroller-family C166.
The C166-Compiler provides a number of extensions of the ANSI-C Standard. Ispecially such, that directly support the C 166-architecture:
C166-denotation commentary
memory types As completition to the „storage class" to every definition of a variable a „memory type " can be specified. This allows a from the actual „memory model" independent addressing of variables in different address spaces of the 166-systems. Following typs are defined:
near, idata, bdata, sdata, far, huge, xhuge.sfr Is used as declaration of "Special-Function-Register" (SFR)
of the 166-family
sbit Declaration of Bits within SFR's.
bit Data type bit. Return values and passing parameters of functions can be of type bit.
bit-addressable Variables in bit addressable space can be defined as memory type by means of bdata.
04EI
12.08.2013Embedded Systems Page 11
The programming language C for the microcontroller C164
C166-denotation commentary
register bank (using) Each function can contain a declaration, in which the register bank to be used can be set.
interrupt Functions can declared als Interrupt-Service-Routines by indication of the interrupt names respectively – vectors.
register mask The C166-Compiler generates for each C-function a register-mask, in which the registers used by the function are listed. Those can be used as funktion prototype, due to optimize the usage of the registers.
RTX166 tasks By the keyword _task_ the functions is specified as a task of the operating system RTX166.
New Keywords (summarisation):Memory types: near, idata, bdata, sdata, far, huge, xhugeData types: bit, sfr, sbitFunctions: interrupt, _task_, using
04EI
12.08.2013Embedded Systems Page 12
Memory Types
Type Address space
near 16-Bit addresses up to 64 kBytes
idata On-chip RAM (fastest access)
bdata Bit-addressable On-chip-RAM
sdata System Page (0xC000-0xFFFF) inclusive SFR‘s
far 32-Bit Pointer with 16-Bit address calculation, the size of the object is 16 kByte.
huge 32-Bit Pointer with 16-Bit, address calculation, the size of the object is 32 kByte.
xhuge 32-Bit Pointer with 32-Bit address calculation, the size of the object is 16 MByte.
The programming language C for the microcontroller C164
04EI
12.08.2013Embedded Systems Page 13
According to the memory types memory models can be predeterminded as presettings, which always will be used, when no memory type is explicitly specified by the variable – or function
This is done by the preprocessor directive: # pragma storage model
The programming language C for the microcontroller C164
Storage model Variable functions Segmentation Code size
TINY near near no 64kSMALL near near yes 64kCOMPACT far near yes 64kHCOMPACT huge near yes 64kMEDIUM near far yes unlimitedLARGE far far yes unlimitedHLARGE huge far yes unlimited
04EI
12.08.2013Embedded Systems Page 14
Data types: : size of memory and range of values
Datentyp size of memory range of values
bit # 1 Bit 0 or 1
signed char 1 Byte -128 to +127
unsigned char 1 Byte 0 to 255
signed int 2 Bytes -32768 to + 32767
unsigned int 2 Bytes 0 to 65535
signed long 4 Bytes -2147483648 to +2147483642
unsigned long 4 Bytes 0 to 4294967295
float 4 Bytes 1.176E-38 to 3.40E+38
double 8 Bytes 1.7E-308 to 1.7E+308
pointer 2/4 Bytes Address of the object
The programming language C for the microcontroller C164
Datatypes for the access to Special Function Registers (SFR)
sbit # 1 Bit 0 or 1
sfr # 2 Bytes 0 to 65535
# special data types in C166, which are not defined in ANSI-C.
Allows variable timing of CPU-controlling signals by software Realizes up to 4 Chip-Select-Signals Selection of 4 address ranges possible
Special Function Register BUSCON0..4Programmable timingsDeterminition of CS# - signalsSelection of the bandwith of the Data-BUS 8 / 16 Bit
Special Function Register ADDRSEL1..4Programmable ranges of the address space for the access to external components with the properties of the assigned BUSCONx- registers.