Intel 8XC196MD Microscope & Magnifier User Manual


 
9-23
WAVEFORM GENERATOR
;load WFG registers
;
call wgout ;initialize WG_OUTPUT register
call loadregs ;initialize reload & compare regs
call protect ;initialize protection
call wgcon ;initialize WG_CONTROL
;
;enable interrupts & loop here
;
ei
sjmp $
;
;****************************************
; form WG_OUTPUT value from variable data
;****************************************
;
wgout: ld temp,op1 ;get op1
and temp,#0001h ;mask
shl temp,#15 ;move bit to correct location
ld temp1,op0 ;get op0
and temp1,#0001h ;mask
shl temp1,#14 ;move bit to correct location
or temp1,temp ;combine
ld temp,sync ;get sync bit
and temp,#0001h ;mask
shl temp,#13 ;move to correct location
or temp1,temp ;combine
ld temp,pe7 ;get pe7 bit
and temp,#0001h ;mask
shl temp,#12 ;move to correct location
or temp1,temp ;combine
ld temp,pe6 ;get pe6 bit
and temp,#0001h ;mask
shl temp,#11 ;move to correct location
or temp1,temp ;combine
ld temp,ph3 ;get ph3 bits
and temp,#0004h ;mask for ph3.2
shl temp,#8h ;move
or temp1,temp ;combine
ld temp,ph2 ;get ph2 bits
and temp,#0004h ;mask for ph2.2
shl temp,#7h ;move
or temp1,temp ;combine
ld temp,ph1 ;get ph1 bits
and temp,#0004h ;mask for ph1.2
shl temp,#6h ;move
or temp1,temp ;combine
ld temp,p7 ;get p7 bit
and temp,#0001h ;mask
shl temp,#7 ;move to correct location