Kumar_373
Junior Member level 1
Can any one help me with following code it is displaying only zero in the 7 segment leg even if i increasing Vin
I have connected CS5550 SDI,SDO,SCK to 8051 port1
Thanks
AD_VALUE_00 EQU 30H ; R:30H
AD_VALUE_01 EQU 31H ; R:31H
AD_VALUE_02 EQU 32H ; R:32H
AD_DO BIT P1.0 ; CS5550UTPUT PORT
AD_SK BIT P1.1 ; CS5550 CLOCK PORT
AD_DI BIT P1.2 ; CS5550 INPUT PORT
org 8000h
ljmp main
main: mov sp,#0dfh
acall init_5550
adc_scan: acall ad_read
mov ad_value_02,a
mov 60h,a
lcall 019bh
acall ad_read
mov ad_value_01,a
mov 60h,a
lcall 019bh
acall ad_read
mov ad_value_00,a
mov 60h,a
lcall 019bh
ret
ad_read: mov b,#08
read_next_bit: clr ad_sk
nop
mov c,ad_do
rlc a
setb ad_sk
;nop
;nop
djnz b,read_next_bit
ret
init_5550: mov a,#04h ;write enable command
acall ad_write ;gain PGA
mov a,#00h
acall ad_write
mov a,#00h
acall ad_write
mov a,#00h
acall ad_write ;gain
mov a,#04h ;write enable command
acall ad_write ;filter
mov a,#00h
acall ad_write
mov a,#00h
acall ad_write
mov a,#20h ;High pass filter enable
acall ad_write ;
mov a,#74h ;write enable command
acall ad_write ;conversion
mov a,#80h
acall ad_write
mov a,#00h
acall ad_write
mov a,#00h
acall ad_write
mov a,#0e8h ;start conversion
acall ad_write
sjmp adc_scan
ad_write: mov b,#08
write_next_bit: clr ad_sk
rlc a
mov ad_di,c
setb ad_sk
nop
djnz b,write_next_bit
ret
end
I have connected CS5550 SDI,SDO,SCK to 8051 port1
Thanks
AD_VALUE_00 EQU 30H ; R:30H
AD_VALUE_01 EQU 31H ; R:31H
AD_VALUE_02 EQU 32H ; R:32H
AD_DO BIT P1.0 ; CS5550UTPUT PORT
AD_SK BIT P1.1 ; CS5550 CLOCK PORT
AD_DI BIT P1.2 ; CS5550 INPUT PORT
org 8000h
ljmp main
main: mov sp,#0dfh
acall init_5550
adc_scan: acall ad_read
mov ad_value_02,a
mov 60h,a
lcall 019bh
acall ad_read
mov ad_value_01,a
mov 60h,a
lcall 019bh
acall ad_read
mov ad_value_00,a
mov 60h,a
lcall 019bh
ret
ad_read: mov b,#08
read_next_bit: clr ad_sk
nop
mov c,ad_do
rlc a
setb ad_sk
;nop
;nop
djnz b,read_next_bit
ret
init_5550: mov a,#04h ;write enable command
acall ad_write ;gain PGA
mov a,#00h
acall ad_write
mov a,#00h
acall ad_write
mov a,#00h
acall ad_write ;gain
mov a,#04h ;write enable command
acall ad_write ;filter
mov a,#00h
acall ad_write
mov a,#00h
acall ad_write
mov a,#20h ;High pass filter enable
acall ad_write ;
mov a,#74h ;write enable command
acall ad_write ;conversion
mov a,#80h
acall ad_write
mov a,#00h
acall ad_write
mov a,#00h
acall ad_write
mov a,#0e8h ;start conversion
acall ad_write
sjmp adc_scan
ad_write: mov b,#08
write_next_bit: clr ad_sk
rlc a
mov ad_di,c
setb ad_sk
nop
djnz b,write_next_bit
ret
end