Hi,
I'm trying to debug a problem with USART on this chip. I'm familiar with using the PIC 16F628 but new to the 16F88 and am finding it a bit of a challenge to configure (particularly the clock).
I suspect my USART problem (erratic behaviour, data duplication, data sometimes not received) is due to an inaccurate clock on the mcu side, so I am going back to basics in order to get the clock configuration correct.
I have stripped everything from my breadboard and just connected the Vss and Vdd, and a resistor/LED to RB7.
Using the following program from an online source, I am expecting the LED to blink when connected to any of the digital pins. However, I get no output at all from the LED. As sometimes happens, right now it feels like I am going backwards instead of making progress with this project...
Question: Are there any ESSENTIAL connections other than Vss/Vdd and the output LED pin that I need? I assume MCLR is not in use so no need to tie this to ground.
I'm trying to debug a problem with USART on this chip. I'm familiar with using the PIC 16F628 but new to the 16F88 and am finding it a bit of a challenge to configure (particularly the clock).
I suspect my USART problem (erratic behaviour, data duplication, data sometimes not received) is due to an inaccurate clock on the mcu side, so I am going back to basics in order to get the clock configuration correct.
I have stripped everything from my breadboard and just connected the Vss and Vdd, and a resistor/LED to RB7.
Using the following program from an online source, I am expecting the LED to blink when connected to any of the digital pins. However, I get no output at all from the LED. As sometimes happens, right now it feels like I am going backwards instead of making progress with this project...
Question: Are there any ESSENTIAL connections other than Vss/Vdd and the output LED pin that I need? I assume MCLR is not in use so no need to tie this to ground.
Rich (BB code):
;***************************************************************
title "PIC Sample code: PIC16F88 program"
subtitle "Version 1.1 (c) Jay.slovak"
;Designed for 16F88 @4Mhz
;***************************************************************
list p=16F88
#include "p16f88.inc" ; PIC definitions
__CONFIG _CONFIG1, _CP_OFF & _CCP1_RB0 & _DEBUG_OFF & _WRT_PROTECT_OFF & _CPD_OFF & _LVP_OFF & _BODEN_OFF & _MCLR_ON & _PWRTE_ON & _WDT_OFF & _INTRC_IO
ERRORLEVEL -302
;***************************************************************
z1 equ 20h
z2 equ 21h
z3 equ 22h
z4 equ 23h
;***************************************************************
org 0x0000
goto INIT
NOP
NOP
NOP
NOP
org 0x0005
INIT
CLRF PORTA
CLRF PORTB
BSF STATUS,RP0 ;Select Bank 1
CLRF ANSEL ;All pins are Digital
BSF OSCCON,6 ;Set oscilator to 4Mhz
BSF OSCCON,5
MOVLW H'07'
MOVWF CMCON ;Turn off comparators
CLRF TRISA ;Port A is output
CLRF TRISB ;Port B is output
BCF STATUS,RP0 ;Select Bank 0
Start
MOVLW 0xFF
MOVWF PORTA
MOVWF PORTB
;goto $
CALL Delay
CLRF PORTA
CLRF PORTB
CALL Delay
GOTO Start
;***************************************************************
;***************************************************************
subtitle "Delay subprogram"
Delay movlw D'3'
movwf z3
movlw D'137'
movwf z2
decfsz z1,f
goto $-1
decfsz z2,f
goto $-3
decfsz z3,f
goto $-5
return