Inventory monitoring system..Need help in assembly

Thread Starter

daredavel

Joined Feb 22, 2010
32
hi guys! i've been making this project of mine in the past 3 weeks..i admit, i'm not good at assembly..may friend revise my original coding and now i'm having problem with it..
..although its working..but its not finish yet.. I'm asking for all your help guys to finish the program..i would really appreciate it..

About my project:

The user will set how many sensors(maximum of 12 sensors-switch type) he/she will use with the push-buttons(inc, dec).. The 7segment will display the number of sensors used and number of tools missing(0 for non..1-12 for the number of missing)..every 5secs the display changes..showing both sensors used and number of tools missing..

The leds shows if the sensors are active.. If the led is blinking, that means the tool is not placed or missing..if its in a standby lit, that means the tool is there and is detected by the sensor..

I need help in:

1) Buzzer sound - buzzer doesnt sound..and i dont know how to generate an alarm sound.

2) Buzzer Delay - if the tools are taken from the sensor the buzzer will wait for 3mins to alarm..(in the unfinished program), once the tool is taken it automatically triggers the buzzer.

3) Refresh Button - if the buzzer alarmed already, the refresh button will restart the delay before it alarm again. but the tool is returned to the sensor, it will terminate the buzzer.

4) EEPROM - the setting of the user must be saved..and if the user will change the number of sensors to use..it will automatically save the setting..


Here's my schematic guys:



Here's my Codes and Proteus Simulation, so that you can see it in actual:
http://www.mediafire.com/?g53yjemjnjt

I hope you could help me guys! i would really appreciate it if someone could help me finish the program! i really need your help!
 

BMorse

Joined Sep 26, 2009
2,675
can you post your code on here? I do not really like downloading content if I do not have to..... If you need help, I would suggest posting what you have on here, and you will get more responses that way.......

My .02
 

Thread Starter

daredavel

Joined Feb 22, 2010
32
Sure thing sir!

Here's the code guys:

Rich (BB code):
    LIST    P=16F877
            #include <p16f877.inc>
            RADIX    DEC
;--------------------------------------------------------------------
;            cpu equates (memory map)

        __CONFIG   _CP_OFF & _WDT_OFF & _PWRTE_ON & _HS_OSC

#define        LED00            movlw 0                    ;1st Digit LED
#define        LED01            movlw 1                    ;2nd Digit LED
#define        LED02            movlw 3                    ;3rd Digit LED
#define        LED03            movlw 7                    ;4th Digit LED
#define        LED04            movlw 15                    ;5th Digit LED
#define        LED05            movlw 31                    ;6th Digit LED
#define        LED06            movlw 63                    ;7th Digit LED
#define        LED07            movlw 127                    ;8th Digit LED
#define        LED08            movlw 255                ;9th Digit LED
#define        LED09            movlw 1                    ;10th Digit LED
#define        LED10            movlw 3                    ;11th Digit LED
#define        LED11            movlw 7                    ;12th Digit LED
#define        LED12            movlw 15                    ;13th Digit LED

#define        LED7100            movlw 63                    ;7-Segment '0'
#define        LED7101            movlw 6                    ;7-Segment '1'
#define        LED7102            movlw 91                    ;7-Segment '2'
#define        LED7103            movlw 79                    ;7-Segment '3'
#define        LED7104            movlw 102                    ;7-Segment '4'
#define        LED7105            movlw 109                    ;7-Segment '5'
#define        LED7106            movlw 125                    ;7-Segment '6'
#define        LED7107            movlw 7                    ;7-Segment '7'
#define        LED7108            movlw 127                    ;7-Segment '8'
#define        LED7109            movlw 103                    ;7-Segment '9'

#define        LED7100D        movlw 63+128                ;7-Segment '0'
#define        LED7101D            movlw 6+128                ;7-Segment '1'
#define        LED7102D        movlw 91+128                ;7-Segment '2'
#define        LED7103D        movlw 79+128                ;7-Segment '3'
#define        LED7104D        movlw 102+128                ;7-Segment '4'
#define        LED7105D        movlw 109+128                ;7-Segment '5'
#define        LED7106D        movlw 125+128                ;7-Segment '6'
#define        LED7107D        movlw 7+128                ;7-Segment '7'
#define        LED7108D        movlw 127+128                ;7-Segment '8'
#define        LED7109D        movlw 103+128
#define        LED71Out            movwf PORTC                ;send data to PortC (1st 7-segment display)

#define        LED7200            movlw 63                    ;7-Segment '0'
#define        LED7201            movlw 6                    ;7-Segment '1'
#define        LED7202            movlw 91                    ;7-Segment '2'
#define        LED7203            movlw 79                    ;7-Segment '3'
#define        LED7204            movlw 102                    ;7-Segment '4'
#define        LED7205            movlw 109                    ;7-Segment '5'
#define        LED7206            movlw 125                    ;7-Segment '6'
#define        LED7207            movlw 7                    ;7-Segment '7'
#define        LED7208            movlw 127                    ;7-Segment '8'
#define        LED7209            movlw 103                    ;7-Segment '9'

#define        LED7200D        movlw 63+128                ;7-Segment '0'
#define        LED7201D        movlw 6+128                ;7-Segment '1'
#define        LED7202D        movlw 91+128                ;7-Segment '2'
#define        LED7203D        movlw 79+128                ;7-Segment '3'
#define        LED7204D        movlw 102+128                ;7-Segment '4'
#define        LED7205D        movlw 109+128                ;7-Segment '5'
#define        LED7206D        movlw 125+128                ;7-Segment '6'
#define        LED7207D        movlw 7+128                ;7-Segment '7'
#define        LED7208D        movlw 127+128                ;7-Segment '8'
#define        LED7209D        movlw 103+128
#define        LED72Out        movwf PORTC                ;send data to PortC (2nd 7-segment display)

#define        LEDAOut            movwf    PORTC                ;send data to PortC (LEDs 1st half)
#define        LEDBOut            movwf    PORTD                ;send data to PortD (LEDs 2nd half)
#define        LEDSeq            movlw    B'110'                ;selector for LEDs
#define        LED71Seq            movlw    b'011'                ;selector for 1st 7-segment display
#define        LED72Seq        movlw    b'101'                ;selector for 2nd 7-segment display
#define        LEDSeqOut        movwf    PORTE                ;send data to PortE (LEDs selector)
    
#define        Move_to_Storage1        movwf    STORAGE1            ;move data to COUNT1
#define        Move_to_Storage2        movwf    STORAGE2            ;move data to COUNT2
#define        Move_to_Storage3        movwf    STORAGE3            ;move data to COUNT3
#define        Move_to_Storage4        movwf    STORAGE4            ;move data to COUNT4
    
#define        Move_to_Temp1        movwf    COUNT8
#define        Move_to_Temp2        movwf    COUNT9

#define        Assign_to_Storage1        movf    STORAGE1,    W        ;assign temp data to COUNT1
#define        Assign_to_Storage2        movf    STORAGE2,    W        ;assign temp data to COUNT2
#define        Assign_to_Storage3        movf    STORAGE3,    W        ;assign temp data to COUNT3
#define        Assign_to_Storage4        movf    STORAGE4,    W        ;assign temp data to COUNT4

#define        Clear_PORTA        clrf    PORTA                ;clear PORTA
#define        Clear_PORTB        clrf    PORTB                ;clear PORTB
#define        Clear_PORTC        clrf    PORTC                ;clear PORTC
#define        Clear_PORTD        clrf    PORTD                ;clear PORTD
#define        Clear_PORTE        clrf    PORTE                ;clear PORTE

#define        Clear_COUNT        clrf    COUNT                ;clear COUNT
#define        Clear_HEXCOUNT1        clrf    HEXCOUNT1            ;clear HEXCOUNT1
#define        Clear_HEXCOUNT2        clrf    HEXCOUNT2            ;clear HEXCOUNT2
#define        Clear_BORROW        clrf    BORROW                ;clear BORROW
#define        Clear_SENSOR1        clrf    SENSOR1                ;clear SENSOR1
#define        Clear_SENSOR2        clrf    SENSOR2                ;clear SENSOR2

#define        Check_UP_Switch        call    Up_Switch
#define        Check_DOWN_Switch    call    Down_Switch
#define        Check_Refresh_Switch    call    Refresh_Switch
#define        Check_Sensor        call    Sensor
#define        Buzzer_ON        bsf    PORTA,    3
#define        Buzzer_OFF        bcf    PORTA,    3
#define        DelayRoute1        call    Delay1
#define        DelayRoute4        call    Delay4

;-----INITIALIZE PORTS-----------------
    Clear_PORTA
    Clear_PORTB
    Clear_PORTC    
    Clear_PORTD
    Clear_PORTE
    
    Clear_COUNT
    Clear_HEXCOUNT1
    Clear_HEXCOUNT2    

    bcf    STATUS, RP1
    Clear_PORTA
    bsf    STATUS, RP0
    movlw    0x06
    movwf    ADCON1
    movlw    b'000111'
    movwf    TRISA
    bcf     STATUS, RP0

    bsf    STATUS, RP0
    movlw    B'11111111'
    movwf    PORTB
    bcf     STATUS, RP0    

    bsf    STATUS, RP0
    movlw    B'00000000'
    movwf    PORTC
    bcf     STATUS, RP0

    bsf    STATUS, RP0
    movlw    B'11110000'
    movwf    PORTD
    bcf     STATUS, RP0

    bcf    STATUS, RP1
    Clear_PORTE
    bsf    STATUS, RP0
    movlw    0x06
    movwf    ADCON1    
    movlw    B'000'
    movwf    TRISE
    bcf     STATUS, RP0


;-----INITIALIZE 7 SEGMENT---------------
    call    LED70
    call    WRITE

;----MAIN PROGRAM-------------------
Repeat
    
    Check_UP_Switch                ;call    Up_Switch1
    call    LED70
    call    WRITE
    
    call    LEDS
    call    WRITE
    
    Check_DOWN_Switch            ;call    Down_Switch2
    call    LED70
    call    WRITE

    call    LEDS
    call    WRITE
        
;    Check_Refresh_Switch            ;call    Refresh_Switch
    
    Check_Sensor                ;call    Sensor
    call    LED70
    call    WRITE
    
    call    LEDS
    call    WRITE

    goto    Repeat

;-----COUNT UP SWITCH---------------
Up_Switch
    DelayRoute4                ;call    Delay4
    btfsc    PORTA, 0
    retlw    0
    
    movf    COUNT, W
    xorlw    12
    btfsc    STATUS, 2
    goto    Exit1
    incf    COUNT
Exit1
    call    Convert
    retlw    0

;-----COUNT DOWN SWITCH-------------
Down_Switch
    DelayRoute4                ;call    Delay4
    btfsc    PORTA, 1
    retlw    0
    
    movf    COUNT, W
    xorlw    0
    btfsc    STATUS, 2
    goto    Exit2
    decf    COUNT

Exit2
    call    Convert
    retlw    0

;-----Sensor-Switch----------------------------
Sensor
;------------
sensor00

CheckSensor1
    movf    COUNT, W
    xorlw    0
    btfsc    STATUS, 2
    goto    ResetSensor
    
BuzzerClear
    Clear_BORROW
    Clear_SENSOR1
    Clear_SENSOR2
    goto    sensor01

ResetSensor    
    Clear_BORROW
    Clear_SENSOR1
    Clear_SENSOR2
    Buzzer_OFF
    retlw    0
    ;-------------
sensor01
    Clear_BORROW
    Clear_SENSOR1
    Clear_SENSOR2
    
    DelayRoute4                ;call    Delay4
    btfss    PORTB, 0
    goto    sensor01a
    
    Buzzer_ON
    movlw    1
    addwf    BORROW,    F
    movlw    1
    addwf    SENSOR1,    F

sensor01a
    movf    COUNT,    W
    xorlw    1
    btfsc    STATUS,    2
    retlw    0
 

Thread Starter

daredavel

Joined Feb 22, 2010
32
Rich (BB code):
;---------------
sensor02
    DelayRoute4                ;call    Delay4
    btfss    PORTB, 1
    goto    sensor02a
    
    Buzzer_ON
    movlw    1
    addwf    BORROW,    F
    movlw    2
    addwf    SENSOR1,    F

sensor02a
    movf    COUNT,    W
    xorlw    2
    btfsc    STATUS,    2
    retlw    0

;---------------------
sensor03
    DelayRoute4                ;call    Delay4
    btfss    PORTB, 2
    goto    sensor03a
    
    Buzzer_ON
    movlw    1
    addwf    BORROW,    F
    movlw    4
    addwf    SENSOR1,    F

sensor03a
    movf    COUNT,    W
    xorlw    3
    btfsc    STATUS,    2
    retlw    0

;-------------------------
sensor04
    DelayRoute4                ;call    Delay4
    btfss    PORTB, 3
    goto    sensor04a
    
    Buzzer_ON
    movlw    1
    addwf    BORROW,    F
    movlw    8
    addwf    SENSOR1,    F

sensor04a
    movf    COUNT,    W
    xorlw    4
    btfsc    STATUS,    2
    retlw    0

;--------------------
sensor05
    DelayRoute4                ;call    Delay4
    btfss    PORTB, 4
    goto    sensor05a
    
    Buzzer_ON
    movlw    1
    addwf    BORROW,    F
    movlw    16
    addwf    SENSOR1,    F

sensor05a
    movf    COUNT,    W
    xorlw    5
    btfsc    STATUS,    2
    retlw    0

;-------------------
sensor06
    DelayRoute4                ;call    Delay4
    btfss    PORTB, 5
    goto    sensor06a
    
    Buzzer_ON
    movlw    1
    addwf    BORROW,    F
    movlw    32
    addwf    SENSOR1,    F

sensor06a
    movf    COUNT,    W
    xorlw    6
    btfsc    STATUS,    2
    retlw    0

;---------------------
sensor07
    DelayRoute4                ;call    Delay4
    btfss    PORTB, 6
    goto    sensor07a
    
    Buzzer_ON
    movlw    1
    addwf    BORROW,    F
    movlw    64
    addwf    SENSOR1,    F
    
sensor07a
    movf    COUNT,    W
    xorlw    7
    btfsc    STATUS,    2
    retlw    0

;----------------
sensor08
    DelayRoute4                ;call    Delay4
    btfss    PORTB, 7
    goto    sensor08a
    
    Buzzer_ON
    movlw    1
    addwf    BORROW,    F
    movlw    128
    addwf    SENSOR1,    F

sensor08a    
    movf    COUNT,    W
    xorlw    8
    btfsc    STATUS,    2
    retlw    0

;---------------
sensor09
    DelayRoute4                ;call    Delay4
    btfss    PORTD,    4
    goto    sensor09a

    Buzzer_ON
    movlw    1
    addwf    BORROW,    F
    movlw    1
    addwf    SENSOR2,    F

sensor09a
    movf    COUNT,    W
    xorlw    9
    btfsc    STATUS,    2
    retlw    0

;---------------
sensor10
    DelayRoute4                ;call    Delay4
    btfss    PORTD, 5
    goto    sensor10a
    
    Buzzer_ON
    movlw    1
    addwf    BORROW,    F
    movlw    2
    addwf    SENSOR2,    F

sensor10a
    movf    COUNT,    W
    xorlw    10
    btfsc    STATUS,    2
    retlw    0

;---------------
sensor11
    DelayRoute4                ;call    Delay4
    btfss    PORTD, 6
    goto    sensor11a
    
    Buzzer_ON
    movlw    1
    addwf    BORROW,    F
    movlw    4
    addwf    SENSOR2,    F

sensor11a
    movf    COUNT,    W
    xorlw    11
    btfsc    STATUS,    2
    retlw    0
;    goto    sensor12

;--------------
sensor12
    DelayRoute4                ;call    Delay4
    btfss    PORTD, 7
    goto    sensor12a
    
    Buzzer_ON
    movlw    1
    addwf    BORROW,    F
    movlw    8
    addwf    SENSOR2,    F

sensor12a
    movf    COUNT,    W
    xorlw    12
    btfsc    STATUS,    2
    retlw    0

;--------REFRESH-SWITCH-------------------------
Refresh_Switch

    retlw    0

;-------7-SEGMENT-SELECTOR-DELAY----------------
LED70
subLED70a
    movf    COUNT16,    W
    xorlw    1
    btfsc    STATUS,2
    goto    subLED70b
    goto    subLED70c
    
subLED70b
    call    LED72
    goto    subLED70A
    
subLED70c
    movf    COUNT16,    W
    xorlw    2
    btfsc    STATUS,    2
    clrf    COUNT16
    call    LED71

subLED70A
    movf    COUNT15,    W
    xorlw    1
    btfsc    STATUS,    2
    goto    subLED70B
    goto    subLED70C
    
subLED70B
    clrf    COUNT15
    incf    COUNT16,    F
    goto    subLED70a
    
subLED70C    
    movf    COUNT14,    W
    xorlw    1
    btfsc    STATUS,    2
    goto    subLED70D
    goto    subLED70E

subLED70D
    clrf    COUNT14
    incf    COUNT15,    F
    goto    subLED70A

subLED70E
    incf    COUNT13,    F
    movf    COUNT13,    W
    xorlw    100
    btfsc    STATUS,    2
    goto    subLED70F
    retlw    0

subLED70F
    clrf    COUNT13
    incf    COUNT14,    F
    goto    subLED70C
    
;-------LED BLINKER-DELAY----------------
LEDS
subLEDSa
    movf    COUNT20,    W
    xorlw    1
    btfsc    STATUS,2
    goto    subLEDSb
    goto    subLEDSc
    
subLEDSb
    call    LED2
    goto    subLEDSA
    
subLEDSc
    movf    COUNT20,    W
    xorlw    2
    btfsc    STATUS,    2
    clrf    COUNT20
    call    LED1

subLEDSA
    movf    COUNT19,    W
    xorlw    1
    btfsc    STATUS,    2
    goto    subLEDSB
    goto    subLEDSC
    
subLEDSB
    clrf    COUNT19
    incf    COUNT20,    F
    goto    subLEDSa
    
subLEDSC    
    movf    COUNT18,    W
    xorlw    1
    btfsc    STATUS,    2
    goto    subLEDSD
    goto    subLEDSE

subLEDSD
    clrf    COUNT18
    incf    COUNT19,    F
    goto    subLEDSA

subLEDSE
    incf    COUNT17,    F
    movf    COUNT17,    W
    xorlw    5
    btfsc    STATUS,    2
    goto    subLEDSF
    retlw    0

subLEDSF
    clrf    COUNT17
    incf    COUNT18,    F
    goto    subLEDSC

    
;-------7 SEGMENT DISPLAY SETTING & LEDs ---------------------------

LED71

;---00-DISPLAY---------------------
Step7100
    movf    COUNT, W
    xorlw    0
    btfsc    STATUS, 2
    goto    Step7100A
    goto    Step7101
    
Step7100A
    LED7100D                ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7200                    ;movlw    63
    Move_to_Storage2                ;movwf    COUNT2
    
    clrf    BORROW
    
    retlw    0

;---01-DISPLAY---------------------
Step7101
    movf    COUNT, W
    xorlw    1
    btfsc    STATUS, 2
    goto    Step7101A
    goto    Step7102

Step7101A
    LED7100D                ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7201                    ;movlw    6
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0
    
;---02-DISPLAY---------------------
Step7102
    movf    COUNT, W
    xorlw    2
    btfsc    STATUS, 2
    goto    Step7102A
    goto    Step7103

Step7102A
    LED7100D                ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7202                    ;movlw    91
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0

;---03-DISPLAY---------------------
Step7103

    movf    COUNT, W
    xorlw    3
    btfsc    STATUS, 2
    goto    Step7103A
    goto    Step7104

Step7103A
    LED7100D                ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7203                    ;movlw    79
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0

;---04-DISPLAY---------------------
Step7104
    movf    COUNT, W
    xorlw    4
    btfsc    STATUS, 2
    goto    Step7104A
    goto    Step7105

Step7104A
    LED7100D                ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7204                    ;movlw    102
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0

;---05-DISPLAY---------------------
Step7105
    movf    COUNT, W
    xorlw    5
    btfsc    STATUS, 2
    goto    Step7105A
    goto    Step7106
    
Step7105A
    LED7100D                ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7205                    ;movlw    109
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0

;---06-DISPLAY---------------------
Step7106
    movf    COUNT, W
    xorlw    6
    btfsc    STATUS, 2
    goto    Step7106A
    goto    Step7107
    
Step7106A
    LED7100D                ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7206                    ;movlw    125
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0

;---07-DISPLAY---------------------
Step7107
    movf    COUNT, W
    xorlw    7
    btfsc    STATUS, 2
    goto    Step7107A
    goto    Step7108
    
Step7107A
    LED7100D                ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7207                    ;movlw    7
    Move_to_Storage2                ;movwf    COUNT2
    
    retlw    0

;---08-DISPLAY---------------------
Step7108
    movf    COUNT, W
    xorlw    8
    btfsc    STATUS, 2
    goto    Step7108A
    goto    Step7109
    
Step7108A
    LED7100D                ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7208                    ;movlw    127
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0

;---09-DISPLAY---------------------
Step7109
    movf    COUNT, W
    xorlw    9
    btfsc    STATUS, 2
    goto    Step7109A
    goto    Step7110
    
Step7109A
    LED7100D                ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7209                    ;movlw    103
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0

;---10-DISPLAY---------------------
Step7110
    movf    COUNT, W
    xorlw    10
    btfsc    STATUS, 2
    goto    Step7110A
    goto    Step7111
    
Step7110A
    LED7101D                    ;movlw    6
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7200                    ;movlw    63
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0

;---11-DISPLAY---------------------
Step7111
    movf    COUNT, W
    xorlw    11
    btfsc    STATUS, 2
    goto    Step7111A
    goto    Step7112
 

Thread Starter

daredavel

Joined Feb 22, 2010
32
Rich (BB code):
Step7111A
    LED7101D                    ;movlw    6
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7201                    ;movlw    6
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0
    
;---12-DISPLAY---------------------
Step7112
    movf    COUNT, W
    xorlw    12
    btfsc    STATUS, 2
    goto    Step7112A
    retlw    0
    
Step7112A
    LED7101D                    ;movlw    6
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7202                    ;movlw    91
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0

;-------7 SEGMENT DISPLAY PARTS MISSING & LEDs---------------------------
LED72

;---00-DISPLAY---------------------
Step7200
    ;movf    COUNT, W
    movf    BORROW,    W
    xorlw    0
    btfsc    STATUS, 2
    goto    Step7200A
    goto    Step7201
    
Step7200A
    LED7100                    ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7200D                ;movlw    63
    Move_to_Storage2                ;movwf    COUNT2

    clrf    BORROW
    
    retlw    0

;---01-DISPLAY---------------------
Step7201
    ;movf    COUNT, W
    movf    BORROW,    W
    xorlw    1
    btfsc    STATUS, 2
    goto    Step7201A
    goto    Step7202

Step7201A
    LED7100                    ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7201D                ;movlw    6
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0
    
Step7201B
    LED7100                    ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7201D                ;movlw    6
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0

;---02-DISPLAY---------------------
Step7202
    ;movf    COUNT, W
    movf    BORROW,    W
    xorlw    2
    btfsc    STATUS, 2
    goto    Step7202A
    goto    Step7203

Step7202A
    LED7100                    ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7202D                ;movlw    91
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0
    
Step7202B
    LED7100                    ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7202D                ;movlw    91
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0

;---03-DISPLAY---------------------
Step7203
    ;movf    COUNT, W
    movf    BORROW,    W
    xorlw    3
    btfsc    STATUS, 2
    goto    Step7203A
    goto    Step7204

Step7203A
    LED7100                    ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7203D                ;movlw    79
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0

Step7203B
    LED7100                    ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7203D                ;movlw    79
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0

;---04-DISPLAY---------------------
Step7204
    ;movf    COUNT, W
    movf    BORROW,    W
    xorlw    4
    btfsc    STATUS, 2
    goto    Step7204A
    goto    Step7205

Step7204A
    LED7100                    ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7204D                ;movlw    102
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0

Step7204B
    LED7100                    ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
        
    LED7204D                ;movlw    102
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0
        
;---05-DISPLAY---------------------
Step7205
    ;movf    COUNT, W
    movf    BORROW,    W
    xorlw    5
    btfsc    STATUS, 2
    goto    Step7205A
    goto    Step7206
    
Step7205A
    LED7100                    ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1

    LED7205D                ;movlw    109
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0

Step7205B
    LED7100                    ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7205D                ;movlw    109
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0
    
;---06-DISPLAY---------------------
Step7206
    ;movf    COUNT, W
    movf    BORROW,    W
    xorlw    6
    btfsc    STATUS, 2
    goto    Step7206A
    goto    Step7207
    
Step7206A
    LED7100                    ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7206D                ;movlw    125
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0

Step7206B
    LED7100                    ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7206D                ;movlw    125
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0
    
;---07-DISPLAY---------------------
Step7207
    ;movf    COUNT, W
    movf    BORROW,    W
    xorlw    7
    btfsc    STATUS, 2
    goto    Step7207A
    goto    Step7208
    
Step7207A
    LED7100                    ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7207D                ;movlw    7
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0

Step7207B
    LED7100                    ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7207D                ;movlw    7
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0
    
;---08-DISPLAY---------------------
Step7208
    ;movf    COUNT, W
    movf    BORROW,    W
    xorlw    8
    btfsc    STATUS, 2
    goto    Step7208A
    goto    Step7209
    
Step7208A
    LED7100                    ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7208D                ;movlw    127
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0

Step7208B
    LED7100                    ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7208D                ;movlw    127
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0

;---09-DISPLAY---------------------
Step7209
    ;movf    COUNT, W
    movf    BORROW,    W
    xorlw    9
    btfsc    STATUS, 2
    goto    Step7209A
    goto    Step7210
    
Step7209A
    LED7100                    ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
        
    LED7209D                ;movlw    103
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0

Step7209B
    LED7100                    ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7209D                ;movlw    103
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0

;---10-DISPLAY---------------------
Step7210
    ;movf    COUNT, W
    movf    BORROW,    W
    xorlw    10
    btfsc    STATUS, 2
    goto    Step7210A
    goto    Step7211
    
Step7210A
    LED7101                    ;movlw    6
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7200D                ;movlw    63
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0
    
Step7210B
    LED7101                    ;movlw    6
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7200D                ;movlw    63
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0

;---11-DISPLAY---------------------
Step7211
    ;movf    COUNT, W
    movf    BORROW,    W
    xorlw    11
    btfsc    STATUS, 2
    goto    Step7211A
    goto    Step7212
    
Step7211A
    LED7101                    ;movlw    6
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7201D                ;movlw    6
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0
    
Step7211B
    LED7101                    ;movlw    6
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7201D                ;movlw    6
    Move_to_Storage2                ;movwf    COUNT2
    
    retlw    0
    
;---12-DISPLAY---------------------
Step7212
    ;movf    COUNT, W
    movf    BORROW,    W
    xorlw    12
    btfsc    STATUS, 2
    goto    Step7212A
    retlw    0
    
Step7212A
    LED7101                    ;movlw    6
    Move_to_Storage1                ;movwf    COUNT1
            
    LED7202D                ;movlw    91
    Move_to_Storage2                ;movwf    COUNT2
    
    retlw    0

Step7212B
    LED7101                    ;movlw    6
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7202D                ;movlw    91
    Move_to_Storage2                ;movwf    COUNT2
    
    retlw    0

;-------LEDs ---------------------------

LED1

    movf    HEXCOUNT1,    W
    Move_to_Storage3
    
    movf    HEXCOUNT2,    W
    Move_to_Storage4

    retlw    0

;-----------
LED2

    movf    SENSOR1,    W
    subwf    HEXCOUNT1,    W
    Move_to_Storage3
    
    movf    SENSOR2,    W
    subwf    HEXCOUNT2,    W
    Move_to_Storage4

    retlw    0

;----COUNT CONVERSION----------------
Convert
    clrf    HEXCOUNT1
    clrf    HEXCOUNT2

    movf    COUNT,    W
    xorlw    0
    btfsc    STATUS,    2
    goto    Convert0
    goto    Next1

Convert0
    movlw    0
    movwf    HEXCOUNT1

    movlw    0
    movwf    HEXCOUNT2
    retlw    0

;----------------
Next1
    movf    COUNT,    W
    xorlw    1
    btfsc    STATUS,    2
    goto    Convert1
    goto    Next2

Convert1
    movlw    1
    movwf    HEXCOUNT1

    movlw    0
    movwf    HEXCOUNT2
    retlw    0
 

Thread Starter

daredavel

Joined Feb 22, 2010
32
Rich (BB code):
Step7111A
    LED7101D                    ;movlw    6
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7201                    ;movlw    6
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0
    
;---12-DISPLAY---------------------
Step7112
    movf    COUNT, W
    xorlw    12
    btfsc    STATUS, 2
    goto    Step7112A
    retlw    0
    
Step7112A
    LED7101D                    ;movlw    6
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7202                    ;movlw    91
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0

;-------7 SEGMENT DISPLAY PARTS MISSING & LEDs---------------------------
LED72

;---00-DISPLAY---------------------
Step7200
    ;movf    COUNT, W
    movf    BORROW,    W
    xorlw    0
    btfsc    STATUS, 2
    goto    Step7200A
    goto    Step7201
    
Step7200A
    LED7100                    ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7200D                ;movlw    63
    Move_to_Storage2                ;movwf    COUNT2

    clrf    BORROW
    
    retlw    0

;---01-DISPLAY---------------------
Step7201
    ;movf    COUNT, W
    movf    BORROW,    W
    xorlw    1
    btfsc    STATUS, 2
    goto    Step7201A
    goto    Step7202

Step7201A
    LED7100                    ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7201D                ;movlw    6
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0
    
Step7201B
    LED7100                    ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7201D                ;movlw    6
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0

;---02-DISPLAY---------------------
Step7202
    ;movf    COUNT, W
    movf    BORROW,    W
    xorlw    2
    btfsc    STATUS, 2
    goto    Step7202A
    goto    Step7203

Step7202A
    LED7100                    ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7202D                ;movlw    91
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0
    
Step7202B
    LED7100                    ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7202D                ;movlw    91
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0

;---03-DISPLAY---------------------
Step7203
    ;movf    COUNT, W
    movf    BORROW,    W
    xorlw    3
    btfsc    STATUS, 2
    goto    Step7203A
    goto    Step7204

Step7203A
    LED7100                    ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7203D                ;movlw    79
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0

Step7203B
    LED7100                    ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7203D                ;movlw    79
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0

;---04-DISPLAY---------------------
Step7204
    ;movf    COUNT, W
    movf    BORROW,    W
    xorlw    4
    btfsc    STATUS, 2
    goto    Step7204A
    goto    Step7205

Step7204A
    LED7100                    ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7204D                ;movlw    102
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0

Step7204B
    LED7100                    ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
        
    LED7204D                ;movlw    102
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0
        
;---05-DISPLAY---------------------
Step7205
    ;movf    COUNT, W
    movf    BORROW,    W
    xorlw    5
    btfsc    STATUS, 2
    goto    Step7205A
    goto    Step7206
    
Step7205A
    LED7100                    ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1

    LED7205D                ;movlw    109
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0

Step7205B
    LED7100                    ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7205D                ;movlw    109
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0
    
;---06-DISPLAY---------------------
Step7206
    ;movf    COUNT, W
    movf    BORROW,    W
    xorlw    6
    btfsc    STATUS, 2
    goto    Step7206A
    goto    Step7207
    
Step7206A
    LED7100                    ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7206D                ;movlw    125
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0

Step7206B
    LED7100                    ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7206D                ;movlw    125
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0
    
;---07-DISPLAY---------------------
Step7207
    ;movf    COUNT, W
    movf    BORROW,    W
    xorlw    7
    btfsc    STATUS, 2
    goto    Step7207A
    goto    Step7208
    
Step7207A
    LED7100                    ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7207D                ;movlw    7
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0

Step7207B
    LED7100                    ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7207D                ;movlw    7
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0
    
;---08-DISPLAY---------------------
Step7208
    ;movf    COUNT, W
    movf    BORROW,    W
    xorlw    8
    btfsc    STATUS, 2
    goto    Step7208A
    goto    Step7209
    
Step7208A
    LED7100                    ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7208D                ;movlw    127
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0

Step7208B
    LED7100                    ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7208D                ;movlw    127
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0

;---09-DISPLAY---------------------
Step7209
    ;movf    COUNT, W
    movf    BORROW,    W
    xorlw    9
    btfsc    STATUS, 2
    goto    Step7209A
    goto    Step7210
    
Step7209A
    LED7100                    ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
        
    LED7209D                ;movlw    103
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0

Step7209B
    LED7100                    ;movlw    63
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7209D                ;movlw    103
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0

;---10-DISPLAY---------------------
Step7210
    ;movf    COUNT, W
    movf    BORROW,    W
    xorlw    10
    btfsc    STATUS, 2
    goto    Step7210A
    goto    Step7211
    
Step7210A
    LED7101                    ;movlw    6
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7200D                ;movlw    63
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0
    
Step7210B
    LED7101                    ;movlw    6
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7200D                ;movlw    63
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0

;---11-DISPLAY---------------------
Step7211
    ;movf    COUNT, W
    movf    BORROW,    W
    xorlw    11
    btfsc    STATUS, 2
    goto    Step7211A
    goto    Step7212
    
Step7211A
    LED7101                    ;movlw    6
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7201D                ;movlw    6
    Move_to_Storage2                ;movwf    COUNT2

    retlw    0
    
Step7211B
    LED7101                    ;movlw    6
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7201D                ;movlw    6
    Move_to_Storage2                ;movwf    COUNT2
    
    retlw    0
    
;---12-DISPLAY---------------------
Step7212
    ;movf    COUNT, W
    movf    BORROW,    W
    xorlw    12
    btfsc    STATUS, 2
    goto    Step7212A
    retlw    0
    
Step7212A
    LED7101                    ;movlw    6
    Move_to_Storage1                ;movwf    COUNT1
            
    LED7202D                ;movlw    91
    Move_to_Storage2                ;movwf    COUNT2
    
    retlw    0

Step7212B
    LED7101                    ;movlw    6
    Move_to_Storage1                ;movwf    COUNT1
    
    LED7202D                ;movlw    91
    Move_to_Storage2                ;movwf    COUNT2
    
    retlw    0

;-------LEDs ---------------------------

LED1

    movf    HEXCOUNT1,    W
    Move_to_Storage3
    
    movf    HEXCOUNT2,    W
    Move_to_Storage4

    retlw    0

;-----------
LED2

    movf    SENSOR1,    W
    subwf    HEXCOUNT1,    W
    Move_to_Storage3
    
    movf    SENSOR2,    W
    subwf    HEXCOUNT2,    W
    Move_to_Storage4

    retlw    0

;----COUNT CONVERSION----------------
Convert
    clrf    HEXCOUNT1
    clrf    HEXCOUNT2

    movf    COUNT,    W
    xorlw    0
    btfsc    STATUS,    2
    goto    Convert0
    goto    Next1

Convert0
    movlw    0
    movwf    HEXCOUNT1

    movlw    0
    movwf    HEXCOUNT2
    retlw    0

;----------------
Next1
    movf    COUNT,    W
    xorlw    1
    btfsc    STATUS,    2
    goto    Convert1
    goto    Next2

Convert1
    movlw    1
    movwf    HEXCOUNT1

    movlw    0
    movwf    HEXCOUNT2
    retlw    0

;-----------------
Next2
    movf    COUNT,    W
    xorlw    2
    btfsc    STATUS,    2
    goto    Convert2
    goto    Next3

Convert2
    movlw    3
    movwf    HEXCOUNT1

    movlw    0
    movwf    HEXCOUNT2
    retlw    0

;------
Next3
    movf    COUNT,    W
    xorlw    3
    btfsc    STATUS,    2
    goto    Convert3
    goto    Next4

Convert3
    movlw    7
    movwf    HEXCOUNT1

    movlw    0
    movwf    HEXCOUNT2
    retlw    0
 

Thread Starter

daredavel

Joined Feb 22, 2010
32
Rich (BB code):
;-----------------
Next2
    movf    COUNT,    W
    xorlw    2
    btfsc    STATUS,    2
    goto    Convert2
    goto    Next3

Convert2
    movlw    3
    movwf    HEXCOUNT1

    movlw    0
    movwf    HEXCOUNT2
    retlw    0
;------
Next3
    movf    COUNT,    W
    xorlw    3
    btfsc    STATUS,    2
    goto    Convert3
    goto    Next4

Convert3
    movlw    7
    movwf    HEXCOUNT1

    movlw    0
    movwf    HEXCOUNT2
    retlw    0
;-----------------
Next4
    movf    COUNT,    W
    xorlw    4
    btfsc    STATUS,    2
    goto    Convert4
    goto    Next5

Convert4
    movlw    15
    movwf    HEXCOUNT1

    movlw    0
    movwf    HEXCOUNT2
    retlw    0
;---------------------
Next5
    movf    COUNT,    W
    xorlw    5
    btfsc    STATUS,    2
    goto    Convert5
    goto    Next6

Convert5
    movlw    31
    movwf    HEXCOUNT1

    movlw    0
    movwf    HEXCOUNT2
    retlw    0
;----------------------
Next6
    movf    COUNT,    W
    xorlw    6
    btfsc    STATUS,    2
    goto    Convert6
    goto    Next7

Convert6
    movlw    63
    movwf    HEXCOUNT1

    movlw    0
    movwf    HEXCOUNT2
    retlw    0
;----------------------
Next7
    movf    COUNT,    W
    xorlw    7
    btfsc    STATUS,    2
    goto    Convert7
    goto    Next8

Convert7
    movlw    127
    movwf    HEXCOUNT1

    movlw    0
    movwf    HEXCOUNT2
    retlw    0
;-----------------------
Next8
    movf    COUNT,    W
    xorlw    8
    btfsc    STATUS,    2
    goto    Convert8
    goto    Next9

Convert8
    movlw    255
    movwf    HEXCOUNT1

    movlw    0
    movwf    HEXCOUNT2
    retlw    0
;------------------
Next9
    movf    COUNT,    W
    xorlw    9
    btfsc    STATUS,    2
    goto    Convert9
    goto    Next10

Convert9
    movlw    255
    movwf    HEXCOUNT1

    movlw    1
    movwf    HEXCOUNT2
    retlw    0
;----------------------------------
Next10
    movf    COUNT,    W
    xorlw    10
    btfsc    STATUS,    2
    goto    Convert10
    goto    Next11

Convert10
    movlw    255
    movwf    HEXCOUNT1

    movlw    3
    movwf    HEXCOUNT2
    retlw    0
;--------------------
Next11
    movf    COUNT,    W
    xorlw    11
    btfsc    STATUS,    2
    goto    Convert11
    goto    Next12

Convert11
    movlw    255
    movwf    HEXCOUNT1

    movlw    7
    movwf    HEXCOUNT2
    retlw    0
;--------------------
Next12
    movf    COUNT,    W
    xorlw    12
    btfsc    STATUS,    2
    goto    Convert12
    retlw    0

Convert12
    movlw    255
    movwf    HEXCOUNT1

    movlw    15
    movwf    HEXCOUNT2
    retlw    0


;-----OUTPUT-DATA-TO-7-SEGMENT DISPLAY----------------------------------------
WRITE
    Clear_PORTC
    LED71Seq
    LEDSeqOut
    Assign_to_Storage1            ;    movf    COUNT1, W
    LED71Out
    DelayRoute1            ;    call    Delay1
    
    Clear_PORTC
    LED72Seq
    LEDSeqOut
    Assign_to_Storage2            ;    movf    COUNT2,    W
    LED72Out
    DelayRoute1            ;    call    Delay1
    
    Clear_PORTC
    Clear_PORTD
    LEDSeq
    LEDSeqOut
    Assign_to_Storage3            ;    movf    COUNT3,    W
    LEDAOut
    DelayRoute1            ;    call    Delay1

    Clear_PORTC
    Clear_PORTD
    LEDSeq
    LEDSeqOut
    Assign_to_Storage4            ;    movf    COUNT4,    W
    LEDBOut
    DelayRoute1            ;    call    Delay1

    retlw    0

;-------DELAY1------------------------------------------------------------------------------------
Delay1    

    movlw    1
    movwf    COUNT10
    
Delay2    
    movlw    15
    movwf    COUNT11

Delay3
    movlw    255
    movwf    COUNT12

DelX    
    decfsz    COUNT12, F
    goto    DelX

    decfsz    COUNT11, F
    goto    Delay3

    decfsz    COUNT10, F
    goto    Delay2

    retlw    00

;------DELAY4---------------------------------------------------------------------------------------
Delay4
    movlw    1
    movwf    COUNT5
    
Delay5    
    movlw    30
    movwf    COUNT6
Delay6
    movlw    255
    movwf    COUNT7

DelX2    
    decfsz    COUNT7, F
    goto    DelX2

    decfsz    COUNT6, F
    goto    Delay6

    decfsz    COUNT5, F
    goto    Delay5

    retlw    00
;-----------------------------------------------------------------------------------

        END                     ; directive 'end of program'

;-----------------------------------------------------------------------------
There you go guys..pls do help me guys! i really need all of your help!
 
Top