Intel 8XC196MH Microscope & Magnifier User Manual


 
8-9
FREQUENCY GENERATOR
cmpb buf_cnt,#0 ;see if last byte has been sent
jne dec_buf_cnt ;no!
ljmp all_done ;yes!
dec_buf_cnt: decb buf_cnt ;decrement byte count
;
get_bit: andb flag,#11011111b ;clear get bit flag
shlb shift_reg,#1 ;shift MSB into carry flag
jc send_one ;send a one
;else send zero
;
send_zero: orb flag,#00000001b ;set zero's flag
ldb wsr,#7BH ;set up EPA
ldb comp3_con_w,#01000000b
add comp3_time_w,timer1_w,#zero_time
ldb wsr,#7EH
orb p7_mode_w,#10000000b ;start FREQOUT
ldb wsr,zero_reg
sjmp done
send_one:
orb flag,#00000010b ;set one's flag
ldb wsr,#7BH ;set up EPA
ldb comp3_con_w,#01000000b
add comp3_time_w,timer1_w,#one_time
ldb wsr,#7EH
orb p7_mode_w,#10000000b ;start FREQOUT
ldb wsr,zero_reg
sjmp done
;
zero_pause: andb flag,#11111110b ;turn off zero flag
ldb wsr,#7EH
andb p7_mode_w,#01111111b ;turn off FREQOUT
ldb wsr,#7BH ;set up EPA
ldb comp3_con_w,#01000000b
add comp3_time_w,timer1_w,#zero_pause_time
ldb wsr,zero_reg
sjmp next
;
one_pause: andb flag,#11111101b ;turn off one flag
ldb wsr,#7EH
andb p7_mode_w,#01111111b ;turn off FREQOUT
ldb wsr,#7BH ;set up EPA
ldb comp3_con_w,#01000000b
add comp3_time_w,timer1_w,#one_pause_time
ldb wsr,zero_reg
;
next: decb bit_cnt ;decrement bit count
cmpb bit_cnt,#00H ;check if 8 bits sent
jne next1 ;no, get next bit
orb flag,#01000000b ;yes, get next byte
sjmp done ;done for now
next1: orb flag,#00100000b ;set get bit flag
sjmp done
;
all_done: ldb flag,#00H ;clear all flags
done: popa
ret
;
end