Hello.
Enclosed code is one simple example from Bate's book "Interfacing Pic microcontroller".
The codes run properly in Proteus VMS, but not on EasyPic V7 board (to start and stop blinking I use RB1 and 2 buttons in pull up setting). Only RD6 and RD3 are lighted up constantly, but no light sequence like in the simulation.
I had same problems (not running on easypicv7) for other codes with this 16F877A.
I don't know if it is a problem of configuration or so (I remember in the past that to make 16F628A I had to pull down RB4, for instance...).
I don't know if something similar is needed here...
Thank you for any kind suggestion/advise.
Bye
Mod edit: posted code and schematic from .zip
Enclosed code is one simple example from Bate's book "Interfacing Pic microcontroller".
The codes run properly in Proteus VMS, but not on EasyPic V7 board (to start and stop blinking I use RB1 and 2 buttons in pull up setting). Only RD6 and RD3 are lighted up constantly, but no light sequence like in the simulation.
I had same problems (not running on easypicv7) for other codes with this 16F877A.
I don't know if it is a problem of configuration or so (I remember in the past that to make 16F628A I had to pull down RB4, for instance...).
I don't know if something similar is needed here...
Thank you for any kind suggestion/advise.
Bye
Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Source File: LED2.ASM
; Author: MPB
; Date: 2-1-13
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Slow output binary count is stopped, started
; and reset with push buttons.
;
; Processor: PIC 16F877A
;
; Hardware: Prototype
; Clock: RC = 40kHz
; Inputs: Port B: Push Buttons
; RB1, RB2 (active low)
; Outputs: Port D: LEDs (active high)
;
; WDTimer: Disabled
; PUTimer: Enabled
; Interrupts: Disabled
; Code Protect: Disabled
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PROCESSOR 16F877 ; Define MCU type
__CONFIG 0x3733 ; Set config fuses
; Register Label Equates....................................
PORTB EQU 06 ; Port B Data Register
PORTD EQU 08 ; Port D Data Register
TRISD EQU 88 ; Port B Direction Register
Timer EQU 20 ; GPR used as delay counter
; Input Bit Label Equates ..................................
Inres EQU 1 ; 'Reset' input button = RD0
Inrun EQU 2 ; 'Run' input button = RD1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
CODE 0 ; Program code start address
; Initialise Port B (Port A defaults to inputs).............
BANKSEL TRISD ; Select bank 1
MOVLW b'00000000' ; Port B Direction Code
MOVWF TRISD ; Load the DDR code into F86
BANKSEL PORTD ; Select bank 0
GOTO reset ; Jump to main loop
; 'delay' subroutine ........................................
delay:
MOVWF Timer ; Copy W to timer register
down:
DECFSZ Timer ; Decrement timer register
GOTO down ; and repeat until zero
RETURN ; Jump back to main program
; Start main loop ...........................................
reset:
CLRF PORTD ; Clear Port B Data
start:
BTFSS PORTB,Inres ; Test reset button
GOTO reset ; and reset Port B if pressed
BTFSC PORTB,Inrun ; Test run button
GOTO start ; and repeat if n pressed
INCF PORTD ; Increment output at Port B
MOVLW 0FF ; Delay count literal
CALL delay ; Jump to subroutine 'delay'
GOTO start ; Repeat main loop always
END ; Terminate source code
Attachments
-
82.5 KB Views: 5
-
523.6 KB Views: 1
-
2.6 KB Views: 0
Last edited by a moderator: