PDA

View Full Version : PORTA.0 works, PORTB.7 or .6 do not



ozarkshermit
- 2nd September 2009, 22:00
Hi all

Usually it's the other way around - trouble with PORTA . . .
I have 1K pull-ups connected to PORTA.0 and PORTB.6 and PORTB.7
Also have pullups enabled for Port B., so probably do not need another external one.

When I ground the input, I want to simply change some values, and it works as hoped for using PORTA.0, but not with PORTB.6 or PORTB.7

At first I thought it might be due to having the Pickit2 attached, which uses PORTB.6 and 7, but disconnecting the Pickit had no effect.

Perhaps it's in how I have the CONFIGS set up - I am totally stumped.
PORTB.6 and 7 are not used anywhere else in the program.

Some of the code is attached below - at least what I THINK is appropriate for review. If need be I can post the entire program, it's kind of long, and probably could use a lot of refinement - but that is for later.

include "modedefs.bas"
OPTION_REG.7 = 0
ADCON1 = %00000110
INTCON = %00000000 '''DISABLE ALL INTERRUPTS
DEFINE OSC 4
TRISA = %00000111
TRISB = %11111111 'PORT B ALL INPUTS
TRISC = %01010000
Tx VAR PORTC.6


START:
IF PORTA.0 = 1 THEN CHK_AXIS '''IF NOT GROUNDED, BYPASS


''' '************************************************* *
''THIS IS WHERE THE VALUES ARE CHANGED
''WORKS GREAT FOR PORTA.0
''DOES NOT WORK WITH PORTB.7 OR 6
''************************************************ *********

Z_LIMIT = Z
Z1H = Z_LIMIT DIG 1
Z2L = Z_LIMIT DIG 0
'************************************************* ********************
''************************************************ ***********

CHK_AXIS:

IF PORTB.1 = 0 then Chk_x
if PORTB.2 = 0 then Chk_Y
if PORTB.3 = 0 then Chk_Z


'*************************
' MORE UNRELATED CODE FOLLOWS

Archangel
- 2nd September 2009, 22:16
Hi ozarkshermit,
I cannot tell doodlysquat without knowing which PIC you are using, on account of I Need to view the Data sheet.

ozarkshermit
- 2nd September 2009, 22:44
Sorry:

It is a 16F876A
Ken

ozarkshermit
- 3rd September 2009, 04:18
I hope this is not a double post - anyway - PROBLEM SOLVED

It was a faulty jumper in my hardware. I guess I should have looked harder to begin with.

Ken

Archangel
- 3rd September 2009, 04:25
OK, glad you got it working.