V.) Using of the TASKING - EDE Development Tools:

1. Step: Install the Tool chain - here you can download the Tasking Development Tools:

http://www.tasking.com/products/C166-ST10/demo_req.html

Download dc166-75p-zip

Extract with WinZip

Execute setup.exe and choose C:\dc166 for the installation path

2. Step: Start Tasking EDE, select directory and include the DAvE Files

If you see an open project close it: Project Project Space - Close

File

Change Directory

choose C:\e10t

# OK

Project

Project Space

New

choose e10t

# OK

Add new project to project space

Filename: insert e10t

OK

OK

(File View window) right mouse button click e10t (0Files) Add Existing Files Browse insert File-name (Dateiname) *.asm select Cstartx2.asm Open (Φffnen) ### OK
repeat this with: *.c ( Asc0.c CC1.c Io.c Main.c Serio.c ) and *.h ( Asc0.h CC1.h Io.h Main.h Serio.h )

3. Step: Configure Compiler, Assembler, Linker, Locater, Hex-Converter and Build Control:

click EDE

ό Expert Mode

# EDE - Project Options - CPU

CPU type: choose XC164CS OK

EDE - Linker/Locater Options - Format

ό Intel HEX records for EPROM programmers (.hex)

## EDE - Linker/Locater Options Format Options

Output format (IHEX): choose Intel hex32 records

EDE - Linker/Locater Options - Memory

Rom area(s) input 0C00000h 0C1FFFFh

EDE - Linker/Locater Options Specials

insert Vector table base address 0C00000h

EDE - Linker/Locater Options Small Model

click Ÿ Linear: 48K

insert First page of 48K range in Small Linear model: 300h

4. Step: Insert your application specific program:

double click Main.c: insert Global Variables:

char menu[] = "\r\n\n\n\n" "1 ... LED P9_P4 ON\r\n" "2 ... LED P9_P4 OFF\r\n" "3 ... LED P9_P4 blinking\r\n" " \r\n"; char question[] = "your choice: "; char message1[] = "\n\r*** LED is ON ***\r\n"; char message2[] = "\n\r*** LED is OFF ***\r\n"; char message3[] = "\n\r*** LED is BLINKING ***\r\n"; int wait=3; bit blinking=ON; char select=' ';

Main.c: insert User Code

void Configure_PLL (void) { #pragma asm // Set CPU security level to unprotected mode extr #4 mov SCUSLC, #0AAAAh mov SCUSLC, #05554h mov SCUSLC, #096FFh mov SCUSLC, #0h mov FOCON, #80h ;// Clockout signal ist visible on P3.15 #pragma endasm PLLCON = 0x7889; // Select 20MHz (@8 MHz crystal) CPU frequency #pragma asm // Set CPU security level to protected mode extr #4 mov SCUSLC, #0AAAAh mov SCUSLC, #05554h mov SCUSLC, #096FFh mov SCUSLC, #01800h #pragma endasm } void Configure_SYSCON3 (void) { #pragma asm // Set CPU security level to unprotected mode extr #4 mov SCUSLC, #0AAAAh mov SCUSLC, #05554h mov SCUSLC, #096FFh mov SCUSLC, #0h mov FOCON, #80h ;// Clockout signal ist visible on P3.15 #pragma endasm #pragma asm extr #01h ;// Extended SFR access. MOV SYSCON3, #0h ;// alle Peripherals aktivieren #pragma endasm #pragma asm // Set CPU security level to protected mode extr #4 mov SCUSLC, #0AAAAh mov SCUSLC, #05554h mov SCUSLC, #096FFh mov SCUSLC, #01800h #pragma endasm } char input (void) { char in=' '; do { printf(question); while (!ASC0_RIC_IR) _nop; ASC0_RIC_IR=0; in = ASC0_RBUF; }while (in!='1' && in!= '2' && in != '3'); return in; }

Ÿ

Ÿ

Ÿ

insert the following code in the main function:

Configure_PLL (); Configure_SYSCON3 ();
while(wait); while (1) { printf(menu); select=input(); switch (select) { case '1': blinking=OFF; P9_P4=LEDON, printf(message1); break; case '2': blinking=OFF; P9_P4=LEDOFF, printf(message2); break; case '3': blinking=ON, printf(message3); break; } }

double click Main.h and insert the following Defines:

#define OFF 0 #define ON 1 #define LEDON 0 #define LEDOFF 1

insert Global Variables

extern bit blinking; extern int wait;

insert Includes (for printf() )

#include <stdio.h>

double click CC1.C

insert code for T0 interrupt service routine:

if(wait) wait--; if(blinking) P9_P4=~P9_P4;

5. Step: Generate your application program generate the hex file for Memtool:

Project

Rebuild

Now you can close your project and Tasking EDE:

Project

Project Space

Close

File

# Exit

Now you can program the hex output file e10t.HEX with Memtool in the OnChipFlash (Program Memory) of the XC164CS microcontroller.