Pages: [1]
Author Topic: enabling additional input pins?  (Read 5886 times)
elRey
Hero Member
*****

Karma: +32/-1
Offline Offline

Posts: 565


« on: August 13, 2014, 12:30:21 PM »

Hello all,

Is it possible to enable additional, unused  0-5v analog inputs? I know any filtering would require custom code, possible copied from an existing function.
But how would I enable the input pin and access the input value?



Thanks,
Rey
Logged
dream3R
Hero Member
*****

Karma: +18/-8
Offline Offline

Posts: 1194


« Reply #1 on: August 31, 2014, 08:14:54 AM »

If you find the analogue pin code in your ecu it should be obvious.

iirc, you request the value from the AD converter register then assign it to a ram cell, then another routine can deal with it from there.
Logged



How to work out values from an A2L Smiley

http://nefariousmotorsports.com/forum/index.php?topic=5525.msg52371#msg52371


Starting Rev's http://nefariousmotorsports.com/forum/index.php?topic=5397.msg51169#msg51169

noobs read this before asking http://nefariousmotorsports.com/forum/index.php?topic=9014.0title=


ORGORIGINAL 05 5120 creator for Volvo
ORIGINAL Datalogger (Freeware) Author
ORGINAL finder of the 'extra' torque' limits
I don't have ME7.01 A2L I just use ID
elRey
Hero Member
*****

Karma: +32/-1
Offline Offline

Posts: 565


« Reply #2 on: August 31, 2014, 10:13:10 AM »

Code:
INIT_IN_OUTPUTS_1:
extr    #1
mov     ODP2, #0C340h
mov     P2, #0C7BFh
mov     DP2, #3CBFh
extr    #1
mov     ODP3, #8B1Fh
mov     P3, #2FC1h
mov     DP3, #35E0h
mov     P4, #0E0h ; 'a'
mov     DP4, #0CFh ; '-'
extr    #1
mov     ODP6, #80h ; ''
mov     P6, #80h ; ''
mov     DP6, #7Fh ; ''
mov     P7, #74h ; 't'
mov     DP7, #0FFh
mov     P8, #0F8h ; ''
mov     DP8, #81h ; ''
extr    #1
mov     PICON, #87h ; ''
rets

Code:
INIT_IN_OUTPUTS_2:
mov     CCM0, #0
mov     CCM1, #0
mov     CCM2, #400h
mov     CCM3, #0A900h
mov     CCM4, #0B00Ch
mov     CCM5, #0BBh ; '+'
mov     CCM6, #0
mov     CCM7, #0
mov     CC0IC, #37h ; '7'
mov     CC0, #0
mov     CC1, #0FFFFh
mov     CC2IC, #36h ; '6'
mov     CC3IC, #35h ; '5'
mov     CC3, #0FFFFh
mov     CC4, #0FFFFh
mov     CC5, #0FFFFh
mov     CC6, #0FFFFh
mov     CC7, #0FFFFh
mov     CC8, #0FFFFh
mov     CC9, #0FFFFh
mov     CC10IC, #20h ; ' '
mov     CC10, #0FFFFh
mov     CC11, #0FFFFh
mov     CC12, #0FFFFh
mov     CC13, #0FFFFh
mov     CC14IC, #7Dh ; '}'
extr    #2
mov     CC16IC, #17h
mov     CC19IC, #28h ; '('
mov     CC19, #0FFFFh
extr    #1
mov     CC20IC, #29h ; ')'
mov     CC20, #0FFFFh
extr    #1
mov     CC21IC, #22h ; '"'
mov     CC21, #0FFFFh
extr    #1
mov     CC22IC, #0
mov     CC22, #0FFFFh
extr    #1
mov     CC23IC, #70h ; 'p'
mov     CC23, #0FFFFh
extr    #2
mov     CC26IC, #1Ch
mov     CC28IC, #71h ; 'q'
mov     CC28, #0FFFFh
extr    #1
mov     CC29IC, #72h ; 'r'
mov     CC29, #0FFFFh
extr    #1
mov     CC30IC, #73h ; 's'
mov     CC30, #0FFFFh
rets

Code:
INIT_OUTPUTS:
extr    #2
mov     PT0, #0
mov     PP0, #0EA5h
mov     PW0, #0         ; AGR not used
extr    #2
mov     PT1, #0
mov     PP1, #30D3h
mov     PW1, #0         ; N75
extr    #2
mov     PT2, #0
mov     PP2, #2EDFh
mov     PW2, #0         ; TB
extr    #2
mov     PT3, #0
mov     PP3, #0FFFFh
mov     PW3, #0         ; EVAP
mov     PWMCON0, #0BFh ; '+'
mov     PWMCON1, #0Fh
extr    #1
mov     PWMIC, #5Fh ; '_'
mov     T01CON, #414Ah
mov     T3CON, #0
mov     T78CON, #464Ah
rets

Code:
INPUTS_1:
mov     r4, INPUT_uhsv_word_F818
shr     r4, #2
movb    uhsv_byte_3808AE, rl4
mov     r4, INPUT_wub_w_word_F816
shr     r4, #2
movb    wub_w_byte_3808B4, rl4
mov     r4, INPUT_uulsuv_w_word_F814
and     r4, #3FFh
mov     uulsuv_w_word_380E14, r4
mov     r5, INPUT_ushk_w_word_F812
and     r5, #3FFh
mov     ushk_w_word_380E16, r5
mov     r2, INPUT_upwg1_w_word_F810
and     r2, #3FFh
mov     upwg1_w_word_380E0E, r2
mov     r3, INPUT_upwg2_w_word_F80E
and     r3, #3FFh
mov     upwg2_w_word_380E10, r3
mov     r1, INPUT_wtmot_w_word_F80C
and     r1, #3FFh
mov     wtmot_w_word_380E1C, r1
mov     r2, word_F80A
and     r2, #3FFh
mov     word_380DFC, r2 ; unused
mov     r2, word_F806
and     r2, #3FFh
mov     word_380E1A, r2 ; unused
mov     r4, #1Eh
mov     r5, #120h
extp    r5, #1
movb    rl3, [r4]
movb    wtans_byte_3808B2, rl3
mov     r4, #20h ; ' '
mov     r5, #120h
extp    r5, #1
movb    rl2, [r4]
movb    byte_3808B3, rl2 ; unused
mov     r4, #22h ; '"'
mov     r5, #120h
extp    r5, #1
movb    rl1, [r4]
movb    uldpe_byte_3808B0, rl1
mov     r4, #14h
mov     r5, #120h
extp    r5, #1
movb    rl3, [r4]
movbz   r4, rl3
mov     r12, #0FFh
sub     r12, r4
cmp     r12, #80h ; ''
jmpr    cc_ULE, loc_83E896

Code:
E_SFR:0002 ; =============== S U B R O U T I N E =======================================
E_SFR:0002
E_SFR:0002 ; Read ADC - 16 bit result into an array
E_SFR:0002
E_SFR:0002                 public INPUTS_ReadADC3_f002
E_SFR:0002 INPUTS_ReadADC3_f002:
E_SFR:0002                 mov     [-r0], r6
E_SFR:0004                 mov     ADCON, #280h
E_SFR:0008
E_SFR:0008 loc_F008:                               ; CODE XREF: INPUTS_ReadADC3_f002:loc_F008j
E_SFR:0008                 jnb     ADCIR, loc_F008
E_SFR:000C                 bclr    ADCIR
E_SFR:000E                 mov     r4, ADDAT_word_FEA0
E_SFR:0012                 and     r4, #3FFh
E_SFR:0016                 mov     [r12], r4
E_SFR:0018                 mov     ADCON, #2AFh
E_SFR:001C                 movb    rl6, #10h
E_SFR:0020
E_SFR:0020 loc_F020:                               ; CODE XREF: INPUTS_ReadADC3_f002:loc_F020j
E_SFR:0020                                         ; INPUTS_ReadADC3_f002:loc_F03Ej
E_SFR:0020                 jnb     ADCIR, loc_F020
E_SFR:0024                 bclr    ADCIR
E_SFR:0026                 mov     r4, ADDAT_word_FEA0
E_SFR:002A                 and     r4, #3FFh
E_SFR:002E                 mov     r5, r12
E_SFR:0030
E_SFR:0030 loc_F030:                               ; DATA XREF: INIT_OUTPUTS+2w
E_SFR:0030                 sub     r5, #2
E_SFR:0032
E_SFR:0032 loc_F032:                               ; DATA XREF: INIT_OUTPUTS+10w
E_SFR:0032                 movbz   r2, rl6
E_SFR:0034
E_SFR:0034 loc_F034:                               ; DATA XREF: Seg0x208@820000:28A6w
E_SFR:0034                                         ; ADVE+F4w ...
E_SFR:0034                 shl     r2, #1
E_SFR:0036
E_SFR:0036 loc_F036:                               ; DATA XREF: INIT_OUTPUTS+2Cw
E_SFR:0036                                         ; sub_8A6CD0+8Cw
E_SFR:0036                 add     r5, r2
E_SFR:0038
E_SFR:0038 loc_F038:                               ; DATA XREF: INIT_OUTPUTS+6w
E_SFR:0038                 mov     [r5], r4
E_SFR:003A
E_SFR:003A loc_F03A:                               ; DATA XREF: TKSTA_0:loc_877F4Cr
E_SFR:003A                                         ; sub_878000+104r ...
E_SFR:003A                 subb    rl6, #1
E_SFR:003C
E_SFR:003C loc_F03C:                               ; DATA XREF: INIT_OUTPUTS+22w
E_SFR:003C                 cmpb    rl6, #0
E_SFR:003E
E_SFR:003E loc_F03E:                               ; DATA XREF: INIT_OUTPUTS+30w
E_SFR:003E                                         ; sub_8A6C8C+10w ...
E_SFR:003E                 jmpr    cc_UGT, loc_F020
E_SFR:0040                 mov     r6, [r0+]
E_SFR:0042                 rets
E_SFR:0042 ; End of function INPUTS_ReadADC3_f002
Logged
elRey
Hero Member
*****

Karma: +32/-1
Offline Offline

Posts: 565


« Reply #3 on: August 31, 2014, 10:15:15 AM »

my notes on pin setup (032HS file):

Quote
ODP2 C340 11000011 01000000
P2 C7BF 11000111 10111111
DP2 3CBF 0111100 10111111

CCM0 0
CCM1 0
CCM2 400 0000 0100 0000 0000
CCM3 A900 1010 1001 0000 0000
CCM4 B00C 1011 0000 0000 1100
CCM5 BB 0000 0000 1011 1011
CCM6 0
CCM7 0


CC0IC 37 001 10111 IE
CC2IC 36 001 10110 IE
CC3IC 35 001 10101 IE
CC10IC 20 001 00000 IE
CC14IC 7D 011 11101 IR/IE
CC16IC 17 000 10111
CC19IC 28 001 01000 IE
CC20IC 29 001 01001 IE
CC21IC 22 001 00010 IE
CC22IC 0 000 00000
CC23IC 70 011 10000 IR/IE
CC26IC 1C 000 11100
CC28IC 71 011 10001 IR/IE
CC29IC 72 011 10010 IR/IE
CC30IC 73 011 10011 IR/IE

 - PIN - DIR - MODE -
CC0 P2.0 OUT 000
CC1 P2.1 OUT 000
CC2 P2.2 OUT 000
CC3 P2.3 OUT 000
CC4 P2.4 OUT 000
CC5 P2.5 OUT 000
CC6 P2.6 IN 000
CC7 P2.7 OUT 000
CC8 P2.8 IN 000
CC9 P2.9 IN 000
CC10 P2.10 OUT 100
CC11 P2.11 OUT 000
CC12 P2.12 OUT 000
CC13 P2.13 OUT 000
CC14 P2.14 OUT 001
CC15 P2.15 IN 010

CC16 P8.0 OUT 100
CC17 P8.1 IN 000
CC18 P8.2 IN 000
CC19 P8.3 IN 011
CC20 P8.4 IN 011
CC21 P8.5 IN 011
CC22 P8.6 IN 000
CC23 P8.7 OUT 000

CC24 P1H.4 000
CC25 P1H.5 000
CC26 P1H.6 000
CC27 P1H.7 000

CC28 P7.4 OUT 000
CC29 P7.5 OUT 000
CC30 P7.6 OUT 000
CC31 P7.7 OUT 000



ODP3 8B1F 10001011 00011111
P3 2FC1 00101111 11000001
DP3 35E0 00110101 11100000

P3.0 IN
P3.1 IN
P3.2 IN
P3.3 IN
P3.4 IN
P3.5 OUT
P3.6 OUT
P3.7 OUT
P3.8 OUT
P3.9 IN
P3.10 OUT
P3.11 IN
P3.12 OUT
P3.13 OUT
P3.14 IN
P3.15 IN

P4 E0 11100000
DP4 CF 11001111

P4.0 OUT
P4.1 OUT
P4.2 OUT
P4.3 OUT
P4.4 IN
P4.5 IN CAN-RX
P4.6 OUT CAN-TX
P4.7 OUT

ODP6 80 10000000
P6 80 10000000
DP6 7F 01111111

P6.0 OUT
P6.1 OUT
P6.2 OUT
P6.3 OUT
P6.4 OUT
P6.5 OUT
P6.6 OUT
P6.7 IN

P7 74 01110100
DP7 FF 11111111

PWMCON0 BF 0000 0000 1011 1111
PWMCON1 F 0000 0000 0000 1111
PWMIC 5F 0101 1111

P7.0 OUT PW0 AGR
P7.1 OUT PW1 N75
P7.2 OUT PW2 TB
P7.3 OUT PW3 EVAP
P7.4 OUT CC28
P7.5 OUT CC29
P7.6 OUT CC30
P7.7 OUT CC31

P8 F8 11111000
DP8 81 10000001

P8.0 OUT CC16
P8.1 IN CC17
P8.2 IN CC18
P8.3 IN CC19
P8.4 IN CC20
P8.5 IN CC21
P8.6 IN CC22
P8.7 OUT CC23

« Last Edit: August 31, 2014, 10:17:56 AM by elRey » Logged
terminator
Sr. Member
****

Karma: +15/-4
Offline Offline

Posts: 425


« Reply #4 on: September 08, 2014, 07:31:19 AM »

Have you successfully enabled additional pin?
Logged
elRey
Hero Member
*****

Karma: +32/-1
Offline Offline

Posts: 565


« Reply #5 on: September 08, 2014, 08:19:22 AM »

I have. Not so much as enabling as identifying pin and memory location.

ecu pin 17,19, 100 are unused A/D inputs. on the AWP 1.8T ecu. Trying to identify other non-A/D input out puts.
Logged
terminator
Sr. Member
****

Karma: +15/-4
Offline Offline

Posts: 425


« Reply #6 on: September 08, 2014, 12:25:23 PM »

Thats already good progress. And what for do you want to enable additional pin?

I think its useful for adding switch for maps selection. 
Logged
elRey
Hero Member
*****

Karma: +32/-1
Offline Offline

Posts: 565


« Reply #7 on: September 08, 2014, 12:37:28 PM »

I want a second MAP sensor input for a compound turbo setup.
Also want to add an OEM EGT sensor to monitor EGTs.

Then there's outputs for inline fuel pump I want on only when needed and to repurpose kombi valve solenoid for a boost actuated exhaust cutout valve.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Page created in 0.019 seconds with 17 queries. (Pretty URLs adds 0.001s, 0q)