Tuesday, October 18, 2005

ECTE333 lab solutions

In my anguish to decide what to do after my poor performamce in the test today, I have decided to screw the whole school. What if I could publish the solution to the labs that I have done? Those in the School know that these experiments have been th same for the last 5+yrs, make them change and screw every student that comes after us. I could do that or what is I could make it easier for future generation students and provide them with guidlines on how to survive the ECTE333 lab session, score 10/10 and hardly work as sweat? I guess that is what I will do, share the experience and hopefully some poor bugger will have an easier run than I have. Here are the lab questions for 2004, this were exactly what we got in Spring 2005.

code for experiment 1

these are really straight forward and if you can't do these you probably don't deserve code for experiment 3 and 4

code for experiment 2

ADD R3,R3,x1
ADD R4,R4,x2
ST R3,AST R4,B
The complete program would be
.ORIG x3050
LD R3, A
LD R4, B
ADD R3.R3, x1
ADD R4, R4, x2
ST R3, A
ST R4, B
HALT
A .FILL x6
B .FILL Xf
.END

Task 4
Using the same code as above, the stored numbers are multiplied using assembly code.The code used in this experiment was
.ORIG x3050
AND R3, R3, x0
AND R4, R4, x0
AND R5, R5, x0
LD R3, A
LD R4, B
ADD R3, R3, x1
ADD R4, R4, x2
LOOP ADD R5, R5, R4 ; multiplying code 1
ADD R3, R3, x-1 ; multiplying code 2
BRp LOOP
HALT
A .FILL x6
B .FILL Xf
.END


code for experiment 3

task1

#include <80c196kc.h>
/*#include */
int main (void)
{
ioport1=127;
while(1)
{
if(check_bit(ioport2,7))
{
while (ioport1<255)
{ioport1++;}
while (ioport1>0)
{ ioport1--; }
}
else
{ ioport1=127; }
}
}


task2
I had problems running this piece of code and I really didn't bother trying to debug it, I was running out of time here. I guess with all the info you will get off me, you can't expect uncle kman to give you everything, can you?
#include <80c196kc.h>
#include
#include
#include
void init_hso(void);
void reset_hso(void);
interrupt hso_interrupt(void)
near unsigned long FREQ = 1000;
near unsigned long MARK_SPACE = 50;
near unsigned long count;
near unsigned long run;
near unsigned long run1;
int main()
{
count=1;
make_vec(INTR_HSO,hso_interrupt);
reset_hso();
init_hso();
int_pend = o; /*clear all interrupts*/
int_mask = HSO_ENB; /*enable HSO and software timer interrupts*/
ei();/*enable all interrupts*/
}
void reset_hso(void)
{
ioc = 0xc0; /*clear entire cam and enable locked entries*/
}
void init_hso(void)
{
wsr=15;
timer1=0;
wsr=0;
hso_command = 0x90;
run = (1000000*MARK_SPACE)/(FREQ*100);
printf("%d\n\r",run);
hso_time = run; hso_command = 0x90;
run1 = run +(1000000(100-MARK_SPACE))/(FREQ*100);
printf("%d\n\r",run1);
hso_time = run1;
}

interrupt hso_interrupt(void)
{
if (count == 0)
{
clr_bit(ioport1,0);
count = 1;
}
else
{
set_bit(ioport1,0);
count = 0;
wsr = 15;
timer1 = 0;
wsr = 0;
}
}

code for experiment 4

task1


#include <80c196kc.h>
/*#include */
int main (void)
{
ioport1=127;
while(1)
{
if(check_bit(ioport2,7))
{
while (ioport1<255)>
{
ioport1++;
}
while (ioport1>0)
{
ioport1--;
}
}
else
{
ioport1=127;
}
}
}

task2
#include<80c196kc.h>
#include
int main()
{
register char present_s;
register int prev_s;
register int counter;
register short int on;
register unsigned char* memory;
memory= (unsigned char*) 0xffff;
counter = 127;
*memory = counter;
on = 1;
present_s = 0;
prev_s = 1;
while(1)
{
prev_s = present_s;
present_s = check_bit(ioport2,7);
if(prev_s && ! present_s)
on = on* -1;
if(on ==1)
{
while(++counter <255)
{ *memory = counter; }

while(--counter >0)
{ *memory = counter; }
}
else
*memory = 128;
}
}
If I feel generous enough I may even leave my lab reports for all those who hate doing their work, why work hard when Kman has your back?
Kman Productions.........................

3 Comments:

Anonymous Anonymous said...

Oh my God! The amount of codes... I don't think I can handle that. *horrors*

2:10 pm, October 19, 2005  
Anonymous Anonymous said...

welcome to ecte333, unlike csci where we got a 'backup plan', here you are on your own

2:14 pm, October 19, 2005  
Anonymous Anonymous said...

eeek. so, csci is not so bad after all. and yes, i am older than you. heheh.

12:12 am, October 20, 2005  

Post a Comment

Subscribe to Post Comments [Atom]

<< Home