Shop OBEX P1 Docs P2 Docs Learn Events
sensor using basic stamp — Parallax Forums

sensor using basic stamp

budakentang89budakentang89 Posts: 3
edited 2010-05-14 08:36 in Accessories
hai...
i had bought an obstacle sensor and it happens that the source code is in basic stamp
I've tried to code it in c compiler...
but it won't work very nicely...
i want to ask a favor if u could help me translating it into c compiler programme using ccs.....
if u could...
i would provide the datasheet...which is irpd ver 3.0 detector.....
anyone...
please help...i need it urgently..
im having the project presentation soon...
thanks....

Comments

  • Spiral_72Spiral_72 Posts: 791
    edited 2010-05-13 16:19
    I can try to help. My C is a little rusty from no use. Post the Basic code you're trying to translate.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "puff"...... Smile, there went another one.
  • budakentang89budakentang89 Posts: 3
    edited 2010-05-14 02:18
    thank you spiral_72..
    i'll
    give u the datasheet...
    the basic stamp source code is at the last page of the datasheet..
    thank u very much..
    i appreciate ur help

    http://www.lynxmotion.com/images/data/irpd-v7.pdf

    i u need more info,just tell me.
    thanks again...

    "do u mind writing the pseudo code"thanks

    Post Edited (budakentang89) : 5/14/2010 2:34:03 AM GMT
  • FranklinFranklin Posts: 4,747
    edited 2010-05-14 04:21
    Could you include your c code so I could see how you were trying to communicate?
    What chip are you coding for?
    How are you connected to the device? Which pins where?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • budakentang89budakentang89 Posts: 3
    edited 2010-05-14 08:36
    i'm using pic16f877a.
    i have set tris the pin c for the both leds (right and left)"default".
    d7 for signal.
    c4 and c5 for output which is led but i want to change the output to servo motor later..(servo motor codes r completed yesterday)
    c0 and c1 to set the right and left led to default.

    here r the codes which i make with led as output ."later after sensor completed,i want to change the output to servo motor.

    #include<16f877a.h>
    #use delay(clock=20000000)
    #fuses hs,noprotect,nowdt,nolvp

    #byte portc=7
    #byte portd=8

    void main()
    {
    set_tris_c(0b00000000);
    set_tris_d(0b10000000);

    do{
    //
    //detect left//

    output_high(pin_c0);//left
    output_low(pin_c1);//right

    if(input(pin_d7)==0)
    {
    output_high(pin_c4);
    output_low(pin_c5);
    }

    if(input(pin_d7)==1)
    {
    output_low(pin_c4);
    output_low(pin_c5);
    }
    //
    //detect right//

    output_low(pin_c0);//left
    output_high(pin_c1);//right

    if(input(pin_d7)==0)
    {
    output_low(pin_c4);
    output_high(pin_c5);
    }

    if(input(pin_d7)==1)
    {
    output_low(pin_c4);
    output_low(pin_c5);
    }


    }while(1);
    }


    thank you..
Sign In or Register to comment.