Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

coding for car parking system using PIC16F84A and 7 segment LED counter

Status
Not open for further replies.

eyan23

Newbie level 5
Newbie level 5
Joined
Sep 17, 2010
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,390
i have done it for my fyp.but something was wrong. can anyone tell me what wrong with my coding? it my first time joining the forum and doing programming in MPLAB. all the advise i will appreciate. thanks..

;TITLE: AVAILABLE PARKING SPACE
;PIC TYPE: 16F84A
;OSCILLATOR SPEED: 4 MHz

LIST p=16F84A
#include "P16F84A.INC"
ORG OCH
TEMP1 RES 1
TEMP2 RES 1
;***********PORT A: ALL INPUT**********
;#DEFINE RX4 PORTA,0
;#DEFINE RX3 PORTA,1
;#DEFINE RX2 PORTA,2
;#DEFINE RX1 PORTA,3
;#DEFINE ENTR PORTA,4

;**********PORT B: ALL OUTPUT**********
;#DEFINE 1a PORTB,0
;#DEFINE 1b PORTB,1
;#DEFINE 1c PORTB,2
;#DEFINE 1d PORTB,3
;#DEFINE 1e PORTB,4
;#DEFINE 1f PORTB,5
;#DEFINE 1g PORTB,6
;#DEFINE PAO STATUS,5
;#DEFINE EXIT PORTB,7
;DRAWER1 EQU 3DH
;**********MAIN PROGRAM STARTS HERE**********

INIT CLRF PORTA
CLRF PORTB
BSF PAO
MOVLW b'11111'
MOVWF TRISA
; MOVLW b'00000000'
; MOVWF TRISB
BCF PAO
;*********START*********
MOVLW 04H
MOVWF DRAWER1
CHECK BTFSC ENTR
GOTO NEXT
DECF DRAWER1,1
GOTO DISPLAY
NEXT BTFSC EXIT
GOTO CHECK
INCF DRAWER1,1
GOTO DISPLAY
GOTO CHECK
DISPLAY ORG 0000H
MOV PSW,#00H
MOV A,#00H
SETB C
MOV R3,#70H
MOV R4,#70H
X1: MOV P2,#01H ; P2 DISPLAY SELECT
MOV P0,#00H ; P0 SEGMENTS
ACALL DEL
MOV P0,#44H
ACALL DEL
MOV P2,#02H
MOV P0,#00H
ACALL DEL
MOV P0,#3DH
ACALL DEL
MOV P2,#04H
MOV P0,#00H
ACALL DEL
MOV P0,#7CH
ACALL DEL
MOV P2,#08H
MOV P0,#00H
ACALL DEL
MOV P0,#4EH
ACALL DEL
JNC X2
DJNZ R3,X3
AJMP X4
X3: MOV P2,#80H
MOV P0,#00H
ACALL DEL
MOV P0,#7AH
ACALL DEL
AJMP X5
X2: DJNZ R4,X5
CPL C
MOV R4,#70H
AJMP X5
X4: MOV R3,#70H
CPL C
X5: MOV P2,#40H
MOV P0,#00H
ACALL DEL
MOV P0,#7BH
ACALL DEL
MOV P2,#20H
MOV P0,#00H
ACALL DEL
MOV P0,#54H
ACALL DEL
MOV P2,#10H
MOV P0,#00H
ACALL DEL
MOV P0,#7FH
ACALL DEL
AJMP X1
DEL: MOV B,#7FH
DJNZ B,$
ret
end
 
Last edited:

It's very difficult to debug assembler code especially when you don't even say what the system is suppose to do and the actual problem is.
 

the system is about to show the parking lot available. the 7 segment LED counter will count the parking available and display them. The sensor will be locate in every parking lot. when there are the car in the parking lot,the sensor will detect it then the 7 segment LED counter will count them. the problem is it the 7 segment LED counter does not display,does not function well. there are some conflict among the PIC and 7 segment LED counter.
 

Surely, it would be a lot simpler counting the arriving and leaving cars rather than having a sensor on every parking space. Unless you have more entrances/exits than parking spaces. ROFL.
 
  • Like
Reactions: eyan23

    eyan23

    Points: 2
    Helpful Answer Positive Rating
you're right. it also save the cost too. i will try to change the code. or can you give me the advise about the changing codes? thanks..
 

I can't exactly help you change the code without spending a lot of time (that I don't have right now :D ) on understanding how your head worked when you made the original code :)

I could try to help you out modify the 'algorithm' the system is supposed to follow.
 
  • Like
Reactions: eyan23

    eyan23

    Points: 2
    Helpful Answer Positive Rating
thanks for ur kindness. i wish u can help me in coding and modifying the algorithm of this system.
 

:roll:I've read the whole thread..I happen to work on the same microcontroller, pic16f84a, and honestly..it is quite hard to code using assembly language, as it is a lower level type:?..why not used a higher level one..like basic programming..link to this page Compilers - mikroElektronika;-)
 

You need to code the project in Assembly language or in C?

---------- Post added at 09:14 ---------- Previous post was at 09:12 ----------

Try this link.
Parking Garage Project ---HELP.\
This may help you.
Regards,
Jerin. :)
 

:roll:I've read the whole thread..I happen to work on the same microcontroller, pic16f84a, and honestly..it is quite hard to code using assembly language, as it is a lower level type:?..why not used a higher level one..like basic programming..link to this page Compilers - mikroElektronika;-)



Two reasons
a) It's most likely a school project and the assignment is to do it in Assembler

b) With simple programs like this, it might actually be simpler doing it in Assembler rather than bothering with the overhead of a higher level programming language.
 

Ya. For school project purpose assembly would be fine but the code will be very long.... :-(
Thatz the only problem with assembly program.
Regards,
Jerin. :)
 

Dude, he's doing a simple counter and 7segment decoder - it's only about 100 or so ASM instructions. :lol:
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top