pulsin again!anyone plz help!


Closed Thread
Results 1 to 36 of 36

Hybrid View

  1. #1
    Join Date
    Mar 2011
    Posts
    30


    Did you find this post helpful? Yes | No

    Default Re: pulsin again!anyone plz help!

    here you go:


    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   :                                                   *
    '*          :                                                   *
    '****************************************************************
    'include "ALLDIGITAL.pbp"
    @ 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 
    cmcon=2
    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
     
    check: 
    for i =0 to 11
    pulsin irin,0,tmp 
    if tmp >= 500 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
    if IRBUTTON <=9 then
    loop:
    toggle Sonyled       '<----------------------change!
     
    endif
    pause 100
    goto start

  2. #2
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: pulsin again!anyone plz help!

    Irbutton will never be less then 9 because you and it with 127. So your if will always be false.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  3. #3
    Join Date
    Mar 2011
    Posts
    30


    Did you find this post helpful? Yes | No

    Default Re: pulsin again!anyone plz help!

    so u r saying that i should and it with 65???
    BTW it works with less than 9....

  4. #4
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: pulsin again!anyone plz help!

    I'm sorry, I am completely wrong. Need more coffee. I was thinking OR.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  5. #5
    Join Date
    Mar 2011
    Posts
    30


    Did you find this post helpful? Yes | No

    Default Re: pulsin again!anyone plz help!

    np.you had me thinking there for a moment
    but my problem is the same just a pulse spike of 5 volts on button press i want to keep it permantently off or on when io press the button only once...

  6. #6
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,170


    Did you find this post helpful? Yes | No

    Default Re: pulsin again!anyone plz help!

    Quote Originally Posted by engineer7 View Post
    ...but my problem is the same just a pulse spike of 5 volts on button press...
    I'm not very familiar with AND/OR and masks yet, but I wouldn't be surprised if your program did just what you told it to do.

    IF TMP>=500 says to turn on during pulse and then off as soon as pulse stops.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  7. #7
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: pulsin again!anyone plz help!

    if tmp >= 500 then
    Will never be as tmp is BYTE size
    Dave
    Always wear safety glasses while programming.

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