Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
LIST p=16F676 ;tell assembler what chip we are using
include "P16F676.inc" ;include the defaults for the chip
__config 0x3D14 ;sets the configuration settings (oscillator type etc.)
; HERE SET TO INTERNAL OSCILLATOR 4MHZ
ORG 0
GOTO INIT
INIT
BSF STATUS,RP0
MOVLW 0x5
MOVWF CMCON
MOVLW 0x0
MOVWF ANSEL ; disable ADC
MOVWF TRISC ; portb as output
MOVLW 0x3f
MOVWF TRISA ; porta as input
BCF STATUS,RP0
START
btfss PORTA,1 ; test bit 1
call delay
GOTO START
delay
movlw 0xff
movwf PORTC
movlw 0fh
movwf 0x21
dECfsz 0x21,f
clrf PORTC
RETURN
end
I have loaded you code into MPLAB..... It doesn't compile
__config 0x3D14 ;sets the configuration settings (oscillator type etc.)
; HERE SET TO INTERNAL OSCILLATOR 4MHZ
I thought you had Proteus... You can compile directly in ISIS. run and simulate..
It's $465 for Proteus ISIS I would stick with Oshonsoft
Hi,
I was testing these code in OSHON but this instruction shows an error and the above initialization(list,include) were removed ...
MOVWF ANSEL
is there any method to test PIC16f676 as OSHON does not support 676 (i think)
hi Ritesh,
Oshonsoft does support F676
Post your FULL code..
E.
In your program PORTA 0 & 1 are set for ADC input.!
You are testing BTFSS PORTA,1 ; its set for analog inp
Sorry, i don't get you?The PORT pins on PORTC do toggle ON/OFF but are VERY fast, you need a longer On/OFF time.
LIST p=16F676 ;tell assembler what chip we are using
include "P16F676.inc" ;include the defaults for the chip
__config 0x3D14 ;sets the configuration settings (oscillator type etc.)
errorlevel -302, -207
CounterA equ 0x20
CounterB equ 0x21
CounterC equ 0x22
CounterD equ 0x23
; HERE SET TO INTERNAL OSCILLATOR 4MHZ
ORG 0
GOTO INIT
INIT
bcf STATUS,RP0
clrf PORTA
MOVLW 0x05
MOVWF CMCON
BSF STATUS,RP0
clrf ANSEL ; disable ADC
movlw 0x0c
MOVWF TRISA ; porta as inp
clrf TRISC ; portc as out
BCF STATUS,RP0
START
call delay
movlw 0xff
movwf PORTC
call delay
clrf PORTC
GOTO START
;PIC Time Delay = 0.50000200 s with Osc = 4000000 Hz
delay: movlw D'3'
movwf CounterC
movlw D'138'
movwf CounterB
movlw D'85'
movwf CounterA
loop decfsz CounterA,1
goto loop
decfsz CounterB,1
goto loop
decfsz CounterC,1
goto loop
retlw 0
end
I understand that you are trying to flash an LED on PORTC.???
No, that i can do..
but i want to flash LED with switch reading..
any way, i want to study more about this first how it work??
__config 0x3D14
The bits are binary, convert the hexadecimal __config value to binary and you can easily see what the settings are.
LIST p=16F676 ;tell assembler what chip we are using
;include "P16F676.inc" ;include the defaults for the chip
__config 0x3D14 ;sets the configuration settings (oscillator type etc.)
; HERE SET TO INTERNAL OSCILLATOR 4MHZ
ORG 0
GOTO INIT
INIT
MOVLW 0x5
MOVWF CMCON
BSF STATUS,RP0
CLRF VRCON
MOVLW 0x3f
MOVWF TRISA ; porta as input
MOVLW 0x0
CLRF ANSEL ; disable ADC
MOVWF TRISC ; portb as output
BCF STATUS,RP0
START
btfss PORTA,1 ; test bit 1
call delay
GOTO START
delay
movlw 0xff
movwf PORTC
movlw 0fh
movwf 0x21
dECfsz 0x21,f
clrf PORTC
RETURN
end