Click here to Skip to main content
15,886,703 members
Home / Discussions / C#
   

C#

 
GeneralRe: Looking for help deciphering this code class Pin
OriginalGriff14-Jan-12 3:37
mveOriginalGriff14-Jan-12 3:37 
GeneralRe: Looking for help deciphering this code class Pin
turbosupramk314-Jan-12 3:41
turbosupramk314-Jan-12 3:41 
GeneralRe: Looking for help deciphering this code class Pin
OriginalGriff14-Jan-12 3:53
mveOriginalGriff14-Jan-12 3:53 
GeneralRe: Looking for help deciphering this code class Pin
harold aptroot14-Jan-12 4:47
harold aptroot14-Jan-12 4:47 
GeneralRe: Looking for help deciphering this code class Pin
OriginalGriff14-Jan-12 5:03
mveOriginalGriff14-Jan-12 5:03 
GeneralRe: Looking for help deciphering this code class Pin
harold aptroot14-Jan-12 5:22
harold aptroot14-Jan-12 5:22 
GeneralRe: Looking for help deciphering this code class Pin
OriginalGriff14-Jan-12 5:31
mveOriginalGriff14-Jan-12 5:31 
GeneralRe: Looking for help deciphering this code class Pin
turbosupramk314-Jan-12 8:18
turbosupramk314-Jan-12 8:18 
I would like to maybe even take a class. This was my first OO language (and really my first real language period), which is why I couldn't read a spec and learn a language. Maybe that'd be possible if this was my 3rd or 4th language that I was learning?

I found out some information by grouping together a bunch of posted information that shows the code is instantiating a protocol, with linear feedback shift register verification.

I'm still trying to get used to this short hand of if/then/else and I can't seem to get the long hand version translation of the first code block? The second code block is my 4th attempt, I'm just not sure how they are setting lfsrData array value to 0xFE (254) or if true 1 else 0. That logic is escaping me?

C#
lfsrData[i] = (byte)(0xFE | (IterateLFSR() ? 1 : 0));


C#
lfsrData[i] = (((byte)(0xFE)) || (
                    if (IterateLFSR())
                    {
                        lfsrData[i] = 1;
                    }
                    else
                    {
                        lfsrData[i] = 0;
                    }
                    ))



Quote:
First the Propeller Tool seems to open the serial port in 115200-8-N-1 mode. After toggling the DTR line to reset the Propeller, it transmits 0xF9 followed by a sequence of 0xFEs and 0xFFs. This sequence is followed by a large block of 0xF9s. I'm sure all this corresponds to the 250 iterations of the LFSR but I don't see how. When I tried to duplicate the LFSR in Python I couldn't get anything even remotely close. Then the Propeller responds with a similar (but different) block of 0xFEs and 0xFFs. Again I'm
sure this corresponds to the LFSR somehow. The Propeller then sends 2 bytes 0xFE 0xFE which I believe is the version number?

After this the Propeller Tools sends a command byte (RAM or EEPROM) followed immediately by block of data which corresponds to the binary image of the program. I haven't spent alot of time analyzing the format of the this data, but it doesn't seem to directly match up with the bytecodes of the program. Something weird is going on here and I think has to do with how the Propeller is "reading" the serial data.

Finally the Propeller Tool sends 0xF9 periodically (every 50msec seems to work) until the Propeller responds with 0xFE. This acknowledgment protocol can be repeated twice more if the command code was programming to the EEPROM.


The $F9 (249) is the 'calibration pulse'. The start pulse is a short (one) pulse while the two zero bits in the $F9 (249) is a long (zero) pulse. After that, the least significant bit of the LFSR is sent by the Tool, one per character, for 250 bits, with the $FF (255) being a short (one) pulse and the $FE (254) being a long (zero) pulse. Then the Propeller sends back the next 250 bits in the LFSR, also one bit per byte by echoing the $F9 (249) characters, changing them to $F8 (248) to indicate that they were processed properly.

After all the LFSR bits, the Tool and the Propeller shift into a 3 bits per byte mode with each bit cell being 3 bits and the start bit counting as one bit of the first cell (which is always zero). As you might expect, a one is a short (1 zero pulse time) and a zero is a long (2 zero pulse times) and the Propeller echos the data. There's a mix of 8 bit and 32 bit sequences, etc

GeneralRe: Looking for help deciphering this code class Pin
harold aptroot14-Jan-12 9:34
harold aptroot14-Jan-12 9:34 
GeneralRe: Looking for help deciphering this code class Pin
turbosupramk315-Jan-12 5:23
turbosupramk315-Jan-12 5:23 
AnswerRe: Looking for help deciphering this code class Pin
BobJanova15-Jan-12 23:11
BobJanova15-Jan-12 23:11 
QuestionOnline users Pin
RichardKly13-Jan-12 6:37
RichardKly13-Jan-12 6:37 
AnswerRe: Online users Pin
PIEBALDconsult13-Jan-12 6:47
mvePIEBALDconsult13-Jan-12 6:47 
AnswerRe: Online users Pin
Qendro13-Jan-12 6:54
Qendro13-Jan-12 6:54 
Questionhwo to sort observabale collection? Pin
SRKSHOME13-Jan-12 3:08
SRKSHOME13-Jan-12 3:08 
AnswerRe: hwo to sort observabale collection? PinPopular
Abhinav S13-Jan-12 3:19
Abhinav S13-Jan-12 3:19 
AnswerRe: hwo to sort observabale collection? Pin
DaveyM6913-Jan-12 4:53
professionalDaveyM6913-Jan-12 4:53 
Questionhow do u execute this Pin
kkcarthieckk13-Jan-12 2:24
kkcarthieckk13-Jan-12 2:24 
AnswerRe: how do u execute this Pin
Richard MacCutchan13-Jan-12 3:06
mveRichard MacCutchan13-Jan-12 3:06 
Questionhow do u execute this Pin
kkcarthieckk13-Jan-12 2:23
kkcarthieckk13-Jan-12 2:23 
Questionset to 640x480 wmv files Pin
is90057james12-Jan-12 19:28
is90057james12-Jan-12 19:28 
AnswerRe: set to 640x480 wmv files Pin
Abhinav S12-Jan-12 20:57
Abhinav S12-Jan-12 20:57 
Generalhi frnds Pin
mbjino12-Jan-12 18:31
mbjino12-Jan-12 18:31 
GeneralRe: hi frnds Pin
Calla12-Jan-12 20:50
Calla12-Jan-12 20:50 
GeneralRe: hi frnds PinPopular
V.12-Jan-12 20:53
professionalV.12-Jan-12 20:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.