View previous topic :: View next topic |
Author |
Message |
Canders
Joined: 05 Dec 2005 Posts: 1
|
Pic16f690 and portb |
Posted: Mon Dec 05, 2005 12:01 pm |
|
|
The protb on my pic is not functioning as an input. I get a feeling that the b4 and b5 pins are set as the spi clock or the pullups are enabled. My compiler version is:
3.228
and the code i have tried:
Code: |
#include "C:\projects\qynstar-reciv\qynstar-rx.h"
#include "C:\projects\qynstar-reciv\LCDrec.C"
#include "C:\projects\qynstar-reciv\stdlib.h"
#define ALL_OUT 0
#define ALL_IN 0xff
#define RESET_BUTTON PIN_A4
#define MODE_BUTTON PIN_A3
#define VT Pin_A5
#BYTE SS=0x14
#BYTE pu=0x115
#BIT RABPU =0x81.7
static short Change_Mode,temp,mode,new_data;
static int zone_count[16],c, address,i, zone_trip[16], j;
static float power_level_sum;
void main()
{
setup_comparator(NC_NC_NC_NC);
ss=0x00;
disable_interrupts(GLOBAL);
setup_oscillator(OSC_31KHZ);
delay_ms(50);
set_tris_c(0x00);
set_tris_b(0xFF);
set_tris_a(0x1B);
setup_adc_ports(sAN0|VSS_VDD);
setup_adc(ADC_CLOCK_INTERNAL);
set_adc_channel(0);
port_a_pullups(FALSE);
RABPU=1;
pu=0x00;
setup_spi(FALSE);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
lcd_init(); |
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Dec 05, 2005 3:41 pm |
|
|
The setup_spi(FALSE) function sets Pin B6 to an output.
See the line shown in bold, in the listing below.
I would get rid of that function call. The SSP comes up in
a disabled state upon reset, anyway. You don't need to
disable it in code.
Quote: | .................... setup_spi(FALSE);
009A: BCF STATUS.6
009B: BCF SSPCON.5
009C: BSF STATUS.5 // Bank 1
009D: BCF TRISC.7
009E: BSF TRISB.4 // Set Pin B4 = input
009F: BCF TRISB.6 // Set Pin B6 = output
00A0: MOVLW 00
00A1: BCF STATUS.5 // Bank 0
00A2: MOVWF SSPCON
00A3: BSF STATUS.5 // Bank 1
00A4: MOVWF SSPSTAT
|
|
|
|
Guest
|
|
Posted: Mon Dec 05, 2005 4:00 pm |
|
|
That fixed it thanx
does the newest compiler version fix the all the compiler bugs for the 16f685-690
devices
thanx again |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Dec 05, 2005 4:02 pm |
|
|
Quote: | Does the newest compiler version fix the all the compiler bugs for the 16f685-690 devices ? |
Not sure. CCS doesn't keep a PIC-specific bug list on their website. |
|
|
|