pulsin again!anyone plz help!


Closed Thread
Results 1 to 36 of 36

Hybrid View

  1. #1
    Join Date
    Mar 2011
    Posts
    30

    Default pulsin again!anyone plz help!

    here is my code:


    '************************************************* ***************
    '* Name : UNTITLED.BAS *
    '* Author : [select VIEW...EDITOR OPTIONS] *
    '* Notice : Copyright (c) 2011 [select VIEW...EDITOR OPTIONS] *
    '* : All Rights Reserved *
    '* Date : 5/23/2011 *
    '* Version : 1.0 *
    '* Notes : *
    '* : *
    '************************************************* ***************
    @ DEVICE pic16F877a, WDT_OFF ' Watchdog Timer
    @ DEVICE pic16F877a, PWRT_OFF ' Power-On Timer
    @ DEVICE pic16F877a, BOD_OFF ' Brown-Out Detect
    @ DEVICE pic16F877a, LVP_OFF ' Low-Voltage Programming
    @ DEVICE pic16F877a, CPD_OFF ' Data Memory Code Protect
    @ DEVICE pic16F877a, PROTECT_OFF ' Program Code Protection
    @ DEVICE pic16F877a, HS_OSC
    Define OSC 20
    Header var word
    Body var word
    i var byte
    tmp var Byte
    irButton var byte
    irDevice var byte
    irIN var PortB.2
    SonyLED var PortB.5

    'TrisA = %00000100
    TrisB = %00000100
    Start:
    LOW SONYLED
    IRBUTTON=255: IRDEVICE=255

    Pulsin irin,0,header
    if header > 1000 or header < 1350 then goto Start

    for i =0 to 11
    pulsin irin,0,tmp
    if tmp >= 480 then
    Body.0[i]=1 'Sony Logic 1 is 120
    else
    Body.0[i]=0 ' Sony Logic 0 is 60
    endif
    next
    IRBUTTON = Body & %01111111 'Mask 7 bit
    IRDEVICE = (Body >>7) & %00011111 'Mask 5 bit
    If IRDEVICE=255 then goto start

    if IRBUTTON >=0 and IRBUTTON < 255 then
    high Sonyled
    pause 300
    low Sonyled
    endif
    pause 100
    goto start



    plz can anyone find any problem with it.im using 20MHZ oscillator and pic16f877a and pic basic pro!!! plz plz can any one point out the probelm in this.it is not showing any output on portb.5...

  2. #2
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default Re: pulsin again!anyone plz help!

    What value will header need to have to NOT return to Start?
    Code:
    if header > 1000 or header < 1350 then goto Start
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  3. #3
    Join Date
    Mar 2011
    Posts
    30


    Did you find this post helpful? Yes | No

    Default Re: pulsin again!anyone plz help!

    1200!!!!
    as im using 20mhz crystal which has a resolution of 2microseconds.
    and the sony header is of 2400milliseconds so you get 1200 milliseconds...

  4. #4
    Join Date
    Mar 2011
    Posts
    30


    Did you find this post helpful? Yes | No

    Default Re: pulsin again!anyone plz help!

    sorry its a 2400 microsecond header so divide by 2 microsecond get 1200!!!!

  5. #5
    Join Date
    Mar 2011
    Posts
    30


    Did you find this post helpful? Yes | No

    Default Re: pulsin again!anyone plz help!

    oh yes the header should be
    header<1000
    n header >1350

    but i have tried wid this..
    its still not working.....

  6. #6
    Join Date
    Jan 2009
    Posts
    78


    Did you find this post helpful? Yes | No

    Default Re: pulsin again!anyone plz help!

    -Turn off the Analog to Digital converter
    -Comparators Off
    -Set a maximum count for Pulsin: DEFINE PULSIN_MAX 1350

Members who have read this thread : 0

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