Difference between revisions of "CSC270 Homework 10"

From dftwiki3
Jump to: navigation, search
(Part 2: Experimentation)
(Submission)
Line 116: Line 116:
 
==Submission==
 
==Submission==
  
All that is required for this assignment is a fully commented listing  of your two functions SendOne and SendZero, along with  one or several pictures of the waveform generated by your program, '''clearly''' indicating that it is sending all the bits of the Ascii code for 'A' (0x41).  Make sure that the time scale is clearly indicated.
+
All that is required for this assignment is a fully commented listing  of your two functions SendOne and SendZero, along with  several pictures of the waveform generated by your program, '''clearly''' indicating that it is sending all the bits of the Ascii code for 'A' (0x41).  3 pictures should cover all the important details:
 +
* one picture should show the 38KHz waveform clearly
 +
* one picture should show a 1 bit followed by a 0 bit (or vice versa), similarly to the figure at the top of this page,
 +
* one picture sould show the whole byte being sent out.
  
You do not need to assemble the functions.  If you can generate the waveforms, it means you were able to generate the opcodes correctly.  You do not need to include the whole program, just the two functions.
+
Make sure that the time scale is clearly indicated.
 +
 
 +
You do not need to show the opcodes in the listing of your  functions.  If you can generate the waveforms, it means you were able to generate the opcodes correctly.  You do not need to include the whole program, just the two functions.

Revision as of 20:39, 15 April 2009

--D. Thiebaut 18:51, 14 April 2009 (UTC)


This assignment is due on Wednesday, April 22nd. You are encouraged to work in pairs on this assignment.

Problem #1

CSC270 Sony IR remote signal.gif

Part 1: Driver Functions

This picture is taken from the following Web site: http://www.sbprojects.com/knowledge/ir/nec.htm .

It depicts part of a broader protocol for sending commands over infrared communication between a remote device and a receiver (consumer electronics device).

You will notice that to send a '1', the remot actually sends a 560 us burst of a signal with a frequency of 38 KHz, followed by a gap with no activity with a duration of 2.25 ms - 560 us. (1 sec = 1000 ms, and 1 ms = 1000 us)

Similarly, to send a '0', the remote sends the same burst of 26 cycles of a 38KHz signal, followed by a shorter gap of 1.12 ms - 560 us.

Write two 6811 assembly functions that can be used to send a 1 and to send a 0 following the above protocol. One function will send a 1 and will generate the waveform shown in the first half of the figure above. The second function will send a 0 by generating the second half of the waveform shown above.

Part 2: Experimentation

Insert the code you have found for the previous part in the program below.

Assemble the program by hand.

Enter the program by hand in the kit, put one probe on the Q output of the flipflop you are using for this test, and take a picture of the waveform showing that the ASCII code for 'A' is indeed sent over the LED.

You may have to modify the program to make it send 'A' repeatedly, over and over...

;--------------------------------------------------------------------
; SendAsciiNEC.asm
; takes the ascii code stored in the byte variable data and sends it
; to output port at address 8000, which we assume is connected to an
; infrared LED.
; The protocole used is that of the NEC corporation, and fully described
; in  http://www.sbprojects.com/knowledge/ir/nec.htm .
;
; All 8 bits are sent, one after the other.  
; The program returns to the monitor when finished.
;
; The starting point is at label Start.
;
                org     0000
saveB           FCB     0       ; variable to save AccB  in
data            FCB     'A'     ; ascii code for 'A'

;--------------------------------------------------------------------
;      MAIN PROGRAM
; All 8 bits stored in byte data are sent, one after the other.  
;
                org     0010
start:          ldab    #8      ; get ready to send 8 bits


loop:           ldaa    data    ; get byte to send
                anda    #1      ; get the least significant bit of Acca
                cmpa    #1      ; is it 1?
                beq     send1   ; if so go send a 1
                jsr     SendZero; if not, send a 0
                jmp     testEnd ; go to end of loop

Send1:          jsr     SendOne ; send a 1
                
testEnd:        ldaa    Data    ; get data
                lsra            ; shift Acca 1 bit to the right
                staa    Data    ; save it back in data
                decb            ; decrement AccB
                cmpb    #0      ; is it 0 yet?
                bne     loop    ; no, still more bits to send
                jmp     C000    ; done, return control to Monitor

;--------------------------------------------------------------------
; SendOne: sends a '1' to the InfraRed LED at Port Address
;          8000 using the NEC protocole presented at 
;          http://www.sbprojects.com/knowledge/ir/nec.htm .
;          ACCB is not modified by the procedure.
;          ACCA is very likely modified by the procedure.
SendOne:        stab    saveB   ; save AccB

                ; your code goes here
                .
                .
                .

                ldab   saveB     ; restore AccB
                rts

;--------------------------------------------------------------------
; SendZero: sends a '0' to the InfraRed LED at Port Address
;          8000 using the NEC protocole presented at 
;          http://www.sbprojects.com/knowledge/ir/nec.htm .
;          ACCB is not modified by the procedure.
;          ACCA is very likely modified by the procedure.
SendZero:       stab    saveB   ; save AccB

                ; your code goes here
                .
                .
                .


                ldab   saveB     ; restore AccB
                rts
 

Submission

All that is required for this assignment is a fully commented listing of your two functions SendOne and SendZero, along with several pictures of the waveform generated by your program, clearly indicating that it is sending all the bits of the Ascii code for 'A' (0x41). 3 pictures should cover all the important details:

  • one picture should show the 38KHz waveform clearly
  • one picture should show a 1 bit followed by a 0 bit (or vice versa), similarly to the figure at the top of this page,
  • one picture sould show the whole byte being sent out.

Make sure that the time scale is clearly indicated.

You do not need to show the opcodes in the listing of your functions. If you can generate the waveforms, it means you were able to generate the opcodes correctly. You do not need to include the whole program, just the two functions.