mramos1
Active Member
I have a circuit where I use RB0-5 as output and input. But RB3 wants to just stay low (all the rest work 0,1,2,4,5,6).
Ohm'd it all out, all clean, no shorts and all connected, meter lights LED as well.
When I look at LED (RB3) with it running, it does not light, I read 0vdc as well. I tried CCP1CON =0. I give. Here is the init code in MikroBASIC.
Basically the registers are the same as ASM.
If I had a good ASM delay routine (mS and uS for all the different speeds I jump between) and liked to read the OSCCON/register stuff I would just go to ASM. I seem to always end back up like this
Thanks for any help. Also, hookup for all 6 pins (all are the same and all but RB3 work fine). I have PIC pin to resistor to LED to ground. switch across LED and using weak pullup. I thought maybe the LED and weak pullups might be the problem at one point, but why RB3 only?
EDIT: Making another game show buzzer for the kids Figure I would mention that as the code attached.
Ohm'd it all out, all clean, no shorts and all connected, meter lights LED as well.
When I look at LED (RB3) with it running, it does not light, I read 0vdc as well. I tried CCP1CON =0. I give. Here is the init code in MikroBASIC.
Basically the registers are the same as ASM.
If I had a good ASM delay routine (mS and uS for all the different speeds I jump between) and liked to read the OSCCON/register stuff I would just go to ASM. I seem to always end back up like this
Thanks for any help. Also, hookup for all 6 pins (all are the same and all but RB3 work fine). I have PIC pin to resistor to LED to ground. switch across LED and using weak pullup. I thought maybe the LED and weak pullups might be the problem at one point, but why RB3 only?
EDIT: Making another game show buzzer for the kids Figure I would mention that as the code attached.
Code:
'***** init code ******
'16F88
CMCON=7 'make PORTA digital I/O
OSCCON=2 ' 31.25Khz clock internal RC OSC
CCP1CON=0 'kill CPP mode <------------- no help
intcon=0 'interupt are disabled
ansel=%00000000 'all ports are in digital mode.
'***** rest of code if anyone wants to see more *****
'***** I think it is in the chip setup I tested LED in circuit as well ****
main:
TRISB = 0 ' Configure pins of PORTB as output
TRISA = %10000001 ' set porta for 0 = quix master and 1/2 out tp buzzer
PORTB = %00000000 ' portB outputs to light LED
timec=10000 ' set coutdown time to 10 seconds 10*1000
setbit(porta,3) 'turn on GAME POWER LED
'FLASH LEDS and WAIT ON GAME MASTER SWITCH
do
portb = %00000000 'flash LED off
delay_ms(100)
portb = %11111111 'all LEDS on
delay_ms(100)
loop until porta.0 = 0 'wait for game master to start
'START COUNT AND WAIT FOR USER INPUT ON PORTB
TRISB = %11111111 'set portb as input for the game.
OPTION_REG.7 = 0 ' turn on weak pullups
tmp=portb
tmp=0 'zero PORTB variable
co=0 'zero co (counter)
do
tmp=portb
' tmp= tmp or 0xc0 'mask off unused portb 6-7
if tmp <> %11111111 then 'see if a switch is pushed
tmp = tmp xor 0xff 'if flip the bits to light LED
co = timec
end if
delay_ms(1)
co=co+1 'counter (should be 1)
loop until co >= timec
'SOUND BUZZER
for co = 1 to 100
delay_ms(1)
setbit(porta,1)
clearbit(porta,2)
delay_ms(1)
setbit(porta,2)
clearbit(porta,1)
next co
'SHOW WINNERS LED
TRISB = %00000000
clearbit(Porta,3)
do 'flash winning LED
portb = %00000000
delay_ms(250)
portb = tmp
delay_ms(250)
loop until porta.0 = 0
goto main
end.
Last edited: