• AVR Freaks

Hot!not detected RB0 signal

Author
Jose1957
New Member
  • Total Posts : 12
  • Reward points : 0
  • Joined: 2016/05/04 05:28:15
  • Location: 0
  • Status: offline
2019/02/10 06:32:36 (permalink)
0

not detected RB0 signal

 
 Good morning everyone.

I'm working on a device that can identify and execute
commands of an existing infra-red remote control,   sensitive
to various protocols. At this point it identifies:
   NEC (Pulse Width Modulation) NEC
   RC5 (Manchester Code) Philips
   RC6 (Manchester Code) Philips
   SIRC (Pulse Distance Code) Sony

I connected the infra-red receiver led to port RB0 and enabled
the RBINT interrupt with the INTEDG bit to 0, so it will trigger the interrupt
on the falling edge of RB0.

All right here. It is working, but sometimes fails, because when
I press a key and finish executing the command, I still have the key
pressed, thus executing the loop command.
   To avoid this loop I created a "wait_IR_key_depress" function and here something
   does not work as expected on hardware
    (in the MPLAB v8.56 simulator works correctly);
..........................
; signal repetition interval
; NEC 110ms
; RC5 100ms
; RC6 83m2
; CIRC 45ms


wait_IR_key_depress
    movlw 2; 256 * 256 = 65536us * 2 = 196.6ms
    movwf curr
    bcf INTCON, T0IF
   clrf TMR0
k_loop
    btfss PORTB, 0; if RB0 is LOW (signal on)
    clrf TMR0; reset TMR0
    btfss INTCON, T0IF
    goto k_loop
    bcf INTCON, T0IF
    decfsz curr
    goto k_loop
    return
.............................
 
 what happens is that it never detects  RB0 low, even signaling,
 so it makes a delay of 196.6ms and returns.
 
 Can anyone give an idea of ​​what might be happening?
 
 Thank you for your attention.
post edited by Jose1957 - 2019/02/11 03:27:43
#1

10 Replies Related Threads

    Jose1957
    New Member
    • Total Posts : 12
    • Reward points : 0
    • Joined: 2016/05/04 05:28:15
    • Location: 0
    • Status: offline
    Re: not detected RB0 signal 2019/02/11 03:29:43 (permalink)
    0
    Good morning, my dear ones.

    To simplify matters further, I have prepared a small file (teste.asm) only with the code needed to evidence the problem.
        What i want, is to light a led while I have pressing a remote-control IR key and efface when I release the key.
       The repeat time between frame is 100 milli seconds.
        Proof that there is a signal in RB0 is that the led lights up, but it goes out soon after and returns to light, or it is flashing
    while pressing a key.
       Can anyone help me?

         Thanks
    post edited by Jose1957 - 2019/02/11 03:34:38
    #2
    Jose1957
    New Member
    • Total Posts : 12
    • Reward points : 0
    • Joined: 2016/05/04 05:28:15
    • Location: 0
    • Status: offline
    Re: not detected RB0 signal 2019/04/05 13:15:40 (permalink)
    0
    OK. My apologies for returning to this problem, but got for this to work,
    and for this question is not left unanswered here is it:

      The problem is resolved by disabling BODEN for BODEN_OFF.
      This means that during the process, several resets occur
    by instability in the 5v power line.
      (indicated by a variable that I created to count how many times the "init" function is executed)
      Is this a common problem?
      A hug to everyone
    #3
    acharnley
    Super Member
    • Total Posts : 309
    • Reward points : 0
    • Joined: 2016/05/01 06:51:28
    • Location: 0
    • Status: offline
    Re: not detected RB0 signal 2019/04/05 15:31:09 (permalink)
    +1 (1)
    Have you a decoupling 0.1uF capacitor very close to Vin?

    You may also need a 0.01uF capacitor if you're dealing with a noisy line. 

    (See the datasheet, it's in there).
    #4
    Jose1957
    New Member
    • Total Posts : 12
    • Reward points : 0
    • Joined: 2016/05/04 05:28:15
    • Location: 0
    • Status: offline
    Re: not detected RB0 signal 2019/04/06 02:50:57 (permalink)
    0
    Dear acharnley, I do not have such a capacitor, I have one of 220uf on the output of the 7805. If I understood well I must put two capacitors one of 0.1 and another of 0.01? or is one just enough?   Perhaps the problem is caused by the power supply being resistive, ie no transformer.  Thanks for the tip
    post edited by Jose1957 - 2019/04/06 03:13:35
    #5
    acharnley
    Super Member
    • Total Posts : 309
    • Reward points : 0
    • Joined: 2016/05/01 06:51:28
    • Location: 0
    • Status: offline
    Re: not detected RB0 signal 2019/04/06 03:22:56 (permalink)
    0
    What is feeding the 7805?

    As I recall 220uF is too large for a 7805, should be 2 x 10uF's or similar. Use X5R or X7R's.

    And yes a 0.1uF very close to the PIC is fairly mandatory. The second 0.01uF is for noise suppression, you probably don't need it unless you're using high frequency PWM's or have noisy components on your PCB.
    #6
    Jose1957
    New Member
    • Total Posts : 12
    • Reward points : 0
    • Joined: 2016/05/04 05:28:15
    • Location: 0
    • Status: offline
    Re: not detected RB0 signal 2019/04/06 03:43:41 (permalink)
    0
     this is the schematics of power circuit
     R4 is in series with the load to serve as an ammeter
     
    post edited by Jose1957 - 2019/04/06 04:08:02

    Attached Image(s)

    #7
    acharnley
    Super Member
    • Total Posts : 309
    • Reward points : 0
    • Joined: 2016/05/01 06:51:28
    • Location: 0
    • Status: offline
    Re: not detected RB0 signal 2019/04/06 04:20:18 (permalink)
    0
    "L in" is mains? It looks like there's a filter, half bridge rectifier and a 15v shunt before the 7805. If power is coming from this not the 12V line the 470uF + 220uf capacitors either side of the 7805 may not be enough, especially if the 12v "output" is sucking juice (those resistors limit how much you can draw).
     
    Start with the 0.1uF, then increase the 470uF.  
    #8
    acharnley
    Super Member
    • Total Posts : 309
    • Reward points : 0
    • Joined: 2016/05/01 06:51:28
    • Location: 0
    • Status: offline
    Re: not detected RB0 signal 2019/04/06 04:22:41 (permalink)
    0
    BTW if the 12v is drawing power away from the 7805 consider using a 7812 first. Then consider a transistor (or darlington) emitter follower to get the 240/120 down to a safe level for the 7812.
     
    #9
    Jose1957
    New Member
    • Total Posts : 12
    • Reward points : 0
    • Joined: 2016/05/04 05:28:15
    • Location: 0
    • Status: offline
    Re: not detected RB0 signal 2019/04/06 04:49:58 (permalink)
    0
     Yes my friend, L is the main power.
    12V was my mistake, it should be  +- 15 v output
    Thank you so much for the good help.
    #10
    acharnley
    Super Member
    • Total Posts : 309
    • Reward points : 0
    • Joined: 2016/05/01 06:51:28
    • Location: 0
    • Status: offline
    Re: not detected RB0 signal 2019/04/06 05:11:46 (permalink)
    +1 (1)
    OK, so use an emitter follower to take the pre-rectified AC down to 30V. Use a darlington (rated to survive DC and current draw from the LM78xx regulators which is about 1.5A tops) so R20 can be very large. A 32v zener will give you about 30.6v. It can vary with heat but should have plenty of headroom for the LM78xx converters.

     
    Then use a LM7815 and LM7805 in parallel to get your low impedence 15v and 5v lines. If you're not using the current consider different LDO's with a lower current limit therefore allowing the darlington to be smaller.

    Attached Image(s)

    #11
    Jump to:
    © 2019 APG vNext Commercial Version 4.5