dhruv101
Newbie level 3
connecting ic on the breadboard
Hello all,
I am trying to test my PIC16F676 on a breadboard. I have written a simple program that sets the port RA1 as high . I tried connecting the IC to the breadboard and connecting the VCC and ground to the supply, However I did not get an output.
My code:
;**********************************************************************
list p=16f676 ; list directive to define processor
#include <p16F676.inc> ; processor specific variable definitions
errorlevel -302 ; suppress message 302 from list file
__CONFIG _CP_OFF & _CPD_OFF & _BODEN_OFF & _MCLRE_OFF & _WDT_OFF & _PWRTE_ON & _INTRC_OSC_NOCLKOUT
; '__CONFIG' directive is used to embed configuration word within .asm file.
; The lables following the directive are located in the respective .inc file.
; See data sheet for additional information on configuration word settings.
;------------DEFINES
#define D0On B'00000010'
#define D0_1Tris B'00001000'
#define SWITCH PORTA,3
;***** VARIABLE DEFINITIONS
w_temp EQU 0x20 ; variable used for context saving
status_temp EQU 0x21 ; variable used for context saving
cblock 0x20
Flags ; LED flags
CountH ; debounce counter - MS Byte
CountL ; debounce counter - LS Byte
endc
;**********************************************************************
ORG 0x000 ; processor reset vector
goto main ; go to beginning of program
ORG 0x004 ; interrupt vector location
movwf w_temp ; save off current W register contents
movf STATUS,w ; move status register into W register
movwf status_temp ; save off contents of STATUS register
; isr code can go here or be located as a call subroutine elsewhere
movf status_temp,w ; retrieve copy of STATUS register
movwf STATUS ; restore pre-isr STATUS register contents
swapf w_temp,f
swapf w_temp,w ; restore pre-isr W register contents
retfie ; return from interrupt
; these first 4 instructions are not required if the internal oscillator is not used
main
call 0x3FF ; retrieve factory calibration value
bsf STATUS,RP0 ; set file register bank to 1
movwf OSCCAL ; update register with factory cal value
movlw D0_1Tris ; set direction so LEDs D0 - D7 are outputs
movwf TRISA ; all others are inputs (high-z)
clrf ANSEL ; config A/D IO as Digital
movlw 00h
movwf TRISA
bcf STATUS,RP0 ; set file register bank to 0
; remaining code goes here
clrf PORTA
movlw 07h
movwf CMCON
movlw D0On ;set port RA1 high
movwf PORTA ; send data to PORTA port
;movlw 08h
;movwf PORTA
goto main
nop
nop
; initialize eeprom locations
ORG 0x2100
DE 0x00, 0x01, 0x02, 0x03
END ; directive 'end of program'
===============================================================
What kind of supporting circuitry will I require?
Thanks,
Dhruv
Hello all,
I am trying to test my PIC16F676 on a breadboard. I have written a simple program that sets the port RA1 as high . I tried connecting the IC to the breadboard and connecting the VCC and ground to the supply, However I did not get an output.
My code:
;**********************************************************************
list p=16f676 ; list directive to define processor
#include <p16F676.inc> ; processor specific variable definitions
errorlevel -302 ; suppress message 302 from list file
__CONFIG _CP_OFF & _CPD_OFF & _BODEN_OFF & _MCLRE_OFF & _WDT_OFF & _PWRTE_ON & _INTRC_OSC_NOCLKOUT
; '__CONFIG' directive is used to embed configuration word within .asm file.
; The lables following the directive are located in the respective .inc file.
; See data sheet for additional information on configuration word settings.
;------------DEFINES
#define D0On B'00000010'
#define D0_1Tris B'00001000'
#define SWITCH PORTA,3
;***** VARIABLE DEFINITIONS
w_temp EQU 0x20 ; variable used for context saving
status_temp EQU 0x21 ; variable used for context saving
cblock 0x20
Flags ; LED flags
CountH ; debounce counter - MS Byte
CountL ; debounce counter - LS Byte
endc
;**********************************************************************
ORG 0x000 ; processor reset vector
goto main ; go to beginning of program
ORG 0x004 ; interrupt vector location
movwf w_temp ; save off current W register contents
movf STATUS,w ; move status register into W register
movwf status_temp ; save off contents of STATUS register
; isr code can go here or be located as a call subroutine elsewhere
movf status_temp,w ; retrieve copy of STATUS register
movwf STATUS ; restore pre-isr STATUS register contents
swapf w_temp,f
swapf w_temp,w ; restore pre-isr W register contents
retfie ; return from interrupt
; these first 4 instructions are not required if the internal oscillator is not used
main
call 0x3FF ; retrieve factory calibration value
bsf STATUS,RP0 ; set file register bank to 1
movwf OSCCAL ; update register with factory cal value
movlw D0_1Tris ; set direction so LEDs D0 - D7 are outputs
movwf TRISA ; all others are inputs (high-z)
clrf ANSEL ; config A/D IO as Digital
movlw 00h
movwf TRISA
bcf STATUS,RP0 ; set file register bank to 0
; remaining code goes here
clrf PORTA
movlw 07h
movwf CMCON
movlw D0On ;set port RA1 high
movwf PORTA ; send data to PORTA port
;movlw 08h
;movwf PORTA
goto main
nop
nop
; initialize eeprom locations
ORG 0x2100
DE 0x00, 0x01, 0x02, 0x03
END ; directive 'end of program'
===============================================================
What kind of supporting circuitry will I require?
Thanks,
Dhruv