CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

PIC16LF1937

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Piccolo



Joined: 19 May 2006
Posts: 23
Location: Connecticut

View user's profile Send private message

PIC16LF1937
PostPosted: Fri Feb 05, 2010 8:44 am     Reply with quote

Using PCWH 4.103
Here's my FUSEs:
Code:
#include <16LF1937.h>
#device *=16

#FUSES NOWDT                   //No Watch Dog Timer
#FUSES INTRC_IO                //Internal RC Osc, no CLKOUT
#FUSES NOPUT                   //No Power Up Timer
#FUSES NOPROTECT               //Code not protected from reading
#FUSES NOMCLR                  //Master Clear pin used for I/O
#FUSES NOCPD                   //No EE protection
#FUSES BROWNOUT                //Reset when brownout detected
#FUSES NOIESO                  //Internal External Switch Over mode disabled
#FUSES NOFCMEN                 //Fail-safe clock monitor disabled
#FUSES NODEBUG                 //No Debug mode for ICD

#use delay(clock=125000)
#use rs232(baud=2604,parity=N,xmit=PIN_C6,rcv=PIN_C7, bits=8)

//-----------------------------------------------------------------------------


Here's the SETUP:
Code:
 setup_wdt(WDT_OFF);
  setup_adc(ADC_OFF);
  setup_adc_ports(NO_ANALOGS);
  setup_spi(FALSE);
  //setup_lcd(LCD_MUX13|LCD_STOP_ON_SLEEP,1); //used on TM99A-EX
  setup_lcd(LCD_MUX13|LCD_LFINTOSC|LCD_VOLTAGE3|LCD_VOLTAGE2|LCD_VOLTAGE1,0);
  setup_timer_0(RTCC_INTERNAL|RTCC_DIV_64);
  setup_timer_1(T1_DISABLED);
  setup_timer_2(T2_DISABLED,0,1);
  setup_timer_4(T4_DISABLED,0,1);
  setup_CCP4(CCP_OFF);
  setup_comparator(NC_NC_NC_NC);
  setup_vref(FALSE);
  setup_low_volt_detect(FALSE);
  setup_oscillator(OSC_125KHZ);


The problem I am having is I cannot get PIN_D1 to operate as an input.
I can get PIN_D1 to operate as an output but it does not operate as an input. As an input, when the voltage is logic 1 the code sees logic 0.

Any help is greatly appreciated.
Piccolo



Joined: 19 May 2006
Posts: 23
Location: Connecticut

View user's profile Send private message

PIC16F1937 PIN_D1 won't work as input
PostPosted: Fri Feb 05, 2010 10:16 am     Reply with quote

Here's what I found to fix the problem:
I need to go and clear the ANSELD register bit 1.
Code:
 bit_clear(ANSELD,1);


Works fine now.
Piccolo



Joined: 19 May 2006
Posts: 23
Location: Connecticut

View user's profile Send private message

PIC16LF1937 PIN_D1 won't work as input
PostPosted: Fri Feb 05, 2010 10:18 am     Reply with quote

I should have included this:
Code:
#byte ANSELD = 0x18F
 bit_clear(ANSELD,1);


Piccolo
Charlie U



Joined: 09 Sep 2003
Posts: 183
Location: Somewhere under water in the Great Lakes

View user's profile Send private message

PostPosted: Mon Mar 15, 2010 3:09 pm     Reply with quote

I am using a PIC16F1937 in a new project and have been wracking my brain for a couple of days on problems with Port E. I finally resorted to reviewing the list file and found a bit of a problem. I am a big believer in setting the tris registers myself for speed's sake. Well, V4.104 tries to set the old TRISE register (89h) rather than the new one (90h). I "upgraded" to 4.105 and a simple file with about 15 lines that was generated by the "Wizard" won't even compile now. It appears that the function parameters for Timer 1 have been left out of the 16F1937.h include files. Two steps forward and three steps back. @#$%^&*
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group