Folosind sursele si protocolul micro-UART, realizati o comunicatie seriala care sa utilizeze bitul de paritate in transmisia si receptia informatiei.
Rezolvare: http://dl.dropbox.com/u/24465060/CN-rx_tx.zip
compilarea se face: gcc -fopenmp sursa.c -o sursa
#include "mp.h"
void main () {
int nthreads, tid;
/* Fork a team of threads with each thread having a private tid variable */
#pragma omp parallel private(tid) {
/* Obtain and print thread id */
tid = omp_get_thread_num();
printf("Hello World from thread = %d\n", tid);
/* Only master thread does this */
if (tid == 0) {
nthreads = omp_get_num_threads();
printf("Number of threads = %d\n", nthreads);
}
} /* All threads join master thread and terminate */
}
; Se adună n cuvinte începând de la adresa 3000:200,
; cu rezultat de lungime tot cuvânt (16 biţi),
; fără detectarea depăşirii.
.model small
.code
prog segment word public 'code'
assume cs:prog, ds:date
start: mov ax,date
mov ds,ax
lea si,sir
mov ax,0
mov cx,lung_sir
reia_add:
add ax,[si]
add si,2
loop reia_add
mov rezultat,ax
rev_DOS:
mov ax,4c00h
int 21
afis_mesaj:
mov ah,9
int 21
jmp rev_Dos
prog ends
.data
date segment
sir dw 0f54h,20000,0ff56h,8000
lung_sir equ ($-sir)/2
rezultat dw 2 dup(?)
date ends
end start
; Afisarea în binar a continutului registrului BX.
.model small
.data
continut dw 0f834h
.code
start:
mov ax, @data
mov ds, ax
mov bx, [continut]
mov cx, 16
mov ah, 2h
bucla:
shl bx, 1 ; shift left 1 pozitie in BX
mov dl, '0'
jnc ezero
mov dl, '1'
ezero:
int 21h
loop bucla
mov ax, 4c00h
int 21h
end start