19.06.2013 Views

Curs microcontrolere PIC Atentie, un site foarte complet al unuia ...

Curs microcontrolere PIC Atentie, un site foarte complet al unuia ...

Curs microcontrolere PIC Atentie, un site foarte complet al unuia ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

De fapt, in cazul microcontrolerului <strong>PIC</strong> exista doua instructi<strong>un</strong>i<br />

de scadere, astfel ca nu vom fi nevoiti sa procedam ca mai sus,<br />

microcontrolerul re<strong>al</strong>izand el singur operatia.<br />

Doar in cazul in care se scade <strong>un</strong> numar mai mare dintr-<strong>un</strong> numar<br />

mai mic trebuie sa folosim ce am invatat mai sus.<br />

Astfel:<br />

C b7 b6 b5 b4 b3 b2 b1 b0<br />

1 0 0 0 0 0 0 1 0 (2)<br />

- 0 0 0 0 0 0 0 1 1 (3)<br />

--------------------------------------------------------<br />

0 1 1 1 1 1 1 1 1 (-1)<br />

1. 1 din 10(2) este1<br />

2 1 din 10( imprumutam ca in zecim<strong>al</strong> si aj<strong>un</strong>gem pana la 1 din<br />

C(carry din registrul speci<strong>al</strong> Status) Deci, in locul zerourilor<br />

de la descazut(bitii de la b2 pana la b7) vom gasi 1 asa cum<br />

gasim 9 at<strong>un</strong>ci cand imprumutam in zecim<strong>al</strong>( 40002- )<br />

( 21151)<br />

( --------------)<br />

( 18851 )<br />

3. Toti bitii pana la b7 rezulta coborand 1 rezultati in urma<br />

imprumutului.<br />

Dar, B'11111111' este 255 (FF) sau -1 ?<br />

E simplu.Vom sti ca rezultatul operatiei este <strong>un</strong> numar negativ<br />

deoarece C este zero.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!