buffallo
Member level 1
- Joined
- Mar 2, 2012
- Messages
- 38
- Helped
- 3
- Reputation
- 6
- Reaction score
- 3
- Trophy points
- 1,288
- Activity points
- 1,637
LIST P=PIC16F88
#include <p16f88.inc>
__CONFIG _CONFIG1, _CCP1_RB0&_LVP_OFF&_MCLR_OFF&_PWRTE_ON&_WDT_OFF&_INTRC_IO
__CONFIG _CONFIG2, _IESO_OFF & _FCMEN_OFF
errorlevel -302
errorlevel -207
org 0x00
goto setup
org 0x04
goto setup
setup
bsf STATUS,RP0 ; bank 1
clrf ANSEL
movlw b'01110000'
movwf OSCCON ; select 8-MHz INTOSC clock
Stable btfss OSCCON,IOFS
goto Stable
bcf STATUS,RP0 ; bank 0
setup
banksel TRISA
clrf TRISA
clrf TRISB
call blinkk ; function that blinks portB with some delay
call blinkk
banksel OSCCON
movlw OSCCON
movwf FSR
movlw b'00010010' ; All kinds of combos are tried here,
movwf INDF
nop
nop
call blinkk
call BDelay
banksel BANK_0
goto setup
Hi,
the worst part is that I do not have another F88 chip.
I have not entered any other config parameters after your code, but still it didn't work.
Now I am trying with the following code:
Code:setup banksel TRISA clrf TRISA clrf TRISB call blinkk ; function that blinks portB with some delay call blinkk banksel OSCCON movlw OSCCON movwf FSR movlw b'00010010' ; All kinds of combos are tried here, movwf INDF nop nop call blinkk call BDelay banksel BANK_0 goto setup
So after I burn that code I see two flashes of the diode at very slow rate (assuming that it's running at 31.25kHz). Then the LED stalls at the last state. I assume something is wrong with the chip but I want to be pretty sure of that, because when I comment out the lines which change the contents of OSCCON register (i.e. I keep it running at 31.25kHz) the original voltage meter program runs just fine (althogh slow) and the ADC module, ports, timers work just fine.
LIST P=PIC16F88
#include <p16f88.inc>
__CONFIG _CONFIG1, _CCP1_RB0&_LVP_OFF&_MCLR_OFF&_PWRTE_ON&_WDT_OFF&_INTRC_IO
__CONFIG _CONFIG2, _IESO_OFF & _FCMEN_OFF
errorlevel -302
errorlevel -207
cblock 0X20 ; specify user regiaters
d1
d2
d3
COUNT
endc
org 0x00
goto setup
org 0x04
retfie
setup
banksel ANSEL
clrf ANSEL
movlw b'01110010'
movwf OSCCON ; select 8-MHz INTOSC clock
Stable btfss OSCCON,IOFS
goto Stable
banksel 0 ; bank 0
; progam to flash all of PortB pins on and off every 2 seconds
CLRF PORTB ; Set portb,c,d to digital outputs
BANKSEL TRISB
CLRF TRISB
BANKSEL 0
LOOP ; main program loo[
CALL DELAY2s
MOVLW 0xFF
MOVWF PORTB ; Set port HIGH
CALL DELAY2s
MOVLW 0x00
MOVWF PORTB ; Set port LOW
GOTO LOOP
DELAY2s ; 2 SECOND DELAY with 8mhz clock
movlw 0x23
movwf d1
movlw 0xB9
movwf d2
movlw 0x09
movwf d3
Delay_0
decfsz d1, f
goto dly1
decfsz d2, f
dly1 goto dly2
decfsz d3, f
dly2 goto Delay_0
return
END
Code C - [expand] 1 __CONFIG _CONFIG1, _CCP1_RB0&_LVP_ON&_MCLR_OFF&_PWRTE_OFF&_WDT_OFF&_INTRC_IO
Code ASM - [expand] 1 2 3 4 5 6 7 8 OSCON = 0x66 or 0x6E ANSEL = 0x00; CMCON = 0x07
movwf OSCCON
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?