Exercise 7ASC_1 - DAvE Configurations

7
HOT167-1 Version 2.0 Infineon Technologies Corp. June 99 1 * C167CS not yet supported by DAvE V1.0 CD ROM. See “Hints regarding DAvE.” Exercise 7ASC_1 - DAvE Configurations Start DAvE Create new Project with microcontroller C167CR/CS* • Project name: 7ASC_1 • Select project path: c:\hot167_1\7asc_1 Project Settings: • General: - Select Keil Compiler, SMALL model • System Clock: - External Oscillator Frequency: Set to 5 MHz • Startup Configuration: - Bus Type after Reset: Set to 16 bit DEMUX - Write Configuration: Pin #WR and #BHE operates as #WRL and #WRH • Save & close

description

Exercise 7ASC_1 - DAvE Configurations. Start DAvE Create new Project with microcontroller C167CR/CS* Project name: 7ASC_1 Select project path: c:\hot167_1\7asc_1 Project Settings: General: Select Keil Compiler, SMALL model System Clock: External Oscillator Frequency: Set to 5 MHz - PowerPoint PPT Presentation

Transcript of Exercise 7ASC_1 - DAvE Configurations

Page 1: Exercise 7ASC_1 - DAvE Configurations

HOT167-1 Version 2.0Infineon Technologies Corp.June 99

1

* C167CS not yet supported by DAvE V1.0 CD ROM. See “Hints regarding DAvE.”

Exercise 7ASC_1 - DAvE Configurations

Start DAvE Create new Project with microcontroller C167CR/CS*

• Project name: 7ASC_1• Select project path: c:\hot167_1\7asc_1

Project Settings:• General:

- Select Keil Compiler, SMALL model • System Clock:

- External Oscillator Frequency: Set to 5 MHz• Startup Configuration:

- Bus Type after Reset: Set to 16 bit DEMUX- Write Configuration: Pin #WR and #BHE operates as #WRL

and #WRH• Save & close

Page 2: Exercise 7ASC_1 - DAvE Configurations

HOT167-1 Version 2.0Infineon Technologies Corp.June 99

2

Exercise 7ASC_1 - DAvE Configurations (cont.)

Configure GPT1:• Core Timer 3:

- Timer 3 Mode: Timer Mode- Up/Down Control: Count down- Timer Start: Start T3 after initialization- Input Selection: Fcpu/16 (this results in a resolution of 0.8us

and a period of 52.4ms)- Timer Register: Load T3 Register with 10ms value

((10ms / 0.8us) in HEX) (0x30d3)- Interrupt Control: Enable Timer 3 interrupt

• Auxiliary Timer 4:- Timer 4 Mode: Reload Timer 3 with T4- Timer Register: Load T4 Register with 10ms value

((10ms / 0.8us) in HEX) (0x30d3)- Input Selection: Any transition of output toggle latch T3OTL

Page 3: Exercise 7ASC_1 - DAvE Configurations

HOT167-1 Version 2.0Infineon Technologies Corp.June 99

3

Exercise 7ASC_1 - DAvE Configurations (cont.)

Configure GPT1 (cont.)• Interrupts:

- Choose interrupt level for GPT1 Timer 3 interrupt• Functions:

- Include GPT1 initialization function GT1_vInit• Save & close

Configure ASC USART:• Control:

- Global: Use pin TxD0 for ASC- Receiver: Enable Receiver (S0REN)

• Baudrate:- Required Baudrate: Depends on your debugger configuration;

Default after installation is 9600 baud• Functions

- Include ASC_vInit, ASC_vSendData• Save & close

Generate Code

Page 4: Exercise 7ASC_1 - DAvE Configurations

HOT167-1 Version 2.0Infineon Technologies Corp.June 99

4

Exercise 7ASC_1 - µVision2 Configurations

Start µVision2 Open Project c:\hot167_1\7asc_1\7asc_1.uv2 (Project | Open Pr.) Add Files:

• Go to Project | Targets, Groups, Files…• Click ‘Groups / Add Files’• Select ‘Source Group 1’• Click ‘Add Files to Group’• Select all C files and click ‘add’• ???Enter file name ‘start.asm’, click ‘add’ (Assembler Startup File)• Click ‘Close’ and ‘OK’• Double-click all files in the Project Window to open them

Select Target Hardware (kitCON-167):• Go to Project | Options for Target ‘Target 1’• Go to ‘Debug’ tab• Click ‘Settings’ (upper right hand corner)• Monitor configuration: select ‘Phytec KC167’• Click ‘OK’ twice

Page 5: Exercise 7ASC_1 - DAvE Configurations

HOT167-1 Version 2.0Infineon Technologies Corp.June 99

5

Exercise 7ASC_1 -µVision2 Configurations (cont.)

Edit MAIN.C:• include endless loop in main():

// USER CODE BEGIN (Main,2)

while(1) {};

// USER CODE END

Edit GT1.C:• Define Global Variable ascii_char:// USER CODE BEGIN (GT1_General,2) unsigned char ascii_char;// USER CODE END

• In Timer 3 Interrupt Service Routine (GT1_viIsrTmr3(void)): Write ascii_char to ASC and increment ascii_char: // USER CODE BEGIN (GT1_IsrTmr3,1) ASC_vSendData(ascii_char++);// USER CODE END

Page 6: Exercise 7ASC_1 - DAvE Configurations

HOT167-1 Version 2.0Infineon Technologies Corp.June 99

6

Exercise 7ASC_1 - Running the Program

Reset Target Hardware (Press Reset Button on Starter Kit)

Build Project (Project | Rebuild Target) Run integrated Debugger from within µVision2

• Debug | Start / Stop Debug Session (click ‘OK’ when prompted)• The Debugger will load the Keil Monitor into the kitCON-167’s RAM

via bootstrap loader• Object file c:\hot167_1\7asc_1\7asc_1 will be loaded automatically

and the debugger will go to main(). Go! (Debug | Go)

Program Verification:• Watch Serial Window in Debugger (View | Serial Window #1)

(right mouse button lets you switch between ASCII and Hex output)• Connect Scope to P3.10 / TxD0 (connector X3 pin 110)

(select 200 us/Div, trigger on falling edge)• Hint: When stopping the program, override the appearing error

message by pressing “continue”. The program will stop.

Page 7: Exercise 7ASC_1 - DAvE Configurations

HOT167-1 Version 2.0Infineon Technologies Corp.June 99

7

Exercise 7ASC_1 - Screenshot

P3.10 / TxD0