RC Receiver with PIC16F628A Very Glitchy


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,132


    Did you find this post helpful? Yes | No

    Default Re: RC Receiver with PIC16F628A Very Glitchy

    Why not put it in one check and save a cycle?

    Like this (untested):

    Code:
    Main:
           Pulsin Porta.0, 1, Width                                          'Wait for a high pulse store the pulse width in the variable "Width."
               if (Width >= 925 ) and ( Width <= 975) then          '1900µs is on state. 1900µs /2 = 950
                  high porta.1
               else 
                   if (Width >= 475 ) and ( Width <= 525) then           '1000µs is off state. 1000µs /2 = 500  
                  low porta.1                                                    'If channel 3 is indeed in the off state turn the LED off. 
               endif
               endif
           goto Main
    Ioannis

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default Re: RC Receiver with PIC16F628A Very Glitchy

    Quote Originally Posted by Ioannis View Post
    Why not put it in one check and save a cycle?

    Like this (untested):
    Ioannis
    or simpler to write ( may be same execution time ... )

    Code:
    Main:
    While 1
           Pulsin Porta.0, 1, Width                                          'Wait for a high pulse store the pulse width in the variable "Width."
               if (Width >= 925 ) and ( Width <= 975) then high porta.1  '1900µs is on state. 1900µs /2 = 950
                  
                if (Width >= 475 ) and ( Width <= 525) then low porta.1  '1000µs is off state. 1000µs /2 = 500  
                                                                      'If channel 3 is indeed in the off state turn the LED off. 
    
    Wend
    Alain

  3. #3
    Join Date
    Nov 2006
    Location
    Murrieta, CA
    Posts
    62


    Did you find this post helpful? Yes | No

    Wink Re: RC Receiver with PIC16F628A Very Glitchy

    Im sorry guys this final code is the deal breaker. Even simpler than I previously thought it was going to be.

    Turns lights on and off with a quickness. Ill post my RC Car here when i get it finished. Thanks again.

    I am using the same board I designed for this post: Home Theater IR remote light switch. Instead of receiving IR signals Its connected to the RC Receiver.

    Code:
    define osc 20
    
    CMCON = 7
    
    Width var word
       
      
    Main:
    while 1
        Pulsin Porta.0, 1, Width                                          'Wait for a high pulse store the pulse width in the variable "Width."
            if (Width > 900) then high porta.1  '1900µs is on state. 1900µs /2 = 950
                  
            if (Width < 550) then low porta.1  '1000µs is off state. 1000µs /2 = 500  
        
    wend
    Last edited by RFEFX; - 19th October 2013 at 20:51.
    There are 10 kinds of people. Those that know binary and those that do not.

Similar Threads

  1. pic16f628a issue
    By Bigandrewgold in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 2nd May 2012, 00:38
  2. PIC16F628A programming help
    By bentech4u in forum mel PIC BASIC
    Replies: 17
    Last Post: - 29th October 2008, 17:03
  3. Exploring Pic16F628a...
    By mbox in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 18th October 2008, 23:01
  4. Help Pic16f628a
    By gadelhas in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 26th August 2008, 23:22
  5. PIC16F628A defines
    By Peter1960 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 3rd May 2007, 08:00

Members who have read this thread : 0

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts