Question about sending serial 2 digit HEX commands


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2005
    Posts
    37

    Default Question about sending serial 2 digit HEX commands

    Hi!

    Can someone please tell me how to send 2 digit hex values using a variable in the Serout2 command?

    I am sending file playing commands to a serial MP3 module. There are only 12 tracks. The select case code I show works but I am sure I can achieve the same thing if I can specify the format of the variable "Demo" using Serout2 . Demo is a variable that contains decimal 1 to 12 and I want to send the equivalent of Serout2 MP3data,188,[$01], Serout2 MP3data,188,[$02], Serout2 MP3data,188,[$03], etc. I need 2 hex digits to be sent.

    Will this "Serout2 MP3data,188,[Hex2 Demo]" give me the same results as my select case code or do I need to use this;

    "Serout2 MP3data,188,[IHex2 Demo]"

    I don't have the parts to test anything until Monday but the select case code I tested before.

    Thanks for any advice.


    The code below works;
    'Select Case Demo
    case 1
    Serout2 MP3data,188,[$01]
    case 2
    Serout2 MP3data,188,[$02]
    case 3
    Serout2 MP3data,188,[$03]
    case 4
    Serout2 MP3data,188,[$04]
    case 5
    Serout2 MP3data,188,[$05]
    case 6
    Serout2 MP3data,188,[$06]
    case 7
    Serout2 MP3data,188,[$07]
    case 8
    Serout2 MP3data,188,[$08]
    case 9
    Serout2 MP3data,188,[$09]
    case 10
    Serout2 MP3data,188,[$0A]
    case 11
    Serout2 MP3data,188,[$0B]
    case 12
    Serout2 MP3data,188,[$0C]
    end select

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: Question about sending serial 2 digit HEX commands

    If that works, then so will this ...
    Code:
    Serout2 MP3data,188,[Demo]
    Because your select case is sending Binary, not ASCII Hex.
    The $ sign allows you to format your source code as Hex.
    DT

  3. #3
    Join Date
    Jun 2005
    Posts
    37


    Did you find this post helpful? Yes | No

    Default Re: Question about sending serial 2 digit HEX commands

    Thanks for your reply Darrel.

    So you are saying that "Serout2 MP3data,188,[Demo]" will achieve the same thing, but do I not need to specify the digits such as using Hex2 Demo?

    Thanks.

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: Question about sending serial 2 digit HEX commands

    I don't really know what your MP3 player is expecting.

    I'm just going by your statement that the Select Case works.
    And if that works, then so will the single SEROUT2 line without any HEX modifiers.
    DT

Similar Threads

  1. Hex digit verification
    By kevlar129bp in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 1st December 2010, 19:01
  2. Need help sending a hex serial output
    By cruzn27 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 5th December 2009, 13:24
  3. Help me to sending hex using HSEROUT
    By maverick in forum Serial
    Replies: 2
    Last Post: - 3rd August 2009, 12:52
  4. Sending Commands from Visual Basic about IR to Pic
    By tne_de in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 29th April 2009, 06:09
  5. Sending AT Commands using SEROUT
    By stuart_penman in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 9th May 2008, 20:38

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