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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
03/13/08 11:04
Read: times


 
Msg Score: -1
 -1 Didn't Search First
#152217 - suggestions???
I know this mite be asking a bit much but any bit of help would be seriously appreciated. I have been on the message board already regarding this subject and got good advice but im honestly a bit lost. Im using this code to convert data in an adc. What i need to do is call/check the converted result every 2us as i want to sample the data at 500Hz. Could anybody help me with the coding or put me in the right direction. Im running out of time and its a very important part of my project.

Thanks

...

$MOD52

	rd1 equ P0.0           	;Read signal P0.0
        wr1 equ P0.1           	;Write signal P0.1
        cs equ P0.2           	;Chip Select P0.2
        intr equ P0.3         	;INTR signal P0.3

        adc_port EQU P2       	;ADC data pins P2
        adc_val EQU 30H       	;ADC read value stored here

        org 0H
start:                    	;Start of Program
        acall conv            	;Start ADC conversion
        acall read            	;Read converted value
        mov P3,adc_val        	;Move the value to Port 3
        sjmp start            	;Do it again

conv:                     	;Start of Conversion
        clr cs                	;Make CS low
        clr wr1                	;Make WR1 Low
        nop
        setb wr1               	;Make WR High
        setb cs               	;Make CS high
wait:
        jb intr,wait          	;Wait for INTR signal
        ret                   	;Conversion done

read:                     	;Read ADC value
        clr cs                	;Make CS Low
        clr rd1                	;Make RD1 Low
        mov a,adc_port        	;Read the converted value
        mov adc_val,a         	;Store it in local variable
        setb rd1               	;Make RD1 High
        setb cs               	;Make CS High
        ret                   	;Reading done

END

...


List of 3 messages in thread
TopicAuthorDate
suggestions???            01/01/70 00:00      
   Why the new post?            01/01/70 00:00      
   My suggestion:            01/01/70 00:00      

Back to Subject List