8XC196MC, MD, MH USER’S MANUAL

stb temp,freq_gen[0]

;into freq gen

ei

;enable interrupts

;

;

;*****************************************

;Now send buffer out as serial data bytes ;*****************************************

;This section issues a 1 millisecond pulse on P2.0

;for use with an oscilloscope monitor. ;*****************************************

ld

wsr,#7EH

 

ld

temp,#0400

 

andb

p2_reg_w,#11111110b ;strobe p2.0 to sync

andb

p2_dir_w,#11111110b ;scope

andb

p2_mode_w,#11111110b;

orb

p2_reg_w,#00000001b ;set pin high

djnzw temp,$

;pause

andb

p2_reg_w,#11111110b ;set pin low

ld

wsr,zero_reg

 

;*****************************************

;Initialize the buffers and flag register that the interrupt routine needs. ;*****************************************

ld

buf_start,#xmit_buf

;pointer reg

ld

buf_cnt,#buf_size

;number to send

ldb

flag,#11000000b

;set

“buffer send in progress”

;

 

;and

“get next byte” flags

;*****************************************

;Set the compare module’s interrupt pending bit

;to start sending the buffer. Loop until the buffer

;send is complete, then start main program over. ;*****************************************

 

ldb

int_pend1,#00000010b;force interrupt

wait:

jbs

flag,7,wait

;loop

here until done

 

ljmp

start

;then

start over

;

;

;*******************************************

;COMPARE3 INTERRUPT ROUTINE ;*******************************************

;This routine executes each time the EPA compare channel times out.

;The “flag” register identifies the reason for the interrupt request. ;*******************************************

cseg at 0f120H

;comp3 Int vector demo board

;

 

pusha

jbs flag,1,one_pause jbs flag,0,zero_pause jbs flag,5,get_bit jbs flag,6,get_byte sjmp all_done

;save cpu status

;jump if one being sent ;jump if zero being sent ;get next bit

;get next byte

;if nothing set, done

;

 

 

 

 

get_byte:

andb

flag,#10111111b

;clear get

byte flag

 

ldb

shift_reg,[buf_start]+

;get byte to send into temp

 

ldb

bit_cnt,#8

;# of bits

to send per char

8-8

Page 195
Image 195
Intel 8XC196MD, 8XC196MH, 8XC196MC manual Stb temp,freqgen0 Into freq gen