Difference between revisions of "CSC270 Homework 10"

From dftwiki3
Jump to: navigation, search
(Part 2: Experimentation)
 
(4 intermediate revisions by the same user not shown)
Line 20: Line 20:
 
It depicts part of a broader protocol for sending commands over infrared communication between a remote device and a receiver (consumer electronics device).
 
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)
+
You will notice that to send a '1', the remote 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.
 
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.
Line 32: Line 32:
 
Assemble the program by hand.
 
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.   
+
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 pictures 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...
 
You may have to modify the program to make it send 'A' repeatedly, over and over...
 +
 +
You may also want to generate another signal that is activated regularly, but less frequently than the waveform signal, so that you can easily synchronize the scope to the waveform(s).
  
 
<code><pre>
 
<code><pre>
Line 80: Line 82:
  
 
;--------------------------------------------------------------------
 
;--------------------------------------------------------------------
; SendOne: sends a '0' to the InfraRed LED at Port Address
+
; SendOne: sends a '1' to the InfraRed LED at Port Address
 
;          8000 using the NEC protocole presented at  
 
;          8000 using the NEC protocole presented at  
 
;          http://www.sbprojects.com/knowledge/ir/nec.htm .
 
;          http://www.sbprojects.com/knowledge/ir/nec.htm .
Line 96: Line 98:
  
 
;--------------------------------------------------------------------
 
;--------------------------------------------------------------------
; SendOne: sends a '1' to the InfraRed LED at Port Address
+
; SendZero: sends a '0' to the InfraRed LED at Port Address
 
;          8000 using the NEC protocole presented at  
 
;          8000 using the NEC protocole presented at  
 
;          http://www.sbprojects.com/knowledge/ir/nec.htm .
 
;          http://www.sbprojects.com/knowledge/ir/nec.htm .
Line 116: Line 118:
 
==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.
 +
 
 +
Make sure that the time scale is clearly indicated.
  
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.
+
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.

Latest revision as of 10:01, 16 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 remote 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 pictures 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...

You may also want to generate another signal that is activated regularly, but less frequently than the waveform signal, so that you can easily synchronize the scope to the waveform(s).

;--------------------------------------------------------------------
; 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.