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.

Heat element control with pic16f84a

Status
Not open for further replies.

pasicr

Advanced Member level 1
Joined
Aug 13, 2005
Messages
440
Helped
39
Reputation
80
Reaction score
29
Trophy points
1,308
Location
Macedonia
Activity points
4,213
Hi, I use countdown timer (4 digit) with pic16f84a for control heat element ( on heat element I put 220V AC via reley until timer coundown), but I have one problem. Everiting is fine when timer show 0000 after that heat element is off. When I press start timer button again on display show predefined time and Problem is heating element is ON when timer stop and show start number. May be is not clear explanation.
code for control reley is
ALARM
FINALWAIT BSF PORTB,RB4 ; set up reley ON
MOVLW 2 ; delay 2 milliseconds
CALL NMSEC
MOVLW 2 ; another 2 msec delay
CALL NMSEC
BTFSC PORTB,START_PB ; start button pressed
GOTO FINALWAIT ; not yet
CALL DLY20 ; debounce just to make sure
BTFSC PORTB,START_PB ; second look
GOTO FINALWAIT ; nah, keep waiting
BCF PORTB,RB4 ; set reley OFF THIS COMMAND NOT WORK
CALL WAITSTARTUP ; now wait for the switch up
GOTO EE2D ; start all over againSOUNDALARM

Please Help me some body, I send all code
regards
 

The problem is while updating the display it's writing to RB4
Code:
INTERRUPT   MOVWF W_TEMP               ; save W
            SWAPF STATUS,W             ; save status
            MOVWF STATUS_TEMP          ; without changing flags
            INCF DIGCTR,f              ; next digit #
            MOVF DIGCTR,W              ; get it into W
            ANDLW H'03'                ; mask off 2 lowest bits
            MOVWF DIGIT                ; save it for later
            ADDLW H'0C'                ; point at register to display
            MOVWF FSR                  ; use as pointer
            MOVF INDF,W                ; get value of reg pointed to into W
            MOVWF PORTA                ; output to CD4511
            MOVF DIGIT,W               ; recall digit #
            CALL BITPAT                ; get bit pattern
 ------->  MOVWF PORTB                ; select transistor
            DECFSZ INTCNT,f            ; finished 1 sec ?
            GOTO RESTORE               ; not yet, return and enable inter.
            CALL EVERYSEC              ; go to every second routine

try to "AND" with original RB4,RB5 and move to port B
 

Please it is possible do this for me in the code I am new in pic,
regards
 

Re: for 16f676

Hi,
Did you mean: Use "and" command to send some to portb, rb4 after display init in routine,
regards
 

Before :

MOVF DIGIT,W ; Load digit number to lit in W
CALL BITPAT ; Get bit pattern from table
MOVWF PORTB ; write to PORTB

As you can see bits b4 & b5 are always written to PORTB as 0.

After :

MOVF PORTB,W ; Read PORTB
MOVWF TEMP ; Store result in TEMP register
MOVF DIGIT,W ; Load digit number to lit in W
CALL BITPAT ; Get bit pattern from table
XORWF TEMP,W ; Do exclusive OR with register TEMP
MOVWF PORTB ; Write result to PORTB

So bits b4 & b5 are written back to PORTB in their original state.

CD :)
 

    pasicr

    Points: 2
    Helpful Answer Positive Rating
Hi, after implementation you'r sugestion timer not countdown and display show only 0000,
regards
 

Modified code is here.
 

    pasicr

    Points: 2
    Helpful Answer Positive Rating
Hi 16f676,
Thanks for you'r speedy answer. I try modified code AND HE WORK FINE.
Everiting is OK, heat element work untill coundown.
Again THANKS A LOT, for you'r spend time,
Best regards
 

pasicr said:
Hi, I use countdown timer (4 digit) with pic16f84a for control heat element ( on heat element I put 220V AC via reley until timer coundown), but I have one problem. Everiting is fine when timer show 0000 after that heat element is off. When I press start timer button again on display show predefined time and Problem is heating element is ON when timer stop and show start number. May be is not clear explanation.
code for control reley is
ALARM
FINALWAIT BSF PORTB,RB4 ; set up reley ON
MOVLW 2 ; delay 2 milliseconds
CALL NMSEC
MOVLW 2 ; another 2 msec delay
CALL NMSEC
BTFSC PORTB,START_PB ; start button pressed
GOTO FINALWAIT ; not yet
CALL DLY20 ; debounce just to make sure
BTFSC PORTB,START_PB ; second look
GOTO FINALWAIT ; nah, keep waiting
BCF PORTB,RB4 ; set reley OFF THIS COMMAND NOT WORK
CALL WAITSTARTUP ; now wait for the switch up
GOTO EE2D ; start all over againSOUNDALARM

Please Help me some body, I send all code
regards

PL PROVED HARDWAER
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top