Home 


Assembly code for ADC 0808


Sample code for ADC 0808.
Following code can be using for 8051 and 8052 ICs like: 89c51, 89c52, 89s51, 89s52, 89c2051.

 

;===================================================== ; Pin Definations ;===================================================== data_bus equ 90h ; Port 0 adc_add_a equ b4h ; P3.4 adc_add_b equ b3h ; P3.3 adc_ale_soc equ b5h ; P3.5 adc_eoc equ b6h ; P3.6 adc_oe equ b7h ; P3.7 ;===================================================== ; Main Program starts from here ;===================================================== adctemp: clr adc_add_a ;Channel 0 is selected clr adc_add_b ;Add b = 0, Add a = 0 nop setb adc_ale_soc ;ale is made high nop nop clr adc_ale_soc ;soc is made low jb adc_eoc,$ ;check for eoc low jnb adc_eoc,$ ;check for eoc hing setb adc_oe ;if eoc high,make oe high nop nop mov a,data_bus ;Read Port0 data to Acc mov 40h,a ;40h contains output data clr adc_oe ;make oe low ret ;===================================================== ; Program ENDS here ;=====================================================