Intel 8XC196MC Microscope & Magnifier User Manual


 
8-7
FREQUENCY GENERATOR
;
temp: dsw 1
temp1: dsw 1
temp2: dsw 1
buf_start: dsw 1
buf_cnt: dsb 1
bit_cnt: dsb 1
flag: dsb 1
;bit 0 = zero being sent
;bit 1 = one being sent
;bit 5 = get next bit
;bit 6 = get next byte
;bit 7 = buffer send in progress
;
xmit_buf: dsb buf_size ;block of data to send
shift_reg: dsb 1
;
;*****************************
; MAIN PROGRAM
;*****************************
; Define the program location and set up the interrupts and stack.
;*****************************
;
cseg at 0e000h ;RISM user space
;
start: di ;set up interrupts
dpts
andb int_pend1,#10000000b;
orb int_mask1,#00000010b;unmask compare3
ld sp,#0200h ;set up stack
;*****************************
; Initialize pin P7.7/FREQOUT for I/O and set the pin low.
;*****************************
;
ldb wsr,#7EH ;move SFR;s into window
andb p7_reg_w,#01111111b ;P7.7 = low
andb p7_dir_w,#01111111b ;P7.7 comp output
andb p7_mode_w,#01111111b;P7.7 = I/O
ldb wsr,zero_reg
;*****************************
; This section fills the data buffer with a “fill” character.
; An application would typically place a block of data here.
;*****************************
;
ld temp,#xmit_buf ;initialize buffer data
ldb temp1,#fill_char
ldb temp2,#buf_size
fill: stb temp1,[temp]+
djnz temp2,fill
;*****************************
; Start timer 1 with a 1 microsecond clock period,
; load the carrier frequency into FREQ_GEN, and
; enable the interrupts.
;*****************************
;
ldb temp,#11000010b ;init EPA timer1
stb temp,t1control[0] ;1 uS ticks
ldb temp,#carrier_freq ;load carrier freq