[Tutor] Consistant Overhead Byte Stuffing (COBS) algorithm help

2005-10-03 Thread Michael Cotherman
Hello, I am really new to python and really have not programmed much since college, I played with it a little now, and it seems to be a tool I feel comfortable implementing a personal project in. I wish to communicate via a serial port to a device that is using COBS. I wish to configure it and the

Re: [Tutor] Consistant Overhead Byte Stuffing (COBS) algorithm help

2005-10-04 Thread Michael Cotherman
A little more info is below: With miniterm modified to output hex to the screen, here is the data coming in unformatted. (note zero bytes delimit end of packet): c:\Python23>python miniterm1.1a.py --- Miniterm --- type ESC to quit 0002860104DB203F0102860504CB1A740102860504CB1B7401028

Re: [Tutor] [Fwd: Re: Consistant Overhead Byte Stuffing (COBS)algorithm help]

2005-10-05 Thread Michael Cotherman
This is exactly what i was looking for For those following, the \x00 added at the end of the packet is just imaginary and represents in the meantime, I made the following that just 'decobs' a series of packets (only 8-10 bytes) that are coming in over the com port. (my incoming packets also b

Re: [Tutor] [Fwd: Re: Consistant Overhead Byte Stuffing (COBS)algorithm help]

2005-10-05 Thread Michael Cotherman
def UnStuffData(src,dst,len): for code in src: for i in range(1,code): dst.append(i) if code < 0xff dst.append('\0') the above is the below code uncommented... it(and the original code) just seem to find the end and puts a zero there... I do not see the exis

Re: [Tutor] [Fwd: Re: Consistant Overhead Byte Stuffing (COBS)algorithm help]

2005-10-06 Thread Michael Cotherman
): if i == x: dst.append('\0') x = src(i) else: dst.append(i) dst.pop(0) #remove first byte # if code < 0xff # dst.append('\0') -mike --- Kent Johnson <[EMAIL PRO

Re: [Tutor] [Fwd: Re: Consistant Overhead Byte Stuffing (COBS)algorithm help]

2005-10-07 Thread Michael Cotherman
The c code seems to be walking through the list moving bytes from src to dst, but the python code below seems to take one byte from src, start counitng up to the value from 1 and appending each and every value along the way to dst, no? -mike --- Alan Gauld <[EMAIL PROTECTED]> wrote: > > I am a