Friday, December 12, 2014

Questions/Answers: What's run-time binding?

In short, run-time binding describes how we pass the address of a subroutines (app_xmit and app_recev subroutines) from application module to the SCI module (or from any module to another module in run-time, i.e. as the program is running on the CPU), allowing the sci module to call the subroutines defined in the application module implicitly/indirectly by loading the address of the subroutine and the jsr'ing to that subroutine. This is as opposed to a link-time binding, where you declare sci_init subroutine as extern in the application module and use the linker to bind them, thus, allowing for the application to explicitly/directly call the sci_init even though sci_init was defined in sci module (using jsr sci_init).
Generally, run-time binding provides more flexibility, and provides more separation or decoupling of modules.

Sunday, December 7, 2014

Lab 5: Code

Click here to get a copy of code for lab 5. This should cover most of the lab. Note, that queue.asm was re-written to provide a more reusable module; so that you can use the same code both for xmit and receive queues. 

Tuesday, November 25, 2014

An important note about Lab 5

Looking at the code issues of one of the students, I noticed a mystic issue with the simulator, so in sci_isr if you check TDRE bit first, even though the transmission interrupts gets disabled it looks like it doesn't actually clear the interrupts! However if you check for RDRF bit (see below) this issue doesn't happen

LDAA SCSR

BITA #RDRF
BNE SCI_RDRF

BITA #TDRE
BNE SCI_TDRE



Time permits, I'll try to further investigate to see what's the source of the problem; there may be a reasonable explanation for this(!), meanwhile please adjust your code as per above.

There was also a minor issue in the queue.asm code; sec/clc (setting/clearing the carry bit) must be called close to RTS, ensuring that other instructions will not alter the carry bit after it; here is the updated code: queue.asm

Sunday, November 23, 2014

Question and answers regarding Read_str on Assignment 5

Question:When the Read_str subroutine encounters CR is that CR generated by user input or by the program where it would be stored at the second last byte in the string?

Answer: CR is generated by the user.


Question: wouldn't you only call Read_str once to initialize the interrupts and then if anything is put into the terminal a interrupt would happen echoing the character and loading it into the string?

Answer: No, you can call Read_str at anytime, so as an example, you may call after 1 min, at which time 40 characters have been received, so during this time, your sci_isr in addition to app_recv should keep storing the incoming bytes in a location in memory (e.g. in a buffer or queue)


Question: is it the main application requesting the string generated by read_str?

Answer: The main program requests the string by calling subroutine Read_str, and Read_str essentially reads from the received bytes till it hits the end of the received bytes, or it hits CR, or it hits the limit 253 bytes.


Question: do we need to save the string to memory or just transmit it?

Answer: Read_str's main purpose is to write the received bytes into IX (that is pointing to an array);
so as an example, if you do the following:
ldx #recvstr
jsr read_str

;; read_str should have at this point filled the recvstr memory with the previously received bytes

;; where recvstr is define like:
recvstr ds !255

So in short, read_str reads from received bytes that have been previously stored (perhaps in a buffer or queue) as they are received using sci_isr & app_recv subroutines.

Now, in addition to the above this question also asks for the bytes to be echoed as they are received (perhaps in the app_recv subroutine[?]), and this can be done by calling write_str with two bytes string, where the first byte is the character to send and the second byte is NUL, does that make sense? So one could write an additional subroutine called write_ch that essentially takes one byte and creates a nul-terminated string and pass it to write_str, which will echo it to screen.

Tuesday, November 11, 2014

Modularization in HC11

Here is a short video describing modularization in HC11:



queue.asm file is the queue module
And testQMod.asm is an example test program that uses queue module.

Also note the comments, and code style (no magic numbers) in queue.asm for the reference. 

Sunday, November 9, 2014

Laboratory 5 – Device Interrupts and Terminal I/O

Click here to get a copy of Laboratory 5 – Device Interrupts and Terminal I/O.

The assignment was updated (to remove question 5 of the original document, i.e. write_ch subroutine)

Monday, October 27, 2014

Laboratory 4 - Device Polling using Serial Communication and Terminal I/O

Click here to get a copy of the  Laboratory 4 - Device Polling using Serial Communication and Terminal I/O.

In order to be better prepared for this lab, read Chapter 4, sections 2 and 3, of the textbook before attempting any of the exercises in either the pre-lab or the lab.

UpdateYou are asked to have done the prelab before the lab as preparation, but you are not required to submit it before the lab; you'll submit the full report, including the prelab on the lab due date. 

Wednesday, October 15, 2014

Sample questions for Quiz 1

Click here to obtain a copy of sample questions for quiz 1.
Quiz #1 will be held on Monday Oct 20th, @3:35PM in the classroom.
Quiz #1 is postponed to Thursday Oct 23rd, @3:35PM in the classroom.

Tuesday, October 7, 2014

How to use Subroutines in 6811 Assembly programming

Subroutines are similar to concept of functions in C/C++. In 6811, in order to call a subroutine you can use the instruction: JSR

So your code would be something like:

ORG $C000

; some initialization code

JSR stringLength

; more code ...
; e.g.
CLRA
LDAA #$40

;further down in your code you define your subroutine

stringLength
;; your subroutine code will go here
;; e.g.
ORAA $0F

RTS ; return from subroutine


The following video describes how to use and implement subroutines in 68HC11:



Saturday, October 4, 2014

Running 32-bit Windows XP/Vista on VirtualBox

Allright, so I've been looking around for simplest option to get you up and running if you have a 64-bit machine that does not run the HC11 toolset. So as I mentioned in the class, you can use VirtualBox which is an Open Source software by Oracle.

  • go the following link and download the appropriate VirtualBox binary for your OS (yes, there is a version for Mac/OS X as well)
  • Once downloaded, install VirtualBox on your computer
  • Now that you have VirtualBox installed, go to modern.ie following website that is hosted by Microsoft, and it provides you with variations of free and ready to go Virtual Machine appliances (e.g. 32 bit Windows XP or Windows 7) that you can download and use out-of-box, so you don't have to manually install XP or Vista on your VirtualBox:
    • https://www.modern.ie/en-us/virtualization-tools#downloads
    • Note that modern.ie was introduced for browser testing that's why there is all kinds of flavours for different Internet Explorer IEs.
    • I selected Mac and downloaded XP for IE6, since it occupied less space on disk, and tested HC11 tools set successfully, it should be the same if you are running Windows machine.
    • Select a flavour of Windows & IE follow a few instructions to download the required file  (see example below for Windows: on the left you select you computer's OS, and read the instructions, on the right you'll select the version of Windows and a flavour of IE)



  • Once the files are downloaded and extracted, you should be able to download the files and it will automatically open using VirtualBox, and it will ask you to import the downloaded virtual machine. 


Note: The are commercial virtual machine software such as VMWare and Parallels Desktop, but VirtualBox works just as well, at least for what we need in this course.

Wednesday, October 1, 2014

HC11 Tools: Editor, Assembler, Linker

MiniIDE is available in the lab for writing/build your assembly code, however I highly recommend using the following HC11 toolset made available by Dr. Larry Hughes. Please ensure to extract the zipped file in the root folder of your C drive, the tools may have some limitation when it comes to long file path. To help you through working with HC11 toolset, I've created a short video to walk through the process of using the assembler, linker, and loading the executable module into simulator: Download the video

Thursday, September 25, 2014

68HC11 Instruction Set and Reference Manual

Here is a link to 68HC11 Instruction Set (that you can use to look up the instructions):
http://www.ele.uri.edu/Courses/ele205/6811-Instructions/index.html

Here is a link to complete reference Manual for 68HC1, if you want to learn more details about each instruction:
http://www.freescale.com/files/microcontrollers/doc/ref_manual/M68HC11RM.pdf


Tuesday, September 23, 2014

Sunday, September 21, 2014

Laboratory 2 – Assembly Language Programming

Here you can find a copy of Laboratory 2 – Assembly Language Programming

More supporting material will be providing in the class and here on the course website. Please review the document before the lab time. 

MiniIDE

Here you can download MiniIDE program for windows: I've tested it and it works for windows 7 as well. Using MiniIDE you can assemble your assembly code, but doesn't seem to have a linker!
So that means that you can't have separate modules unless you use $include directive; we'll further discuss this in the class:

http://www.mgtek.com/miniide/resources/hc11.aspx

Please note that you may have to go to Build menu > Options > Select the Tools tab > and change the Assembler from asm12.exe to asm11.exe in order to ensure you are using Assembler for HC11 not HC12. 

Thursday, September 18, 2014

Buffalo user manual

Use the following link to get more info on buffalo:
http://uhaweb.hartford.edu/kmhill/suppnotes/Buffalo/index.htm

Tuesday, September 16, 2014

Laboratory 1: Introduction to MC68HC11EVB

Click here to get a copy of the first laboratory assignment: Introduction to MC68HC11EVB
If you would like to get a copy of the Simulator program click here.
Note: You must email your grouping info prior to laboratory session. 

Monday, September 15, 2014

Announcements

  • There will be no class today, Monday Sept 15th, as per prior notice.
  • A supporting document to lecture 2-3 is posted here.
  • The first lab will be on Thursday, Sep 18th. The lab description/assignment will be posted on Tuesday Sep 16th. 
  • In order to prepare for labs, you must form groups of two individuals, and email your grouping assignments to me at "mfarajma AT dal.ca"

Wednesday, September 3, 2014

Course Outline

Click here to obtain a copy of course outline. 

Monday, September 1, 2014