DIY PROM Do It Yourself PROM chip burning help. No PROM begging. No PROMs for sale. No commercial exchange. Not a referral service.

A/D read SR

Thread Tools
 
Search this Thread
 
Old 03-06-2005, 03:47 PM
  #1  
Z69
Supreme Member

Thread Starter
 
Z69's Avatar
 
Join Date: Sep 2003
Location: Texas
Posts: 1,409
Likes: 0
Received 1 Like on 1 Post
A/D read SR

Code:
* ADREAD.SRC
*
* Read serial A/D
*
* Call with:
* Ch num in A reg
*
* Return with:
* A/D result in A reg
* or ) if A/D or serial fails
*
* TYPE $8D, ECM P/N 1227730
*******************************************************
LF0D2: PSHX
LDX #$4000 ; GM Regester
SEI ; HOLD INTERUPTS
BCLR 2,X,#$08 ; SELECT SERIAL A/D CHIP
STAA 0,X ; CH TO DON IN SSR
BCLR 1,X,#$80 ; CLR b7, SEND CH NUM
;
; 8 SCLK's delay
;
PSHB
MUL
MUL
MUL
PULB
LDAA 0,X ; LD TEST CH RESULT FM SSR
STAA $01AE ; SAVE RESULT
;
; delay 64 cycles
;
PSHB
MUL
MUL
MUL
MUL
MUL
NOP
PULB
;----------------------------
; READ A/D TEST CH
;
;----------------------------
LDAA #$B0 ; SET A/D CH 11 FOR TEST
STAA 0,X ; WR TO SSR
BCLR 1,X,#$80 ; CLR b7, SEND CH NUM
;
; delay
;
PSHB
MUL
MUL
MUL
PULB
LDAA 0,X ; GET RESULT
BSET 2,X,#$08 ; DISABLE SAD
CLI ; INT'S BACK ON
PULX
RTS
***************************************************

It looks like the result is stored at $4000 and $01AE after the first 8 delays.
Then another 64 cycles and ch 11 is read and stored at $4000 again. Which wipes out the first result.
Or is this a 2 step process and the first result is an intermediate result?

Just how does this routine work?

Last edited by Z69; 03-06-2005 at 04:06 PM.
Old 03-06-2005, 06:46 PM
  #2  
Moderator

iTrader: (1)
 
RBob's Avatar
 
Join Date: Mar 2002
Location: Chasing Electrons
Posts: 18,405
Likes: 0
Received 216 Likes on 202 Posts
Car: check
Engine: check
Transmission: check
This routine is easily confusing. The best way to look at it is that on entry Reg A contains the channel to be converted. On exit, Reg A contains that channels data.

The reason it is confusing is the order of data conversions.

The new desired channel is set and the conversion started. After a delay the last conversion data is retrieved. This data is the test channel, and is previous to the current acquisition data channel.

Once the test channel data is retrieved another delay occurs. At the end of that delay the desired channel data is retrieved. And the test channel conversion is started.

Now, the routine doesn't wait for the test channel, it returns with the desired channel data. The test channel data value is retrieved the next time this routine is called.

RBob.
Old 03-06-2005, 08:13 PM
  #3  
Z69
Supreme Member

Thread Starter
 
Z69's Avatar
 
Join Date: Sep 2003
Location: Texas
Posts: 1,409
Likes: 0
Received 1 Like on 1 Post
Thanks Rbob

Is that because the adc chip needs something to push the old data out so to speak or trigger a send...?
Old 03-06-2005, 08:42 PM
  #4  
TGO Supporter
 
AlexJH's Avatar
 
Join Date: Jul 2000
Posts: 812
Likes: 0
Received 1 Like on 1 Post
Engine: 5.7L V8
Transmission: 700R4
Originally posted by Z69
Thanks Rbob

Is that because the adc chip needs something to push the old data out so to speak or trigger a send...?
I can't speak for the specific ADC chip in the ECM, but there's usually some delay in ADCs for reading the analog voltage, just due to how ADCs work (charging up a capacitor).
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
sahlomonic
Electronics
7
09-20-2015 07:15 PM
eustodp
Electronics
8
09-20-2015 05:09 PM
Bubbajones_ya
Cooling
23
09-14-2015 08:38 PM
Rally Smith
TBI
10
09-14-2015 06:59 PM
sandman92084
Tech / General Engine
13
09-12-2015 10:27 PM



Quick Reply: A/D read SR



All times are GMT -5. The time now is 08:07 AM.