Page 3 of 3 FirstFirst 123
Results 31 to 35 of 35

Thread: Crank timing for COP 4AFE/7Afe

  1. #31
    Forum Member 1st year Apprentice
    Join Date
    Apr 2019
    Location
    vic
    Posts
    32

    Default Re: Crank timing for COP 4AFE/7Afe

    Hi Ceasar How good are you with arduino code? I written code that gets me 90% there just a little stuck now, the squencer works with 4 leds (simulating the coils) and a switch (simulating the tach signal), but it has 2 issues. 1st the Led stays on when the switch is released. 2nd I havent been able to get it to resart with the second switch (simulating the cam signal). The delay is there to slow it down so you can see whats happening.

    // SEQUENCER WITH BUTTON
    int ledPin1 = 13;

    int ledPin2 = 12;

    int ledPin3 = 11;

    int ledPin4 = 10;

    int butPress1 = 9;

    int countBP = 0;

    void setup()

    {

    pinMode(ledPin1, OUTPUT);

    pinMode(ledPin2, OUTPUT);

    pinMode(ledPin3, OUTPUT);

    pinMode(ledPin4, OUTPUT);

    pinMode(butPress1, INPUT);

    }

    void loop()

    {

    digitalWrite(ledPin1, LOW);

    digitalWrite(ledPin2, LOW);

    digitalWrite(ledPin3, LOW);

    digitalWrite(ledPin4, LOW);

    countBP = digitalRead(butPress1);

    while (countBP != 0)

    {

    switch (countBP)

    {

    if (countBP == 0)

    {

    case 1:

    digitalWrite(ledPin1, HIGH);

    digitalWrite(ledPin2, LOW);

    digitalWrite(ledPin3, LOW);

    digitalWrite(ledPin4, LOW); delay(100);

    countBP = countBP + digitalRead(butPress1);

    break;

    }

    if (countBP == 1)

    {

    case 2:

    digitalWrite(ledPin1, LOW);

    digitalWrite(ledPin2, HIGH);

    digitalWrite(ledPin3, LOW);

    digitalWrite(ledPin4, LOW); delay(100);

    countBP = countBP + digitalRead(butPress1);

    break;

    }

    if (countBP == 2)

    {

    case 3:

    digitalWrite(ledPin1, LOW);

    digitalWrite(ledPin2, LOW);

    digitalWrite(ledPin3, HIGH);

    digitalWrite(ledPin4, LOW); delay(100);

    countBP = countBP + digitalRead(butPress1);

    break;

    }

    if (countBP == 3)

    { case 4:

    digitalWrite(ledPin1, LOW);

    digitalWrite(ledPin2, LOW);

    digitalWrite(ledPin3, LOW);

    digitalWrite(ledPin4, HIGH); delay(100);

    countBP = countBP + digitalRead(butPress1);

    break;

    }

    default:

    digitalWrite(ledPin1, LOW);

    digitalWrite(ledPin2, LOW);

    digitalWrite(ledPin3, LOW);

    digitalWrite(ledPin4, LOW);

    countBP = 0;

    break;

    }

    }

    }

  2. #32
    Forum Member 1st year Apprentice
    Join Date
    Dec 2018
    Location
    Alvsborg
    Posts
    49

    Default Re: Crank timing for COP 4AFE/7Afe

    Hello! sadly, not good enough i guess haha.

    Nice code, for the problems i had a AVR intro course a while back which kind of touched on what you are stuck on. Will se if i find a it.
    One easy way to turn of the led is just to set low just before break?
    But im would set a interrupt on the butPress with CHANGE, so on the first interrupt it does the "set high" and on second interrupt it will set all leds to low?

    Or two interrupts one that tracing rising edge and count and sets leds to high and one interrupt for falling edge which set leds to low.

    which one is the second switch? "2nd I havent been able to get it to resart with the second switch " cant seem to find that input?

  3. #33
    Forum Member 1st year Apprentice
    Join Date
    Dec 2018
    Location
    Alvsborg
    Posts
    49

    Default Re: Crank timing for COP 4AFE/7Afe

    Here is the code, is C code for just AVR chip's, simular to the AVR chip use in arduino.

    I like this method of just going portwise operations and just by choosing what kind of interrupt this code could go from just lighting the led push and keeping it on, or just lighting it up while pushed.
    I know arudino also have AVR libery which can help.

    https://github.com/vanDeventer/AS2p/blob/extInt/main.c

    Im going to try out your code this week and see, i learn better by trying codes out then to just read them

  4. #34
    Forum Member 1st year Apprentice
    Join Date
    Apr 2019
    Location
    vic
    Posts
    32

    Default Re: Crank timing for COP 4AFE/7Afe

    Thanks Ceasar, Ill have a bit more of a play with it, I did have a second button on the code but as I couldn't get it to work I removed it. I was trying to solve one problem at a time before introducing another issue.

  5. #35
    Forum Member 1st year Apprentice
    Join Date
    Apr 2019
    Location
    vic
    Posts
    32

    Default Re: Crank timing for COP 4AFE/7Afe

    Hi Ceasar I've got the code sorted if you want to have a go, It's full sequential and uses the tach signal from the ECU and you will have fit a cam sensor on the cam pulley that goes high about 120 degrees before TDC on the number one cylinder. It works on the bench I've not fitted it to an engine yet. there may be problems with electrical noise as an Arduino is very fast it can mistake a voltage spike as a signal.
    Let me know if you would like the code.

Similar Threads

  1. Undoing crank bolt on auto 4AFE/4AFC - and retorque
    By highrolla in forum Tech and Conversions
    Replies: 9
    Last Post: 09-06-2017, 05:17 PM
  2. 4afe to 7afe AE92
    By wa5 in forum Tech and Conversions
    Replies: 0
    Last Post: 27-07-2015, 10:45 PM
  3. 4AFE to 7AFE AE92 hatch
    By mattysshop in forum Engine & Driveline Conversions
    Replies: 12
    Last Post: 24-09-2009, 03:48 PM
  4. 7afe Crank angle sensor on the OIL PUMP (97 Geo Prizm )
    By Cameron_Datto in forum Tech and Conversions
    Replies: 1
    Last Post: 28-05-2008, 03:01 PM
  5. Crank timing pulley timing belt guide, fixed or spinning?
    By Howieau in forum Tech and Conversions
    Replies: 2
    Last Post: 27-09-2007, 07:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •