Bit stuffing problem!


Results 1 to 14 of 14

Threaded View

  1. #14
    atomski's Avatar
    atomski Guest


    Did you find this post helpful? Yes | No

    Default

    Guys,

    thanks for all the ideas, I was thinking more or less along
    these lines, but I wasn't sure what would be the best thing
    to do. I actually got it to work by doing this:

    Start:
    Pulse = 0
    PULSIN Rx_Pin, 0, Pulse
    IF Pulse < 290 THEN Start

    Get_Data:
    FOR i = 0 to 6
    FOR w = 0 TO 5
    Pulse = 0
    PULSIN Rx_Pin, 0, Pulse
    If Pulse > 80 and Pulse < 120 THEN Rx_Bit = 0
    IF Pulse > 180 AND Pulse < 220 Then Rx_Bit = 1
    Rx_Byte.0 = Rx_bit
    Rx_Byte = Rx_Byte << 1
    NEXT w
    Rx_Data[i] = Rx_Byte >> 1 ' SIMPLE BUT EFFECTIVE
    NEXT i
    i = 0
    w = 0
    GOSUB Checksum ' Put a pinholder here, hehehe!
    GOSUB Send_Data
    GOTO Start

    END

    Now it works like a charm, but I'll give it a go with your
    idea Bruce cuz it lookes slicker hehehe. BTW Archilochus,
    I'll add a couple of IF THEN or CASE statements to make
    sure shorter or longer pulses are discarted.

    And now something completely different

    If you take a look at the code above you'll see that I
    decided to implement checksum to my routine and since
    I'm messin' 'round with 6-bits like Dwayne said, I ran into
    another problem. Spent whole afternoon trying to solve it
    but no dice.

    I've opened another thread regarding this, so if any of you
    still have any patience left for trying to crack this one, this
    is the place to look:

    http://www.picbasic.co.uk/forum/show...=&threadid=833

    Thanks to everyone who helped me out with this one.

    --
    Sincerest regards,

    YZ7REA Vladimir M Skrbic
    4N7ATV Repeater Administrator
    YU7GHZ Radio Club President
    Last edited by atomski; - 2nd November 2004 at 09:36.

Similar Threads

  1. Bits, Bytes Words and Arrays
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 24
    Last Post: - 14th June 2016, 08:55
  2. PICBasic newbie problem
    By ELCouz in forum mel PIC BASIC Pro
    Replies: 32
    Last Post: - 12th February 2008, 01:55
  3. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 18:27
  4. DMX512 Problem ..Schema+Code
    By programmer07 in forum mel PIC BASIC Pro
    Replies: 21
    Last Post: - 21st March 2007, 16:39
  5. USART interrupt not interrupting right
    By Morpheus in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 6th March 2005, 02:07

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