Home Community

taxi meter using PIC16f84
Welcome, Guest. Please login or register.
May 19, 2013, 10:33:08 AM
Home Help Search Calendar Login Register
News: trade your components on this new board: "Components trade"

Advertisements
No New Posts
Today at 01:39:33 AM
in
Advertisements
by google

+  Electronics-Lab.com Community
|-+  Electronics Forums
| |-+  Projects Q/A (Moderators: gogo2520, Herman the German, Hero999)
| | |-+  taxi meter using PIC16f84
« previous next »
Pages: [1] Print
Author Topic: taxi meter using PIC16f84  (Read 869 times)
zam e
Newbie
*
Posts: 5


View Profile Email
« on: May 03, 2012, 08:03:20 AM »

i want to make this project...it will count time passenger in cab...then the time change to value that it must pay...example : 10 minute for 1 dollar.......20 minute for 2 dollar...
Logged

Hero999
Global Moderator
Electronics God
*****
Posts: 2471



View Profile
« Reply #1 on: May 03, 2012, 08:38:41 AM »

Where's the schematic and code?
Logged

I also post at:
http://www.silicontronics.com

I do not answer private messages asking for help because no one else can: benefit from advice I may give or correct me if I'm wrong.

Please ask on the open forum if you have a question: if I know the answer, I'll be happy to help.

zam e
Newbie
*
Posts: 5


View Profile Email
« Reply #2 on: May 03, 2012, 09:42:39 AM »

i dont have it..could u give any suggestion..i'm very thankful for it...
Logged

Hero999
Global Moderator
Electronics God
*****
Posts: 2471



View Profile
« Reply #3 on: May 03, 2012, 10:23:13 AM »

Sorry, no ones going to do your project for you. This is not a free electronic design service, I apologise if that's not clear. Electronics Lab is a forum where people help each other with their projects.

If you want someone to design your project for you, they'll more than likely charge you a fee and require you to supply them with a design specification first.
Logged

I also post at:
http://www.silicontronics.com

I do not answer private messages asking for help because no one else can: benefit from advice I may give or correct me if I'm wrong.

Please ask on the open forum if you have a question: if I know the answer, I'll be happy to help.

zam e
Newbie
*
Posts: 5


View Profile Email
« Reply #4 on: May 06, 2012, 11:33:12 AM »

LIST   P=PIC16F84
PORTA       EQU    05H
PORTB      EQU    06H
COUNTER      EQU   37
Hibyte      EQU   020
Lobyte      EQU   021
Count      EQU   26
Tents      EQU   022
Thous      EQU   023
Hunds      EQU   024
Tens      EQU   025
Ones      EQU   028
d1         EQU 019
d2         EQU 018
d3         EQU   017
Timer1      EQU   29
TimerX      EQU   2A
Point      EQU   2B   ; Program table pointer
Select      EQU   2C   ; Copy of RS bit
OutCod      EQU   2D   ; Temp store for output code
RS         EQU   1   ; Register select output bit
E         EQU   2   ; Display enable   
NUM_HIGH   EQU   30H
NUM_LOW      EQU   31H
X1         EQU   32
X2         EQU   33
X3         EQU   34


ORG         100H
GOTO      START
ORG         0H


START   MOVLW   B'00000001'
      TRIS   PORTA
      MOVLW    B'00000000'
      TRIS   PORTB   
      CALL   InitLCD
      CALL    Out_LCD0
      

      CLRF   PORTB
LOOP   BTFSS   PORTA,0
      GOTO   START
      CALL   Out_LCD1
      CALL   DELAY   
      BTFSS   PORTA,0
      GOTO   START
      CALL   Out_LCD2
      CALL   DELAY
      BTFSS   PORTA,0
      GOTO   START
      CALL   Out_LCD3
      CALL   DELAY
      GOTO   LOOP
      

      
RETURN

DELAY         ;30minutes delay
   movlw   0xB6
   movwf   d1
   movlw   0x64
   movwf   d2
   movlw   0x20
   movwf   d3
Delay30min_0
   decfsz   d1, f
   goto   $+2
   decfsz   d2, f
   goto   $+2
   decfsz   d3, f
   goto   Delay30min_0
   nop
   return

;-----------------------------------------------------------------------------------------------------------
Out_LCD1:      
BSF      Select,RS   ; Set display data mode
      MOVLW   'R'      ; Time period
      CALL      send      ; Display it
      MOVLW   'M'      ; Space
      CALL      send      ; Display it
      MOVLW   ' '      ; Equals
      CALL      send      ; Display it
      MOVLW   ' '      ; Space
      CALL      send      ; Display it
      MOVLW   ' '      ; Space
      CALL      send      ; Display it
      MOVLW   ' '      ; Space
      CALL      send      ; Display it

; Show fixed characters----------------------------------------------------------------------------
      MOVLW   ' '      ; Space
      CALL      send      ; Display it
      MOVLW   ' '      ; micro
      CALL      send      ; Display it
      MOVLW   '3'      ; secs
      CALL      send      ; Display it
      MOVLW   '.'      ; Space
      CALL      send      ; Display it
      MOVLW   '0'      ; Space
      CALL      send      ; Display it
      MOVLW   '0'      ; Space
      CALL   send         ; Display it

; Home cursor-----------------------------------------------------------------------------------------

      BCF      Select,RS   ; Set display command mode
      MOVLW   0x80      ; Code to home cursor
      CALL      send      ; Do it
      RETURN         ; done

;------------------------------------------------------------------
Out_LCD2      
BSF      Select,RS   ; Set display data mode
      MOVLW   'R'      ; Time period
      CALL      send      ; Display it
      MOVLW   'M'      ; Space
      CALL      send      ; Display it
      MOVLW   ' '      ; Equals
      CALL      send      ; Display it
      MOVLW   ' '      ; Space
      CALL      send      ; Display it
      MOVLW   ' '      ; Space
      CALL      send      ; Display it
      MOVLW   ' '      ; Space
      CALL      send      ; Display it

; Show fixed characters----------------------------------------------------------------------------
      MOVLW   ' '      ; Space
      CALL      send      ; Display it
      MOVLW   ' '      ; micro
      CALL      send      ; Display it
      MOVLW   '3'      ; secs
      CALL      send      ; Display it
      MOVLW   '.'      ; Space
      CALL      send      ; Display it
      MOVLW   '1'      ; Space
      CALL      send      ; Display it
      MOVLW   '0'      ; Space
      CALL      send      ; Display it

; Home cursor----------------------------------------------------------------------------------------

      BCF      Select,RS   ; Set display command mode
      MOVLW   0x80      ; Code to home cursor
      CALL      send      ; Do it
      RETURN         ; done

;------------------------------------------------------------------
Out_LCD3      
BSF      Select,RS   ; Set display data mode
      MOVLW   'R'      ; Time period
      CALL      send      ; Display it
      MOVLW   'M'      ; Space
      CALL      send      ; Display it
      MOVLW   ' '      ; Equals
      CALL      send      ; Display it
      MOVLW   ' '      ; Space
      CALL      send      ; Display it
      MOVLW   ' '      ; Space
      CALL      send      ; Display it
      MOVLW   ' '      ; Space
      CALL      send      ; Display it

; Show fixed characters----------------------------------------------------------------------------
      MOVLW   ' '      ; Space
      CALL      send      ; Display it
      MOVLW   ' '      ; micro
      CALL      send      ; Display it
      MOVLW   '3'      ; secs
      CALL      send      ; Display it
      MOVLW   '.'      ; Space
      CALL      send      ; Display it
      MOVLW   '2'      ; Space
      CALL      send      ; Display it
      MOVLW   '0'      ; Space
      CALL      send      ; Display it
; Home cursor----------------------------------------------------------------------------------------

      BCF      Select,RS   ; Set display command mode
      MOVLW   0x80      ; Code to home cursor
      CALL      send      ; Do it
      RETURN         ; done



Out_LCD0      
BSF      Select,RS   ; Set display data mode
      MOVLW   'W'      ; Time period
      CALL      send      ; Display it
      MOVLW   'E'      ; Space
      CALL      send      ; Display it
      MOVLW   'L'      ; Equals
      CALL      send      ; Display it
      MOVLW   'C'      ; Space
      CALL      send      ; Display it
      MOVLW   'O'      ; Space
      CALL      send      ; Display it
      MOVLW   'M'      ; Space
      CALL      send      ; Display it

; Show fixed characters----------------------------------------------------------------------------
      MOVLW   'E'      ; Space
      CALL      send      ; Display it
      MOVLW   ' '      ; micro
      CALL      send      ; Display it
      MOVLW   ' '      ; secs
      CALL      send      ; Display it
      MOVLW   ' '      ; Space
      CALL      send      ; Display it
      MOVLW   ' '      ; Space
      CALL      send      ; Display it
      MOVLW   ' '      ; Space
      CALL      send      ; Display it
; Home cursor----------------------------------------------------------------------------------------

      BCF      Select,RS   ; Set display command mode
      MOVLW   0x80      ; Code to home cursor
      CALL      send      ; Do it
      RETURN         ; done


; MAIN LOOP-----------------------------------------------------------------------------------------   
      
send    MOVWF    OutCod    ; Store output code
      ANDLW    0FF       ; Clear low nybble
      MOVWF    PORTB    ; Output high nybble
      BTFSC    Select,RS    ; Test RS bit
      BSF       PORTB,RS    ; and set for data
      
      CALL       PulseE    ; and clock display
      CALL       Onems    ; wait 1ms for display
      SWAPF    OutCod    ; Swap low/high nybbles
      MOVF    OutCod,W    ; Retrieve output code
      ANDLW    0FF       ; Clear low nybble
      MOVWF    PORTB    ; Output low nybble
      BTFSC    Select,RS    ; Test RS bit
      BSF       PORTB,RS    ; and set for data
      CALL       PulseE    ; and clock display
      CALL       Onems    ; wait 1ms for display
      RETURN

; SUBROUTINES------------------------------------------------------------------------------------
; 1ms delay with 1us cycle time (1000 cycles)-------------------

Onems    MOVLW    D'249'       ; Count for 1ms delay
      MOVWF    Timer1    ; Load count
Loop1    NOP          ; Pad for 4 cycle loop
      DECFSZ    Timer1    ; Count
      GOTO    Loop1    ; until Z
      RETURN          ; and finish

; Delay Xms, X received in W -----------------------------------

Xms       MOVWF    TimerX    ; Count for X ms
LoopX    CALL       Onems    ; Delay 1ms
      DECFSZ    TimerX    ; Repeat X times
      GOTO    LoopX    ; until Z
      RETURN          ; and finish



; Generate data/command clock siganl E -------------------------

PulseE    BSF       PORTB,E    ; Set E high
      CALL       Onems    ; Delay 1ms
      BCF       PORTB,E    ; Reset E low
      CALL       Onems   ; Delay 1ms
      RETURN

; Initialize the display -------------------------------------------------------------------------------

InitLCD    MOVLW    D'100'    ; Load count 100ms delay
      CALL       Xms       ; and wait for display
      MOVLW    0F0       ; Mask for select code
      MOVWF    Select       ; High nybble not masked
      MOVLW    0x30       ; Load initial nibble
      MOVWF    PORTB    ; and output it to display
      CALL       PulseE    ; Latch initial code
      MOVLW    D'5'       ; Set delay 5ms
      CALL       Xms       ; and wait
      CALL       PulseE    ; Latch initial code again
      CALL       Onems    ; Wait 1ms
      CALL       PulseE    ; Latch initial code again
      BCF       PORTB,   4 ; Set 4-bit mode
      CALL       PulseE    ; Latch it
      MOVLW    0x28       ; Set 4-bit mode, 2 lines
      CALL       send       ; and send code
      MOVLW    0x08       ; Switch off display
      CALL       send       ; and send code
      MOVLW    0x01       ; Clear display
      CALL       send       ; and send code
      MOVLW    0x06       ; Enable cursor auto inc
      CALL       send       ; and send code
      MOVLW    0x80       ; Zero display address
      CALL       send       ; and send code
      MOVLW    0x0C       ; Turn on display
      CALL       send       ; and send code
      
      RETURN          ; Done

      END
Logged

zam e
Newbie
*
Posts: 5


View Profile Email
« Reply #5 on: May 06, 2012, 11:36:04 AM »

this is my coding...it have problem... it only execute display 5 times only...after that it have overwrite error... i dont know how to solve it...
Logged

zam e
Newbie
*
Posts: 5


View Profile Email
« Reply #6 on: May 06, 2012, 11:38:22 AM »

i have the circuit..how to show here...
Logged

Pages: [1] Print 
« previous next »
Jump to:  

Advertisements
No New Posts
Today at 01:39:33 AM
in
Advertisements
by google


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!

 

 

Search Site | Advertising | Add your link here | Contact Us | Android TV Box
Elektrotekno.com | Free Schematics Search Engine | Electronic Kits | Electronic Accessories