View previous topic :: View next topic |
Author |
Message |
Piccolo
Joined: 19 May 2006 Posts: 23 Location: Connecticut
|
PIC16LF1937 |
Posted: Fri Feb 05, 2010 8:44 am |
|
|
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
|
PIC16F1937 PIN_D1 won't work as input |
Posted: Fri Feb 05, 2010 10:16 am |
|
|
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
|
PIC16LF1937 PIN_D1 won't work as input |
Posted: Fri Feb 05, 2010 10:18 am |
|
|
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
|
|
Posted: Mon Mar 15, 2010 3:09 pm |
|
|
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. @#$%^&* |
|
|
|