PICF819 Analog/Digital settings

Thread Starter

ronbowalker

Joined Jun 26, 2009
23
I am using a PIC16F819 and I am not sure what the proper settings are to make all the I/O pin Digital. I see that some of the pins are designated as Analog, but does this mean that they cannot be Digital? I am rookie on this part and this is a new chip for me. 31kHz and Digital Inputs mostly.
Please help if you can, thanks.
 

BMorse

Joined Sep 26, 2009
2,675
I am using a PIC16F819 and I am not sure what the proper settings are to make all the I/O pin Digital. I see that some of the pins are designated as Analog, but does this mean that they cannot be Digital? I am rookie on this part and this is a new chip for me. 31kHz and Digital Inputs mostly.
Please help if you can, thanks.

IF you read through the datasheet... it actually gives you examples on how to do this.....

Rich (BB code):
BANKSEL PORTA     ; select bank of PORTA
CLRF PORTA          ; Initialize PORTA by clearing output data latches
BANKSEL ADCON1   ; Select Bank of ADCON1
MOVLW 0x06         ; Configure all pins
MOVWF ADCON1    ; as digital inputs
MOVLW 0xFF         ; Value used to initialize data direction
MOVWF TRISA       ; Set RA<7:0> as inp

My .02
 

Thread Starter

ronbowalker

Joined Jun 26, 2009
23
Thank you for the lesson. I see what you are talking about now. This should be what I need. I have another question about another issue I just encountered. I thought the PIC16F819 had an Internal OSC. But it is a "Block" in the datasheet description. Is this still an internal oscillator that will do 32kHz? I am trying to save power as well as pcb space, and I was hoping to not use RC. I hope you can help me with this.
 

BMorse

Joined Sep 26, 2009
2,675
Thank you for the lesson. I see what you are talking about now. This should be what I need. I have another question about another issue I just encountered. I thought the PIC16F819 had an Internal OSC. But it is a "Block" in the datasheet description. Is this still an internal oscillator that will do 32kHz? I am trying to save power as well as pcb space, and I was hoping to not use RC. I hope you can help me with this.

• Internal oscillator block:
- 8 user selectable frequencies: 31 kHz, 125 kHz,
250 kHz, 500 kHz, 1 MHz, 2 MHz, 4 MHz, 8 MHz


I don't see where it says anything about 32Khz........ 31Khz but not 32.....
 

Thread Starter

ronbowalker

Joined Jun 26, 2009
23
Here are my programmer configuration. I am using Pic Basic Pro.

Oscillator: INTRC(INTIO2)
WTD: Enabled
Power-Up Timer: Enabled
MCLR Pin Function: Reset
Brown-Out Reset: Enabled
Low Voltage Programming: Disabled
CCP Multiplexed With: RB2
Flash Program Memory Write Enabled: All
Code: Not Protected
Data EEPROM: Not Protected
 

Thread Starter

ronbowalker

Joined Jun 26, 2009
23
This is in long form for me to follow my setting easier as I get this programing under way. Chip is running at 87uA with this loaded. But no pins are High(B.0 & A.7 should be)

'***INITIALIZATION and SETTINGS***********************
DEFINE OSC 3 'Frequency in Mhz (TBD)
OSCCON = %00001000 'Internal Oscillator @ 32kHz
ADCON1=7 'Makes input Digital (not Analog)
''''''''''''''''''''''''''PIN SETTINGS''''''''''''''''''''''''''''''''''''
'BUTTON..............WHITE
TRISA.6 = 1 'Input (White button)
PORTA.6 = 0 'LOW (WHite button)
'BUTTON..............GREEN
TRISB.6 = 1 'Input (Green button)
PORTB.6 = 0 'LOW (Green button)
'BUTTON..............RED
TRISA.4 = 1 'Input (Red button)
PORTA.4 = 0 'LOW (Red button)
'BUTTON..............BLUE
TRISA.2 = 1 'Input (Blue button)
PORTA.2 = 0 'LOW (Blue button)&(serial)
'LED.................WHITE
TRISA.5 = 0 'Output (White LED)
PORTA.5 = 0 'LOW (White LED)
'LED.................GREEN
TRISB.4 = 0 'Output (Green LED)
PORTB.4 = 0 'LOW (Green LED)
'LED.................RED
TRISB.2 = 0 'Output (Red LED)
PORTB.2 = 0 'LOW (Red LED)
'LED.................BLUE
TRISB.3 = 0 'Output (Blue LED)
PORTB.3 = 0 'LOW (Blue LED)&(serial)
'Relays....................
TRISB.0 = 0 'Output (Bulb-Out 1 call)
PORTB.0 = 1 'HIGH (Bulb-Out 1 call)

TRISA.7 = 0 'Output (Bulb-Out 2 call)
PORTA.7 = 1 'HIGH (Bulb-Out 2 call)

TRISB.1 = 0 'Output (PB1 call)
PORTB.1 = 0 'LOW (PB1 call)

TRISA.3 = 0 'Output (PB2 call)
PORTA.3 = 0 'LOW (PB2 call)

TRISA.0 = 0 'Output (SPARE)
PORTA.0 = 0 'LOW (SPARE)

TRISA.1 = 0 'Output (SPARE)
PORTA.1 = 0 'LOW (SPARE)

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 
Top