Better understanding PULSIN


Results 1 to 13 of 13

Threaded View

  1. #7
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Default ... little more help needed

    Hello Alain,

    This is an example of a 13-bit IR pattern I measure on a TSOP4838 receiver module.
    <img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=2701&stc=1&d=121464754 0">

    At the start, my prog captures the incoming pattern sent continiously until it determines the starting-bit (first one after the pause between two patterns) and the number of bits (Bit-Count) in the pattern.

    I try with this code:
    Code:
    for Ctr_A = 0 to bit_count
       rctime p_in, 0, h_Bit[Ctr_A]
       rctime p_in, 1, l_Bit[Ctr_A]
    next Ctr_A
    
    ' Results are:
    Bit 00  Low  :13795
        00  High :350
    Bit 01  Low  :244
        01  High :1253
    Bit 02  Low  :244
        02  High :349
    Bit 03  Low  :243
        03  High :350
    Bit 04  Low  :244
        04  High :350
    Bit 05  Low  :244
        05  High :349
    Bit 06  Low  :244
        06  High :349
    Bit 07  Low  :243
        07  High :350
    Bit 08  Low  :75
        08  High :1
    Bit 09  Low  :244
        09  High :650
    Bit 10  Low  :243
        10  High :350
    Bit 11  Low  :244
        11  High :350
    Bit 12  Low  :244
        12  High :349
    This is the code (works fine) I use currently use @ 20MHz and the data I get with PULSIN is:
    Code:
    for Ctr_A = 0 to bit_count
       pulsin p_in, 0, L_Bit[Ctr_A]
    next Ctr_A
    for Ctr_A = 0 to bit_count
       pulsin p_in, 1, H_Bit[Ctr_A]
    next Ctr_A
    
    ' Resuts are:
    Bit 00  Low  :1258 'to be multiplied by 2µs (PULSIN res @ 20MHz)
        00  High :247
    Bit 01  Low  :354
        01  High :247
    Bit 02  Low  :354
        02  High :247
    Bit 03  Low  :355
        03  High :247
    Bit 04  Low  :354
        04  High :247
    Bit 05  Low  :354
        05  High :247
    Bit 06  Low  :354
        06  High :247
    Bit 07  Low  :354
        07  High :247
    Bit 08  Low  :655
        08  High :247
    Bit 09  Low  :354
        09  High :247
    Bit 10  Low  :355
        10  High :247
    Bit 11  Low  :355
        11  High :247
    Bit 12  Low  :354
        12  High :13797
    According to your previous message, I might raise the timings accuracy with RCTIME instead of using PULSIN. Unfortunately, I can't get it to work using RCTIME.

    What am I doing wrong, please?
    Attached Images Attached Images  
    Roger

Similar Threads

  1. Replies: 17
    Last Post: - 12th April 2014, 02:17
  2. pulsin: how is it used
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 8th October 2008, 00:11
  3. Funny PULSIN values: what is going on???
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 30th April 2008, 08:02
  4. Pulsin 16F819 problem
    By rekcahlaer in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 11th April 2007, 13:52
  5. PULSIN and RCTIME
    By Dwayne in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 4th November 2004, 14:45

Members who have read this thread : 1

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

Posting Permissions

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