andybarrett1
- 16th May 2017, 10:47
Help......
Hi Thank you for reading..... I am attempting to output 16 Leds on ports A and C using a 16F884
All is working ok but for RA5 (Pin7)..... I suspect I have not turned of an analogue function but what one..
Any help welcome..... all code is working fine but for this pin.... It just stays high all time !
See my headers below.
Thank you for reading
Andy
'__config _CONFIG1,
'_INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_OFF & _LVP_OFF & _CP_OFF &_CDP_OFF
'__config _CONFIG2, _WRT_OFF & _BOR40V
'Port A Leds
'Port B Buttons with Internal Pullups
'Port C Leds
'Port D Display
' LCD should be connected as follows:
' LCD PIC
' DB4 PortD.0
' DB5 PortD.1
' DB6 PortD.2
' DB7 PortD.3
' RS PortD.4
' E PortD.5
' RW Ground
' Vdd 5 volts
' Vss Ground
' Vo 50K potentiometer (or ground)
' DB0-3 No connect
OSCCON = $70 'Sets internal Osc at 8Megs
ANSEL=0 'Turn off Analogs
ANSELH=0
ADCON0=0
ADCON1=0
CM1CON0=0
CM2CON0=0
CM2CON1=0
CCP1CON=0
CCP2CON=0
OPTION_REG.7=0 'Port B Pullups active
TRISA=0 'PORT A Outputs
TRISB=15 'PORT B Inputs
TRISC=0 'PORT C Outputs
DEFINE LCD_DREG PORTD
DEFINE LCD_DBIT 0
DEFINE LCD_RSREG PORTD
DEFINE LCD_RSBIT 4
DEFINE LCD_EREG PORTD
DEFINE LCD_EBIT 5
DEFINE LCD_BITS 4
DEFINE LCDLINES 2
LED0 VAR PORTA.0
LED1 VAR PORTA.1
LED2 VAR PORTA.2
LED3 VAR PORTA.3
LED4 VAR PORTA.4
LED5 VAR PORTA.5
LED6 VAR PORTA.6
LED7 VAR PORTA.7
BUT0 VAR PORTB.0
BUT1 VAR PORTB.1
BUT2 VAR PORTB.2
BUT3 VAR PORTB.3
BUT4 VAR PORTB.4
BUT5 VAR PORTB.5
BUT6 VAR PORTB.6
BUT7 VAR PORTB.7
LED8 VAR PORTC.0
LED9 VAR PORTC.1
LED10 VAR PORTC.2
LED11 VAR PORTC.3
LED12 VAR PORTC.4
LED13 VAR PORTC.5
LED14 VAR PORTC.6
LED15 VAR PORTC.7
Hi Thank you for reading..... I am attempting to output 16 Leds on ports A and C using a 16F884
All is working ok but for RA5 (Pin7)..... I suspect I have not turned of an analogue function but what one..
Any help welcome..... all code is working fine but for this pin.... It just stays high all time !
See my headers below.
Thank you for reading
Andy
'__config _CONFIG1,
'_INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_OFF & _LVP_OFF & _CP_OFF &_CDP_OFF
'__config _CONFIG2, _WRT_OFF & _BOR40V
'Port A Leds
'Port B Buttons with Internal Pullups
'Port C Leds
'Port D Display
' LCD should be connected as follows:
' LCD PIC
' DB4 PortD.0
' DB5 PortD.1
' DB6 PortD.2
' DB7 PortD.3
' RS PortD.4
' E PortD.5
' RW Ground
' Vdd 5 volts
' Vss Ground
' Vo 50K potentiometer (or ground)
' DB0-3 No connect
OSCCON = $70 'Sets internal Osc at 8Megs
ANSEL=0 'Turn off Analogs
ANSELH=0
ADCON0=0
ADCON1=0
CM1CON0=0
CM2CON0=0
CM2CON1=0
CCP1CON=0
CCP2CON=0
OPTION_REG.7=0 'Port B Pullups active
TRISA=0 'PORT A Outputs
TRISB=15 'PORT B Inputs
TRISC=0 'PORT C Outputs
DEFINE LCD_DREG PORTD
DEFINE LCD_DBIT 0
DEFINE LCD_RSREG PORTD
DEFINE LCD_RSBIT 4
DEFINE LCD_EREG PORTD
DEFINE LCD_EBIT 5
DEFINE LCD_BITS 4
DEFINE LCDLINES 2
LED0 VAR PORTA.0
LED1 VAR PORTA.1
LED2 VAR PORTA.2
LED3 VAR PORTA.3
LED4 VAR PORTA.4
LED5 VAR PORTA.5
LED6 VAR PORTA.6
LED7 VAR PORTA.7
BUT0 VAR PORTB.0
BUT1 VAR PORTB.1
BUT2 VAR PORTB.2
BUT3 VAR PORTB.3
BUT4 VAR PORTB.4
BUT5 VAR PORTB.5
BUT6 VAR PORTB.6
BUT7 VAR PORTB.7
LED8 VAR PORTC.0
LED9 VAR PORTC.1
LED10 VAR PORTC.2
LED11 VAR PORTC.3
LED12 VAR PORTC.4
LED13 VAR PORTC.5
LED14 VAR PORTC.6
LED15 VAR PORTC.7