Shop OBEX P1 Docs P2 Docs Learn Events
[Re: [[basicstamps] Strange serial problems]] — Parallax Forums

[Re: [[basicstamps] Strange serial problems]]

ArchiverArchiver Posts: 46,084
edited 2003-03-16 03:50 in General Discussion
0xAA and 0x55 are just fun values. In binary they are

10101010 and 01010101

Nothing really fancy. Just alternating ones and zeros.

Perhaps 0xCC and 0x33 would also be useful.

11001100 and 00110011

smartdim@a... wrote:
> In a message dated 3/15/2003 5:23:49 PM Pacific Standard Time, fkerr@u...

> writes:
>
> > Polled I/O will drop data. Interrupt-driven data, even with FIFOs will
drop
> > data.
> >
> > Maybe you could set up a simple protocol, if both have receive and
transmit
> > wired up.
> >
> > A sends 0xAA to B, waits 1 sec checking for 0x55 from B, repeats
> > B sends 0x55 to A when it receives 0xAA from A
> >
> > One thought:
> >
> > A sends 0xAA 0x00, waits 1 sec for 0x55 0xFF from B
> > if no answer, send 0xAA 0x01, wait a sec looking for 0x55 0xFE
> >
> > B receives data from A, returns the complemented data back to A
> >
> > Well, something to play with perhaps. Think of a state machine on either
> > side.
> >
>
> OK, I admit it. I am a dummy when it comes to serial communication. Through

> various literature and that above, I often see "0xAA" and the like. I assume

> the AA portion is a hexidecimal value/address? What does each bit of "0xAA"

> represent?
>
> Thanks
>
>
> [noparse][[/noparse]Non-text portions of this message have been removed]
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject and
Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-03-16 02:00
    In a message dated 3/15/2003 5:40:21 PM Pacific Standard Time, fkerr@u...
    writes:

    > 0xAA and 0x55 are just fun values. In binary they are
    >
    > 10101010 and 01010101
    >
    > Nothing really fancy. Just alternating ones and zeros.
    >
    > Perhaps 0xCC and 0x33 would also be useful.
    >
    > 11001100 and 00110011

    So the "0x" has not meaning?


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-03-16 02:13
    Ox is a way to denote the number is hex and not decimal or binary. 1 hex and
    1 decimal are the same value, but 11 hex is 17 decimal. This prevents
    confusion when specifying a number.

    In the Intel world, 0x is used, while in the Stamp world $ denotes hex and %
    denotes a binary number.

    Original Message

    > > 0xAA and 0x55 are just fun values. In binary they are
    > >
    > > 10101010 and 01010101
    > >
    > > Nothing really fancy. Just alternating ones and zeros.
    > >
    > > Perhaps 0xCC and 0x33 would also be useful.
    > >
    > > 11001100 and 00110011
    >
    > So the "0x" has not meaning?
  • ArchiverArchiver Posts: 46,084
    edited 2003-03-16 02:23
    In a message dated 3/15/2003 6:19:50 PM Pacific Standard Time,
    daweasel@s... writes:

    > Ox is a way to denote the number is hex and not decimal or binary. 1 hex and
    > 1 decimal are the same value, but 11 hex is 17 decimal. This prevents
    > confusion when specifying a number.
    >
    > In the Intel world, 0x is used, while in the Stamp world $ denotes hex and
    > %
    > denotes a binary number.
    >

    Thanks, that clears it up!!!

    Ken


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-03-16 03:32
    Sorry, I guess I missed that part of the question.

    You can display values using Debug in the 3 formats:

    Temp var byte
    Temp1 var byte
    Temp = $55
    Temp1 = %10101010
    Debug "Temp= %", bin(Temp)," $",hex(Temp), " ", dec(Temp), cr
    Debug "Temp1= %", bin(Temp1)," $",hex(Temp1), " ", dec(Temp1), cr
    end

    (Heh actually I haven't used DEC(), I'm just guessing.)

    Dwayne Reid <dwayner@p...> wrote:
    > At 08:32 PM 3/15/03 -0500, smartdim@a... wrote:
    >
    > >OK, I admit it. I am a dummy when it comes to serial communication.
    Through
    > >various literature and that above, I often see "0xAA" and the like. I
    assume
    > >the AA portion is a hexidecimal value/address? What does each bit of
    "0xAA"
    > >represent?
    >
    > Hex number system is 0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f
    >
    > 0xAA is binary 10101010
    > Note the alternating 10 pattern.
    >
    > Another useful pattern is 0x55 - binary 01010101
    >
    > Don't be afraid to ask even basic questions. There are *no* stupid
    questions.
    >
    > dwayne
    >
    > --
    > Dwayne Reid <dwayner@p...>
    > Trinity Electronics Systems Ltd Edmonton, AB, CANADA
    > (780) 489-3199 voice (780) 487-6397 fax
    >
    > Celebrating 19 years of Engineering Innovation (1984 - 2003)
    > .-. .-. .-. .-. .-. .-. .-. .-. .-. .-
    > `-' `-' `-' `-' `-' `-' `-' `-' `-'
    > Do NOT send unsolicited commercial email to this email address.
    > This message neither grants consent to receive unsolicited
    > commercial email nor is intended to solicit commercial email.
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2003-03-16 03:50
    Yeah, I learned something new today while writing some robot code -- had a
    brief brain-fart trying to break a decimal value greater than 255 into a
    high and low byte in hex. Pulled my hair out until I saw what I had done
    wrong.

    Actually, you would just say:

    DEBUG "Temp = %",BIN TEMP,CR

    This would display the TEMP variable in binary format and move the cursor to
    the next line.

    Original Message

    > Sorry, I guess I missed that part of the question.
    >
    > You can display values using Debug in the 3 formats:
    >
    > Temp var byte
    > Temp1 var byte
    > Temp = $55
    > Temp1 = %10101010
    > Debug "Temp= %", bin(Temp)," $",hex(Temp), " ", dec(Temp), cr
    > Debug "Temp1= %", bin(Temp1)," $",hex(Temp1), " ", dec(Temp1), cr
    > end
    >
    > (Heh actually I haven't used DEC(), I'm just guessing.)
Sign In or Register to comment.