Odo-meter for Knight Rider.


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1

    Default Odo-meter for Knight Rider.

    Hi,

    I'm new here, and I'm currently convert my car into KITT from Knight Rider.
    Some design are ready.
    And now I wanted making functional odo meter.




    I'm using cyberdyne speedosensor that count 8000 pulse a mile -> 5000 a KM.

    I have fount the code and adapted that not count down. only count up.
    But how can I change into 5000 pulse a KM.
    It's writed in picbasic. (*.bas)
    Oh, I'll use PIC16F628 or do you recommend other PIC.
    And I use simple RCD programmer.

    Code:
    '****************************************************************
    '*  Author  : Coenen Stijn [Stynus]                             *
    '*  Notice  : Copyright (c) 2008 ElektronicaStynus.be           *
    '*          : All Rights Reserved                               *
    '*  Date    : 20/07/2008                                        *
    '*  Version : 1.8                                               *
    '*  Notes   : Teller                                            *
    '****************************************************************
    Device  16F628
    Config WDT_OFF, PWRTE_OFF, MCLRE_OFF, INTRC_OSC_NOCLKOUT, LVP_OFF, BODEN_ON 
    ALL_DIGITAL         =   true  
    '****************************************************************         
    Symbol  Cu          =   PORTA.0
    Symbol  noPower     =   PORTA.4
    Symbol  digit2      =   PORTA.6
    Symbol  digit3      =   PORTA.7
    Symbol  digit4      =   PORTA.5
    Symbol  digita      =   PORTB.0
    Symbol  display     =   PORTB
    Symbol  digit1      =   PORTB.7
    '****************************************************************
            TRISA       =   %00111111
            TRISB       =   %00000000
    '**************************************************************** 
    Dim     CuBit       As  Bit
    Dim     index       As  Byte
    Dim     waarde      As  Byte
    Dim     waarde1000  As  Byte
    Dim     waarde100   As  Byte
    Dim     waarde10    As  Byte
    Dim     waarde1     As  Byte
    '**************************************************************** 
    'Init
    Clear
    DelayMS 1000
    'Oude tellerstand terug inlezen  
    waarde1   =   ERead 0 
    waarde10  =   ERead 1
    waarde100 =   ERead 2
    waarde1000 =  ERead 3
    
    DelayMS 1000
    '****************************************************************
    While 1 = 1
    '************************************************************
        'Knoppen inlezen
        'Count up
        If Cu = 0 And CuBit = 0 Then
            Inc waarde1
            If waarde1 = 10 Then
                waarde1 = 0
                Inc waarde10
                If waarde10 = 10 Then
                    waarde10 = 0
                    Inc waarde100
                    If waarde100 = 10 Then
                        waarde100 = 0
    		    Inc waarde1000
       	   	    If waarde1000 = 10 Then
    		       waarde1000 = 0
                        EndIf
                    EndIf            
                EndIf            
            EndIf
            CuBit = 1
        EndIf
        If Cu = 1 And CuBit = 1 Then
            CuBit = 0
        EndIf
        GoSub spanningweg
        EndIf    
        '************************************************************ 
        GoSub dispuit   
    Wend
    '**************************************************************** 
    'Subroutines
    dispuit:
        For index = 0 To 3  
            Select index
                Case 0
                    waarde  = waarde1
                Case 1
                    waarde  = waarde10          
                Case 2
                    waarde  = waarde100  
    	    Case 3
    		waarde  = waarde1000        
            EndSelect   
            Select Case waarde    
            Case 0          'gfedcba
                display =  %00111111    
            Case 1          'gfedcba
                display =  %00000110              
            Case 2          'gfedcba
                display =  %01011011              
            Case 3          'gfedcba
                display =  %01001111              
            Case 4          'gfedcba
                display =  %01100110              
            Case 5          'gfedcba
                display =  %01101101              
            Case 6          'gfedcba
                display =  %01111101             
            Case 7          'gfedcba
                display =  %00000111              
            Case 8          'gfedcba
                display =  %01111111             
            Case 9          'gfedcba
                display =  %01101111  
            'Bij fout
            Case Else       'gfedcba
                display =  %01111001     
            EndSelect
            Select index
                Case 0
                    High    digit1
                Case 1
                    High    digit2            
                Case 2
                    High    digit3    
    	    Case 3
    		High    digit4        
            EndSelect 
            DelayMS 1
            GoSub spanningweg
            Low digit1
            Low digit2
            Low digit3
    	Low digit4
        Next
    Return
    spanningweg:
        'Controleren op voedingsspanning
        If noPower = 1 Then
            EWrite 0 , [waarde1]
            DelayMS 20
            EWrite 1 , [waarde10]
            DelayMS 20
            EWrite 2 , [waarde100]
            DelayMS 20
    	EWrite 3 , [waarde1000]
    	While noPower = 1
                DelayMS 1000
            Wend
        EndIf
    Return
    '**************************************************************** 
    End

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    You posted this in the 'mel PIC BASIC' forum.
    Try this statement:

    Proton Basic <> MeLabs PicBasic AND Proton Basic <> MeLabs PicBasicPro

  3. #3


    Did you find this post helpful? Yes | No

    Default

    Oh...

    Can admin move this threat for me?

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by captain nguyen View Post
    Oh...

    Can admin move this threat for me?
    Can you find the Proton Basic forum section here?

  5. #5


    Did you find this post helpful? Yes | No

    Default

    Do you mean "mel PIC BASIC Pro"?
    If yes, but how can I move this threat?

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by captain nguyen View Post
    Do you mean "mel PIC BASIC Pro"?
    If yes, but how can I move this threat?
    There is no THREAT here.

    Apparently, you are NOT using MeLabs PicBasicPro. You are using PROTON Basic.
    Try again.
    Or maybe you expect somebody to covert a Proton Basic program to PicBasicPro for you?

Similar Threads

  1. Hall Effect flow meter with 16F876
    By revelator in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 10th March 2010, 20:42
  2. VU Meter
    By Andre_Pretorius in forum General
    Replies: 4
    Last Post: - 20th May 2009, 16:17
  3. PIC10F206 - What is the LOWEST Power @ Rest or Sleep
    By rixtalbert in forum mel PIC BASIC Pro
    Replies: 22
    Last Post: - 18th March 2007, 14:42

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

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