Help in sending hex string using serout


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2008
    Posts
    65

    Default Help in sending hex string using serout

    Hello everybody,
    I'm trying to send hex values with SEROUT, unfortunately I'm getting errors with the syntax and also tried to use
    Code:
    SerOut PortC.6,84, ["0x02 0x52 0x04 0x0b 00 0x61 0x0A 0x4D 0x6f 0x62 0x6f 0x74 0x20 0x49 0x49 0x49 00 0x03"]
    hope someone here can help..

    regards,
    mbox

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,795


    Did you find this post helpful? Yes | No

    Default

    The command that you posted, is not correct. Use modedefs.bas with the Serout and at mode the nams like T2400 or N9600 etc. Look at the manual for he correct syntax.

    Now about the numbers, since they are inside "" they are treated as a long string message.

    Ioannis

  3. #3
    Join Date
    Oct 2008
    Posts
    65


    Did you find this post helpful? Yes | No

    Default

    Hello Ioannis,
    Thanks for the reply....
    Quote Originally Posted by Ioannis View Post
    The command that you posted, is not correct. Use modedefs.bas with the Serout and at mode the nams like T2400 or N9600 etc. Look at the manual for he correct syntax.

    Now about the numbers, since they are inside "" they are treated as a long string message.

    Ioannis
    Here is the whole code
    Code:
     Include "modedefs.bas"
    CLEAR	
     TRISC = %10000000'set TX (PORTC.6) to out, rest in
     TRISB = %00000000
     PortB = %00000000
     pause 20
     SerOut PortC.6,T9600, ["0x02 0x52 0x04 0x0b 00 0x61 0x0A 0x4D 0x6f 0x62 0x6f 0x74 0x20 0x49 0x49 0x49 00 0x03"]
     pause 10    
     SerOut PortC.6,T9600,["0x02 0x52 0x66 00 00 0xb8 0x03"]
     pause 10
     Serout PortC.6,T9600, ["0x02 0x52 0x04 0x0b 00 0x61 0x0A 0x4D 0x6f 0x62 0x6f 0x74 0x20 0x49 0x49 0x49 00 0x03"]
    Can you help me send the hex values in the proper format?

    regards,
    mbox

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Take a look at SEROUT2.
    Then you can format it something like this
    HEX 42, HEX 24, ...
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,795


    Did you find this post helpful? Yes | No

    Default

    And note that with Serout2 that Dave showed you, a HEX modifier can have a digit also impying the number of digits to follow.

    HEX2 means 2 hex digits etc.

    Ioannis

  6. #6
    Join Date
    Oct 2008
    Posts
    65


    Did you find this post helpful? Yes | No

    Default

    Thanks everyone for the responce... I finally got it...
    I use this in my code to send
    Code:
    SerOut2 PortC.6,84, [$02,$52,$27,$06,$00,$7F,$12,$13,$23,$17,$09,$00,$03]

Members who have read this thread : 1

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