;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Repeat				macro	Num
						mov a,ADCH
						anl a,#Num
						rl a
						rl a
					ENDM
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
;----------------------------------------------------------------------
public				_ADC_CONVERSION			;ADC_Conversion(unsigned char)
public				CONVERSION				;Conversion() with ADCH+ADCON
;--------------------------------------------------------------------------------------
ADCON 				data 0C5h
ADCH  				data 0C6h
;--------------------------------------------------------------------------------------
ADCS				equ	00001000B			;Spustim prevod AD prevodnika
ADCI				bit	acc.4				;Kontrolujem ci je prevod ukonceny ADCON.4...
MASKA				equ	11000000B
;--------------------------------------------------------------------------------------
Prog_ADC_Converter	segment code
					rseg Prog_ADC_Converter
;--------------------------------------------------------------------------------------
_ADC_CONVERSION:	mov ADCON,r7			;Vstupny parameter je cislo kanala pre meranie v R7
					orl ADCON,#ADCS
?PR?ADC_END:		mov a,ADCON			
					jnb ADCI,?PR?ADC_END	;Je prevod ukonceny ???
					clr ADCI				;bit ADCI nastavujem na 0
					mov ADCON,a
CONVERSION:			mov a,ADCH
					anl a,#MASKA
					rl a
					rl a
					mov r7,
					ret
;--------------------------------------------------------------------------------------
;					cseg at 0053h			;os_attach_interrupt(10)
;					push acc
;					pop acc
;					reti
;--------------------------------------------------------------------------------------
					end