19
Over-view of Lab. 1 For more details – see the Lab. 1 web-site There will be a 20 min prelab quiz (based on Assignment 1 and 2) at the start of the lab. session so that you can demonstrate your preparedness for Lab. 0 – Don’t be late

Over-view of Lab. 1

Embed Size (px)

DESCRIPTION

Over-view of Lab. 1. For more details – see the Lab. 1 web-site There will be a 20 min prelab quiz (based on Assignment 1 and 2) at the start of the lab. session so that you can demonstrate your preparedness for Lab. 0 – Don’t be late. - PowerPoint PPT Presentation

Citation preview

Page 1: Over-view of Lab. 1

Over-view of Lab. 1

For more details – see the Lab. 1 web-site

There will be a 20 min prelab quiz (based on Assignment 1 and 2) at the start of the lab. session so that you can demonstrate your preparedness for Lab. 0 – Don’t be late

Page 2: Over-view of Lab. 1

2 /17

Print out the Lab. 1 web-pages for use as reference during the lab. period and during the lab quiz – Access to the web is not available. There will be a short 15-minute in-class quiz at

the start of the lab. period – don’t be late

Quiz will be based on knowledge demonstrated during assignments 1 and 2

You may make use of YOUR printed notes and YOUR data books. Access to the web will not be available

Page 3: Over-view of Lab. 1

3 /17

Lab. 1

We want to build a audio controller Audio in captured using audio A/D (CODEC) Audio out generated using audio D/A (CODEC) Manipulate the sound quality Push buttons to control audio controller

operations LED lights to display operation results and

sound volume level (dancing lights)

Page 4: Over-view of Lab. 1

4 /17

Lab. 1 – Demonstration stream

Your group must come into the laboratory class prepared to be able to demonstrate all of the following by the end of class period You will make use of some of the code developed during the

assignments (Note assignments may be due AFTER the laboratory) Capture the audio signal and replay the signal Manipulate the audio signal Initialize the LED display interface (so that it works) Write a value to the LED display Read, and use, a value stored in the LED display Initialize the push-button controller interface Read, and use, a value provided by the push-button controller. Demonstrate tests to show that these operations work as required Understand, but not implement, how these operations can be used to

provide the functionality of an audio controller.

Page 5: Over-view of Lab. 1

5 /17

Main Code – pseudo code

main( ) {Launch the Analog Devices audio “echo” program – a background

interrupt-driven task that is given to you – you will modify this code

InitializeLEDInterfaceASM( );InitializePFInterfaceASM( ); // Push-button controller

Wait for button1 to be pressed and released (ReadButtonASM() ), then play the sound at half-volume.

Wait for button2 to be pressed and released, play the sound at normal volume

Each time button3 is pressed and released, transfer a known value from an array to the LED display (WriteLEDASM( ) ) and check that the expected value is displayed (ReadLEDASM( ) )

Wait for button4 to be pressed and released, quit the program (turn off the sound and stop the processor)

}

Page 6: Over-view of Lab. 1

6 /17

Lab. 1 – Application stream

Everything that the demonstration stream completes

In addition – do it for real – in real time Adjust the volume control dynamically On command -- make your favourite artist sound weird Generate the extremely fascinating (but completely

useless) dancing lights which change with the audio stream volume level

Have the opportunity to spend even more hours going for bonus marks to the laboratories where the volume control is done using a light sensor or ………

Page 7: Over-view of Lab. 1

7 /17

Task 1 – Demonstration / Application streamsDownload audio-talk-through program

If you have not already done so, download and expand ENCM415Directory2006.zip file (used in assignment 1) so that you have the correct directory. structure and test driven development environment needed for Laboratory 1.

Download and expand the files in 06CPP_Talkthrough.zip into your Lab1 directory.

Add the CPP_Talkthrough project in your Lab. 1  directory to the VisualDSP environment -- compile and link.

Download the executable (.dxe) file onto the BF533 processor.

Hook up your CD or IPOD output to the CJ2 stereo input. Hook up your ear-phones to the CJ3 stereo output. Run the CPP_Talkthrough.dxe executable and check that the talk

through program is working.

Page 8: Over-view of Lab. 1

8 /17

Task 2 -- Convert ProcessDataCPP( ) to ProcessDataASM ( ) – Both streams In talkthrough.h. add a prototype for your assembly code function

Process_DataASM;

In ISR.cpp change to

// call function that contains user code#if 0      Process_DataCPP();  // Use the C++ version#else     Process_DataASM(); // C assembly code routines especially developed for Lab. 1#endif 

Right-click on ProcessDataCPP.cpp entry. Use "FILE OPTIONS“ to exclude linking

Use PROJECT | clean project Add your ProcessDataASM.asm file to the project, recompile and link.

Check that your code works More details on the Lab. 1 web pages

Page 9: Over-view of Lab. 1

9 /17

Task 3 – Initialize the Programmable flag interface – 16 I/O lines on the Blackfin

Warning – could burn out the Blackfin processor if done incorrectly

You need to set (store a known value to) a number of Blackfin internal registers

Most important ones FIO_DIR – Data DIRection – 0 for input **** FIO_INEN – INterface ENable FIO_FLAG_D – Programmable FLAG Data register

Page 10: Over-view of Lab. 1

10 /17

Why do you need to know how to do read (load) and write (store) on internal registers?

Flag Direction register (FIO_DIR) Used to determine if the PF bit is to be used for input or

output -- WARNING SMOKE POSSIBLE ISSUE Need to set pins PF11 to PF8 for input, leave all other pins

unchanged

Page 11: Over-view of Lab. 1

11 /17

Registers used to control PF pins

Flag Input Enable Register Only activate the pins you want to use (saves power in

telecommunications situation) Need to activate pins PF11 to PF8 for input, leave all other pins

unchanged

Page 12: Over-view of Lab. 1

12 /17

Registers used to control PF pins

Flag Data register (FIO_FLAG_D) Used to read the PF bits (1 or 0) Need to read pins PF11 to PF8, ignore all other pins values

Page 13: Over-view of Lab. 1

13 /17

Task 3 – Setting up the programmable flag interface

Follow the instructions carefully FIO_DIR – direction register – write 0’s to all bits FIO_INEN – input enable register – write 1’s to

bits 8, 9, 10, 11 Other registers set to 0

There is a test program that will enable you to check your code – provide a screen dump of test result.

Page 14: Over-view of Lab. 1

14 /17

Task 4 – Read the switches on the front pannel

Final laboratory requirements

SW1 connected to PF8 -- Mute button (This task) SW2 connected to PF9 -- Gargle button (Task 5) SW3 connected to PF10 -- Volume up (Task 7)

SW4 connected to PF11 -- Volume down (Task 7)

Build Initialize_ProgrammableFlagsASM ( ) MUST HAVE 50 pin cable connected between logic

board and Blackfin Logic board power supply must be turned on

Page 15: Over-view of Lab. 1

15 /17

#include <defsBF533.h>

#include <macros.h>

.global _ReadProgrammableFlags__Fv;

_ReadProgrammableFlags__Fv

LINK 16;

P1.L = lo (FIO_FLAG_D); // could be P0

P1.H = hi (FIO_FLAG_D);

R0 = W[P1] (Z);

P0 = [FP + 4];

UNLINK;

_ReadProgrammableFlags__Fv; JUMP (P0);

Must use W [ ]since the manual shows that FIO_FLAG_D register is 16-bits

Must use W[P1] (Z) zero-extend as this adds 16 zeros to the 16 bits from FIO_FLAG_D register to make 32-bits to place into R0

int ReadProgrammableFlags( )

Page 16: Over-view of Lab. 1

16 /17

Other tasks depend on the stream

Demo-streamWAIT for button1 to be pressed and released

(ReadButtonASM() ), then play the sound at half-volume.

Wait for button2 to be pressed and released, play the sound at normal volume

Application-streamWHILE button 1 is pressed – add a mute operationWHILE button 2 is pressed – add a gargle operation IF both pressed – then mute operationAfter release of buttons (either order) normal operation

Page 17: Over-view of Lab. 1

17 /17

Gargling operation – application stream

Need to add a simple counter that increments by 1 every 1/44000 s (each time that an audio sample is obtained)

Use the counter to turn the sound off and on every ½ s

Gargling sound is produced. You need to have a signed demo sheet from a

2nd or 4th year student. Bonus if the student is not from department

Page 18: Over-view of Lab. 1

18 /17

LED interface and Dancing Lights

LED interface setup code provided

Demo stream Transfer values from a known array to the LED

Application stream Writing in “C++” code (interfaced to your assembly

code) – display the amplitude (absolute value) of the sound – will need to store 32 values in an array and generate (running) average

Page 19: Over-view of Lab. 1

19 /17

Tests

There will be software tests (E-TDD) to allow you to demonstrate that your code works correctly

Note there are test codes available to test out your equipment This code can be used to test the switches and the

LED interface on your board. SwitchToLED.dxe This is the final version of my code for Lab. 1.  

DrSmithLab1Final.dxe