Presentation is loading. Please wait.

Presentation is loading. Please wait.

Helpful functions and hardware Projects. DigScroll.

Similar presentations


Presentation on theme: "Helpful functions and hardware Projects. DigScroll."— Presentation transcript:

1 Helpful functions and hardware Projects

2 DigScroll

3 Random Number Generator

4 Hex to Decimal d1d1 d2d2 d3d3 d4d4 Decimal h1h1 h2h2 h3h3 h4h4 Hex H2D ( h – d ) 1.Push each decimal digit into stack. \ d 4 d 3 d 2 d 1 2.4 LSHIFT and + \ ( d 4 + 10 ( d 3 + 10 ( d 2 + 10 * d 1 ) ) )

5 Hex to Decimal : H2D ( h - d ) \ convert hex to decimal 0 a UM/MOD \ get & push decimal digit 0 a UM/MOD 0 a UM/MOD \ d 4 d 3 d 2 d 1 4 LSHIFT + \ put in the right place 4 LSHIFT + 4 LSHIFT + ; \ (d 4 + 10 (d 3 + 10 (d 2 + 10 * d 1 ) ) )

6 HEX : H2D ( h - d )\ convert hex to decimal \ 162E 0 a UM/MOD \ 8 237 0 a UM/MOD \ 8 7 38 0 a UM/MOD \ 8 7 6 5 4 LSHIFT + \ 8 7 56 4 LSHIFT + \ 8 567 4 LSHIFT + ;\ 5678 Example: 5678 dec = 162Eh

7 Decimal to Hex d1d1 d2d2 d3d3 d4d4 Decimal. 7 h1h1 h2h2 h3h3 h4h4 Hex D2H ( d – h) 1.Push each digit into stack. \ d 4 d 3 d 2 d 1 2. Multiply, drop and + \ ( d 4 + a ( d 3 + a ( d 2 + a * d 1 ) ) )

8 Decimal to Hex : D2H ( d - h ) \ convert decimal to hex 0 10 UM/MOD \ push decimal digit to stack 0 10 UM/MOD 0 10 UM/MOD \ d 4 d 3 d 2 d 1 a UM* drop + \ multiply digit by a a UM* drop + a UM* drop + ; \ ( d 4 + a ( d 3 + a ( d 2 + a * d 1 ) ) )

9 HEX : D2H ( d - h )\ convert decimal to hex \ 5678 0 10 UM/MOD \ 8 567 0 10 UM/MOD \ 8 7 56 0 10 UM/MOD \ 8 7 6 5 a UM* drop + \ 8 7 38 a UM* drop + \ 8 237 a UM* drop + ;\ 162E Example: 5678 dec = 162Eh


Download ppt "Helpful functions and hardware Projects. DigScroll."

Similar presentations


Ads by Google