Hello Joe,
I did try your suggestion and it still will not work.
Please see the following code IT DOES WORK
My 'kids are off raising thier own. My Wife's (I call her 'Da BOSS, BOSS) eyes glossed over in about 2 minutes, she says huh?
I do thank you for your thoughts and suggestions.
Terry, K9HA
'************************************************* ***************
'
' * * * System Defines * * *
'
'
@ DEVICE pic16f877a, CPD_OFF
@ DEVICE pic16f877a, PROTECT_OFF
@ DEVICE pic16f877a, WRT_OFF
DEFINE OSC 4
'DEVICE pic16f877a,
'ADCON1=7 ' sETS pORTS AS ALL DIGITAL( I HOPE)
'????????????????????????????????????????????????? ????????????
'
INTCON=0 'I Think this turns off ALL INTERUPTS FOR PORTB????
'
'????????????????????????????????????????????????? ?????????????
'
'************************************************* ***************
'
' Variable Descritptions:
'
' NAME # bits location I/O Description
' Type 1 PortD0 IN LOW for TRUE
' HIGH for COMPLEMENTARY
' PortC.7 1 Program BIT VAR BIT
'
'************************************************* ***************
'
' * * * VARIABLE DECLARATIONS * * *
'
B0 var byte 'Used in subroutine to generate LED Segment data
B1 var byte 'Used in subroutine to generate LED Segment data
'Type var BIT 'PortD.0
'tYPE = PortD.0
'
'************************************************* ***************
' DEVICE SET-UP
'
CLEAR ' Is this the proper place to put this?
'
PortB=%11111111 ' ALL BIT PRELOADED TO 1. Known condition.
'
TRISB=%11111111 ' ALL 8 BITS SET AS INPUT: HOEVER ONLY LOWER 4 REALLY USED.
' ' *** GROUND BITS 4-7 ***
PortC=%11111111 'ALL BITS preloaded as HIGH (LED DISPLAY IS OFF), BIT 7 as HIGH
'
TRISC=%00000000 'ALL BITS SET AS OUTPUT ( BITS 0-6: LED SEGMENTS 1-7
TRISE.4=0 'tURNS OFF PARALLEL/SLAVE PORT FUNCTION FOR PORT D
loop:
B0=PORTB
'For B1 = 0 To 15 ' Count from 0 to 15 "F"
'B0 = B1 ' Pass the count to the conversion subroutine
Gosub bin2seg ' Convert to segment value
Poke PortC, B0 ' Put segment values out to LED
PauseUS 1 ' Display it for 1 second
Poke PortC, $FF ' Turn off PortC
PAUSEUS 1
'Next B1 ' Do next
Goto loop ' Do it forever
' Convert binary number in B0 to segments for LED
bin2seg: Lookup B0,[$40,$79,$24,$30,$19,$12,$02,$78,$00,$18,$88,$83,$C 6,$A1,$86,$8E],B0
Return
END
' CLEAN COMPILE 121 WORDS USED 10/04/2008 09:15:00 PM
'
' Yippie, IT WORKS!!
THIS does read a BCD switch
Bookmarks