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 Mar 6, 2005 | 03:47 PM
  #1  
Z69's Avatar
Z69
Thread Starter
Supreme Member
 
Joined: Sep 2003
Posts: 1,409
Likes: 1
From: Texas
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; Mar 6, 2005 at 04:06 PM.
Reply
Old Mar 6, 2005 | 06:46 PM
  #2  
RBob's Avatar
Moderator
iTrader: (1)
 
Joined: Mar 2002
Posts: 18,432
Likes: 233
From: Chasing Electrons
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.
Reply
Old Mar 6, 2005 | 08:13 PM
  #3  
Z69's Avatar
Z69
Thread Starter
Supreme Member
 
Joined: Sep 2003
Posts: 1,409
Likes: 1
From: Texas
Thanks Rbob

Is that because the adc chip needs something to push the old data out so to speak or trigger a send...?
Reply
Old Mar 6, 2005 | 08:42 PM
  #4  
AlexJH's Avatar
TGO Supporter
 
Joined: Jul 2000
Posts: 812
Likes: 1
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).
Reply
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
Bubbajones_ya
Cooling
24
Jul 6, 2024 08:32 PM
sahlomonic
Electronics
7
Sep 20, 2015 07:15 PM
eustodp
Electronics
8
Sep 20, 2015 05:09 PM
Rally Smith
TBI
10
Sep 14, 2015 06:59 PM
sandman92084
Tech / General Engine
13
Sep 12, 2015 10:27 PM




All times are GMT -5. The time now is 06:54 AM.