Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/24/03 12:45
Read: times


 
#59295 - RE: CS5550 Code Problem
Responding to: ???'s previous message
Kumar K wrote:
-------------------------------

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



		
		org 8000h
		ljmp main




main:		mov sp,#0dfh
		acall init_system
		acall init_5550
		




init_system:	clr a
		mov r0,#00h
next_byte:	mov @r0,a
		inc r0
		cjne r0,#0dfh,next_byte
		mov r0,#00h
.
.
.

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

init_5550:	mov a,#04h	;write enable command
		acall ad_write	;gain PGA
		mov a,#00h	
		acall ad_write
		mov a,#00h
.
.
.
.		mov a,#0e8h	;start conversion
		acall ad_write
		sjmp adc_scan
		
.
.
.
		end


------------------------------

Looking at above code I see in the main loop two calls to a subroutine (init_system and init_5550). When you finish the init_5550 you jump to adc_scan and then return to the calling main loop.

What is supposed to happen then? Because the program,as you presented it, continues happily by executing the init_system routine again and then tries the last instruction from init_system (a RET instruction). What happens then is unknown as there was no calling routine...

rgds
Patrick

List of 3 messages in thread
TopicAuthorDate
CS5550 Code Problem            01/01/70 00:00      
   RE: CS5550 Code Problem            01/01/70 00:00      
   RE: CS5550 Code Problem            01/01/70 00:00      

Back to Subject List