Welcome, Guest. Please login or register.

Author Topic: rev counter adjusting  (Read 1393 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline amiga4001Topic starter

  • Hero Member
  • *****
  • Join Date: Sep 2004
  • Posts: 537
    • Show only replies by amiga4001
rev counter adjusting
« on: August 05, 2007, 06:29:08 PM »
I purchased an electronic revcounter for my car.
It needs to be readjusted so it will show the correct rpm.
It works by taking an impulse from the distributor.
Every impulse represents a certain amount off rpm.
I was thinking about some kind off relay powered by either an amiga500 or a commodore 64.
This way I can set the pulses and see what the gauge reads.
But where to find a schematic for a relaycard?
Nothing fancy just one relay will do nicely.
 

Offline gazgod

  • Sr. Member
  • ****
  • Join Date: Sep 2005
  • Posts: 282
    • Show only replies by gazgod
    • http://www.lincsamiga.org.uk
Re: rev counter adjusting
« Reply #1 on: August 05, 2007, 08:12:53 PM »
The only adjustment you should need with a rev counter is the number of to set the number of cylinders in your engine, ie the number of pulses per revolution of the engine.


Offline amiga4001Topic starter

  • Hero Member
  • *****
  • Join Date: Sep 2004
  • Posts: 537
    • Show only replies by amiga4001
Re: rev counter adjusting
« Reply #2 on: August 16, 2007, 09:57:21 PM »
Well this rev counter has a adjustment which you can set to meet the resistance in the revcounter.
That is connections,aging electricalparts in the counter and the resistance off the moving parts inside.
I now have a working setuo with my C64 to power the gauge.
First time in basic:
10 poke 56579,1 to initialize the gate I believe.
20 poke 56577,0
30 poke 56577,1
40 a=a+a;?a
50 goto 20

This way I gat maximum off 600 rev/min on the revcounter.
Basic seems to slow...for nice adjustment.

So in assembler?:

c000 lda #$01
c002 sta $dd03
c005 lda#$00
c007 sta $dd01
c00a jsr $c020
c00d lda #$01
c00f sta $dd01
c012 jsr $c020
c015 jmp$c005

c020 ldx #$00
c022 inx
c023 bne $c022
c025 rts


With this I get about 4500 rev/min on my gauge very usable but I need to know the pulses the c64 gives to set the gauge.
So a a=a+1 and a print a in assembler???


 

Offline skurk

  • Hero Member
  • *****
  • Join Date: Dec 2006
  • Posts: 929
    • Show only replies by skurk
Re: rev counter adjusting
« Reply #3 on: August 16, 2007, 10:47:18 PM »
Based on your BASIC program (and provided that I read it right) I would guess the assembler version should go something like this (saving a few cycles here and there):

Code: [Select]

    ldx #1
    ldy #0
    sty $80     ; our "a", just a random spot in the ZP
    stx $dd03
loop:
    sty $dd01
    stx $dd01
    inc $80
    jmp loop

This would naturally loop forever and won't do much as-is.  You also need a timer and a print function.  Let me know if you need more help and I'll be glad to assist.
Code 6502 asm or... DIE!!

[C64, C128, A500, A600, A1200, A3000, MBP+Mini, Efika/MOS2.1, Sam440 w/AOS4.1
 

Offline motrucker

Re: rev counter adjusting
« Reply #4 on: August 17, 2007, 12:29:41 AM »
I take it you aren't going drag racing with a tachometer like that!?  :-)
A2000 GVP 40MHz \'030, 21Mb RAM SD/FF, 2 floppies, internal CD-ROM drive, micromys v3 w/laser mouse
A1000 Microbotics Starboard II w/2Mb 1080, & external floppy (AIRdrive)
C-128 w/1571, 1750, & Final Cartridge III+
 

Offline amiga4001Topic starter

  • Hero Member
  • *****
  • Join Date: Sep 2004
  • Posts: 537
    • Show only replies by amiga4001
Re: rev counter adjusting
« Reply #5 on: August 17, 2007, 06:52:24 AM »
Dragracing?That is an idea!
No it is for an oldtimer a triumph gt6 mk1.
I can let a company do the adjusting but there is no fun in there and I want to learn some assembler on the C64 just for the fun.
On one side it is very simple and on the other...
The program skurk provided doesn't wan't to work gauge only moves a tiny bit.
Maybe beacuse i replaced the loop with a jmp command?
Or it is going to fast for the gauge or the fet which is powering the gauge.
Still I have no working program to drive my gauge and measure the pulses.
Is there no simple way to count an amount off loops?
And why does loop: don't work in the monitor off the powercartridge?
It's used in all C64 tutorials on machinelanguage.