1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
CONSTANT CST_AD_REG_STATE_LED,18 ; command reg_timer_status, finish counting?
CONSTANT CST_AD_REG_STATE_LED_1,10 ; command reg_led_r
CONSTANT CST_AD_REG_STATE_LED_2,10 ; command reg_led_r
CONSTANT CST_AD_REG_TIMER_VAL,15 ; command reg_timer_val to decount
;---------------------------------------------------------------------------------
;Special Register usage
NAMEREG s0,ZEROS ;use
NAMEREG s1,ONES ;use
NAMEREG s2,STATE_LED_1 ;use
NAMEREG s3,STATE_LED_2 ;use
NAMEREG s4,TIMER_VAL ; use
;NAMEREG s5,ZEROS
NAMEREG s6,REG_VAL_ENTRY
;ne pas utiliser s7 (boucles)
;ne pas utiliser s8 (interne)
;NAMEREG s9,ZEROS
;NAMEREG sA,ZEROS
;NAMEREG sB,ZEROS
;NAMEREG sC,ZEROS
;NAMEREG sD,ZEROS
;NAMEREG sE,ZEROS
; ne pas utiliser sF (macro)
;---------------------------------------------------------------------------------
;Initialisation
LOAD ZEROS,00
LOAD ONES,11
LOAD STATE_LED_1,00 ; STATE OF LEDS
LOAD STATE_LED_2,0F ; STATE OF LEDS
LOAD TIMER_VAL,FF ;
;-------------------------------------MAINPROG------------------------------------
;---------------------------------------------------------------------------------
mainprog: ;CALL maj_timer_val
CALL test_entry
;CALL stateleds ; state 1, see the difference
;CALL maj_timer_val
CALL test_entry_2
;CALL stateleds_2 ; state 2, see the difference
return mainprog
;------------------------------------SUBROUTINE-----------------------------------
;---------------------------------------------------------------------------------
test_entry: INPUT REG_VAL_ENTRY,CST_AD_REG_STATE_LED ;AD_REG_STATE_LED is PORT_ID
;and select the INPUT_data and s0 receive the data
JUMP NZ, stateleds ;if entry value s0 is not NULL, jump in stateleds
return
stateleds: OUTPUT STATE_LED_1,CST_AD_REG_STATE_LED_1 ;OUTPUT PORT, PORT ID
return
test_entry_2: INPUT REG_VAL_ENTRY,CST_AD_REG_STATE_LED ;AD_REG_STATE_LED is PORT_ID
;and select the INPUT_data and s0 receive the data
JUMP NZ, stateleds_2 ;if entry value s0 is not NULL, jump in stateleds
return
stateleds_2: OUTPUT STATE_LED_2,CST_AD_REG_STATE_LED_2 ;OUTPUT PORT, PORT ID
return
maj_timer_val: OUTPUT TIMER_VAL,CST_AD_REG_TIMER_VAL ;OUTPUT PORT, PORT ID
return |
Partager