8XC196MC, MD, MH USER’S MANUAL

or

temp1,temp

;combine

 

ld

temp,p6

;get p6 bit

and

temp,#0001h

;mask

 

shl

temp,#6

;move to

correct location

or

temp1,temp

;combine

 

ld

temp,ph3

;get ph3

bits again

and

temp,#0003h

;mask for ph3.0 & 1

shl

temp,#4h

;move

 

or

temp1,temp

;combine1

ld

temp,ph2

;get ph2

bits again

and

temp,#0003h

;mask for ph2.0 & 1

shl

temp,#2h

;move

 

or

temp1,temp

;combine

 

ld

temp,ph1

;get ph1

bits again

and

temp,#0003h

;mask for ph3.0 & 1

or

temp1,temp

;combine, don't need to move

st

temp1,WG_OUTPUT[0]

;now store it

ret

 

 

 

;

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

;form WG_CONTROL value ;****************************************

wgcon:

ld

temp,mode

;get mode

 

and

temp,#0003h

;mask

 

shl

temp,#12

;shift to correct location

 

ld

temp1,ec

;start/stop bit

 

and

temp1,#0001h

;mask

 

shl

temp1,#10

;shift to correct location

 

or

temp,temp1

;combine into temp

 

ld

temp1,dead

;get dead time

 

and

temp1,#03ffh

;mask to 10 bits

 

or

temp,temp1

;combine into temp

 

st

temp,WG_CONTROL[0]

;store WG_CONTROL

 

ret

 

 

;

;***************************************** ;load the WG_RELOAD and WG_COMPx registers ;*****************************************

;

loadregs: st reload,WG_RELOAD[0] st comp1,WG_COMP1[0] st comp2,WG_COMP2[0] st comp3,WG_COMP3[0] ret

;

 

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

 

;load WG_PROTECT options

 

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

 

;

 

protect:ldtemp,es

;get sample control bit

9-24

Page 223
Image 223
Intel 8XC196MH, 8XC196MD, 8XC196MC manual Temp1,WGOUTPUT0 Now store it Ret