Shop OBEX P1 Docs P2 Docs Learn Events
If anyone has a BS1 Stamp please read last post in this thread. — Parallax Forums

If anyone has a BS1 Stamp please read last post in this thread.

metron9metron9 Posts: 1,100
edited 2007-04-18 03:34 in BASIC Stamp
I am working on a 2 wire device to interface with basic stamps using the shiftout and shiftin commands for error control. Basically the device receives data commands from a stamp in 8 bit bursts using shiftout. I use a timeout for the maximum time to wait from the first interrupt (start of the first bit out of the stamp) to the 8th bit. It defaults to allow sending 8 bits at a time. To send 16 bits I measure the time it takes to send 8 bits and then set the timeout to that plus a small amount. The device will automatically calibrate to any of the stamps that are faster than the BS2 but I need to know if my interrupt timer value can go high enough (higher is slower) to allow the BS1 to also use the device.

So specifically the bs2 I measure from the first clock rising signal to the last (8th) clock falling signal about 433uS

I need the time for this on the BS1

I guess I better find out the fastest stamp time as well. For this I will also need the low time between the 8th bit clock falling to the 9th bit rising signal for a 16bit shift.

Thanks

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Think Inside the box first and if that doesn't work..
Re-arrange what's inside the box then...
Think outside the BOX!

Post Edited (metron9) : 4/18/2007 2:47:06 PM GMT
979 x 486 - 42K

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-04-17 03:09
    The BS1 doesn't have a SHIFTIN or SHIFTOUT command. The "bit banging" has to be done with multiple statements. You might look at sample programs for a variety of SPI devices that Parallax sells to see if any of the comments in the routines talk about maximum speeds.
  • metron9metron9 Posts: 1,100
    edited 2007-04-17 03:28
    Ahhh I should have realized that. I wont even bother then.
    Ahhh i see the help file has the times for all the stamps.

    Looks like it will work with an 8mhz internal oscillator even on the fastest stamp. I shall proceed. Thanks Mike

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Think Inside the box first and if that doesn't work..
    Re-arrange what's inside the box then...
    Think outside the BOX!
  • metron9metron9 Posts: 1,100
    edited 2007-04-18 03:34
    I decided to try and make the device I am working on work with the BS1 as well so I do need someone who has a basic stamp 1 to help me out here.

    Could someone run this code (change it to run on the BS1 I don't have one) and tell me the maximum time from the first high to the last high signal on pin 1 (clock pin) by the way the extra HIGH 0 is in there to make the timing for both high and low almost the same. As long as $FF is longer then $00 for output it will sync to the data stream.

    This bit banging takes 60mS on the BS2


    ' {$STAMP BS2}
    ' {$PBASIC 2.0}
    ' {$PORT COM2}
    
    OUTPUT 0
    
    dbyte VAR Byte
    temp VAR Byte
    
    dbyte=255      'the byte to shift out
    GOSUB shifto
    END
    
    Shifto:
    temp=128
    shiftolp
    IF dbyte & temp >0 THEN bithigh
    HIGH 1
    LOW 1
    LOW 0
    DEBUG DEC temp,CR
    temp=temp/2
    IF temp<>0 THEN shiftolp
    RETURN
    bithigh:
    HIGH 0        'extra command to make both high and low the same amount of time
    HIGH 0
    HIGH 1
    LOW 1
    LOW 0
    temp=temp/2
     DEBUG DEC temp,CR
    IF temp<>0 THEN shiftolp
    RETURN
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Think Inside the box first and if that doesn't work..
    Re-arrange what's inside the box then...
    Think outside the BOX!
Sign In or Register to comment.