Write a PIC assembly language program that produces the GCD of two given numbers, Vall and Val2, each is an 8-bit unsigned value. The values of Val and Val2 will be hardcoded into the program and the result will appear in an 8-bit data value referred to by the label 'gcd'.
For your software development purposes you can use the 15 and 10 decimal for the values Vall and Val2, respectively. The program will be simulated and presented to the course instructor who may ask you to use different values for Vall and Val2, and will verify that your program works correctly.
The following is a flowchart for producing the GCD of two such values. The % operator produces the remainder from dividing [Ux] by [Vx]. To produce the remainder repeatedly subtract [Vx] from [Ux] but stop before the difference becomes negative.

here is the flow chart


         +------------------+
         |      main         |
         +------------------+
                 |
   +-------------v-------------+
   |  Val1 -> [Ux], Val2 -> [Vx]|
   +---------------------------+
                 |
   +-------------v-------------+
   |      Is [Vx] == 0?        |
   +---------------------------+
         |           |
       Yes           No
         |            |
  +------v-------+    +-----------------+
  | [Ux] -> [gcd]|    | [Ux] % [Vx] -> temp|
  +--------------+    +-----------------+
         |                         |
      +--v--+                    +--v--+
      | done |                    | [Vx] -> [Ux] |
      +------+                    +---------------+
                                   | [temp] -> [Vx]|
                                   +---------------+
                                         |
                                         +---> Back to Decision "Is [Vx] == 0?"


Submission expectations;
1. ﻿﻿﻿A well-documented assembly language program that behaves as described. Note that well documented expects liberal use of comments where each line indicates what you are doing. The source code will be included in your write up as an appendix.
2. ﻿﻿﻿A flowchart that describes the algorithm your code uses to produce the remainder. You will include the given GCD flowchart and your remainder flowchart in your write up. Include a table that lists the initial values for [Ux] and [Vx] as well as after the lowest placed process box in the GCD flowchart executes.
3. ﻿﻿﻿A two-page write up that introduces the program and outlines the approach you took. At the top of the first page have the course and project title as well as your name and date that you completed the report. (continued)
4. The report (PDF) and source code will be submitted to Blackboard so that it may be run. Submit the source code to Blackboard as XX_proj1.asm and the report as XX_proj1.pdf where XX are your  for PIC18FXX2 microcontoller  check this program  ; GCD Calculation Program for PIC18FXX2
; Calculates GCD of two 8-bit unsigned values (Val1 and Val2)

    LIST P=18F452    ; specify the PIC18F452 microcontroller
    #include <p18f452.inc>   ; include the header file

; Configuration bits (not shown here, would be set according to specific needs)

; Variable declarations
    CBLOCK 0x00
        Ux
        Vx
        temp
        gcd
    ENDC

    ORG 0x00    ; Reset vector
    GOTO main

    ORG 0x08    ; High priority interrupt vector (not used)
    RETFIE

    ORG 0x18    ; Low priority interrupt vector (not used)
    RETFIE

main:
    ; Initialize Val1 and Val2
    MOVLW   d'15'       ; Load Val1 (15 decimal)
    MOVWF   Ux
    MOVLW   d'10'       ; Load Val2 (10 decimal)
    MOVWF   Vx

gcd_loop:
    ; Check if Vx is zero
    MOVF    Vx, W
    BZ      gcd_done    ; If Vx is zero, we're done

    ; Calculate Ux % Vx
    RCALL   remainder

    ; Vx -> Ux, temp -> Vx
    MOVFF   Vx, Ux
    MOVFF   temp, Vx

    BRA     gcd_loop    ; Repeat the process

gcd_done:
    MOVFF   Ux, gcd     ; Store the result in gcd
    SLEEP               ; Enter sleep mode (program end)

remainder:
    ; Subroutine to calculate remainder (Ux % Vx)
    MOVF    Ux, W       ; Load Ux into W
    MOVWF   temp        ; Initialize temp with Ux

remainder_loop:
    CPFSLT  Vx          ; Compare temp with Vx, skip if temp < Vx
    BRA     subtract
    RETURN              ; If temp < Vx, we're done

subtract:
    SUBWF   Vx, W       ; temp - Vx -> W
    MOVWF   temp        ; Store result back in temp
    BRA     remainder_loop  ; Repeat the process

    END                 ; End of program