Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 24

Thread: Yaesu's serial protocol.

  1. #1

    Default Yaesu's serial protocol.

    Good afternoon,
    i introduce myself, my name is Andrea and i’m writing from Italy. I’m a newbie with the Picaxe and I need some information regarding my project.
    By a Picaxe 08M2 i have to control a Yaesu FT847 rigs with own serial protocol. Each instruction to send the radio consist of 5 bytes, the pause between each byte must be 200mS, the format of the single byte is:

    - start bit - bit0 – bit1 – bit2 – bit3 – bit4 – bit5 – bit6 – bit7 – stop bit – stop bit – Total are 11 bits

    As you see this protocol is different from the protocol of Picaxe that is - 8bit data – no parity – stop bit –

    My question is: how can I write the right code in order to meet the requirements Yaesu’s protocol ??
    I apologize if the topic has already been treated, but have not found anything like.

    Thank you for the help.
    Andrea P. IZ3KXW.

  2. #2
    Senior Member
    Join Date
    Jan 2011
    Location
    UK
    Posts
    4,224
    Blog Entries
    12

    Default

    Welcome to the PICAXE Forum.

    Isn't a stop bit really just the same as idle? The code execution delay introduced by the PICAXE interpreter will be enough to lengthen the stop bit for you. All you need to do is use a separate serout command for each byte and you can use the pause command for the 200ms delay. If a microsecond delay is required, use the pauseus command.

    Example:
    Code:
        serout 0,N2400,(b1)
        pause 200
        serout 0,N2400,(b2)
        pause 200
        serout 0,N2400,(b3)
        pause 200
        serout 0,N2400,(b4)
        pause 200
        serout 0,N2400,(b5)

  3. #3

    Default

    Thank you for the quick response,
    is much simpler than i thougt, tonight i try to write down the code and test it with the radio.
    Ciao. Andrea P.

  4. #4
    Technical Support
    Join Date
    Jan 1970
    Location
    UK
    Posts
    19,943

    Default

    Another technique is to use the scratchpad ('ptr') or the RAM ('bptr'), build up the data to send, and then send it ...

    Code:
      ptr = 0
      @ptrInc = "H"
      @ptrInc = "e"
      @ptrInc = "l"
      @ptrInc = "l"
      @ptrInc = "o"
      Gosub Send
      End
    
    Send:
      b0 = ptr
      ptr = 0
      Do While ptr <> b0
        SerOut .... ( @ptrInc )
        Pause 200
      Loop
      Return

  5. #5
    Senior Member
    Join Date
    Feb 2010
    Location
    Austin Texas (Area)
    Posts
    2,352

    Default

    I looked at the manual for this very nice Transceiver and found this....

    All commands sent from the computer to the transceiver consist of five-byte blocks,
    with up to 200 ms between each byte. The last byte in each block is the instruction
    opcode, while the first four bytes of each block are arguments (either parameters
    for that instruction, or dummy values required to pad the block out to five bytes).
    Each byte consists of 1 start bit, 8 data bits, no parity bit, and two stop bits.
    This tells us that that there can be "up to" 200ms between bytes. This is a maximum value and not a minimum requirement.
    Therefore you will probably will not need to add any delay between bytes using Picaxe serout... since while serout may be specified
    as 8,N,1 the output is actually closer 8,N,2 or even 8,N,3. (The latest firmware adds some extra space between bytes.)

    This means that your code can most likely be simplified to something like:

    Code:
    serout c.2, T9600_4, (b0,b1,b2,b3,b4)    '5 bytes

  6. #6

    Default

    Hello guys,
    here i am again with my project.
    With a picaxe 14m2 I can successfully control the radio with serout,
    this is the code: serout C.4,T4800_4, (0X00,0X00,0X00,0X00,0X00) switch on the RTX
    serout C.4,T4800_4, (0X00,0X00,0X00,0X00,0X80) switch off the RTX etc.etc.
    but now I have another problem, when I ask the RTX to give me back the frequency with the command
    serout C.4,T4800_4, (0X00,0X00,0X00,0X00,0X03) and then the command serin B.1,T4800_4, b0,b1,b2,b3,b4 (the RTX give back 5 bytes)
    I receive only strange numbers, not consistent with the real frequency, ex. b0=253 b1=254 b2=254 b3=254 b4=0.
    I think that is because the protocol of the RTX is “1bit start,8bit data, no bit parity, 2bit stop” and the picaxe can’t read it.
    I already tried with others commands, serrxd and hserin but nothing, same result.
    May be somebody has had the same problem and can help me?
    I thank you for the help.
    Andrea. Iz3kxw

  7. #7
    Technical Support
    Join Date
    Jan 1970
    Location
    UK
    Posts
    19,943

    Default

    Quote Originally Posted by iz3kxw View Post
    I receive only strange numbers, not consistent with the real frequency, ex. b0=253 b1=254 b2=254 b3=254 b4=0.
    I think that is because the protocol of the RTX is “1bit start,8bit data, no bit parity, 2bit stop” and the picaxe can’t read it.
    The PICAXE serial format should be compatible with what the rig sends out. It could be the data is returned too soon for SERIN to be ready. The 08M2 doesn't have high-speed receive into scratchpad so HSERIN might not help but running at a faster speed might.

    Do you have a link to a manual or datasheet detailing the protocol ?

    What you current code is might also help.

  8. #8
    Senior Member
    Join Date
    Jan 2011
    Location
    UK
    Posts
    4,224
    Blog Entries
    12

    Default

    Quote Originally Posted by iz3kxw View Post
    I receive only strange numbers, not consistent with the real frequency, ex. b0=253 b1=254 b2=254 b3=254 b4=0.
    What is the real frequency?

    What are you expecting?

  9. #9

    Default

    Quote Originally Posted by hippy View Post
    The PICAXE serial format should be compatible with what the rig sends out. It could be the data is returned too soon for SERIN to be ready. The 08M2 doesn't have high-speed receive into scratchpad so HSERIN might not help but running at a faster speed might.

    Do you have a link to a manual or datasheet detailing the protocol ?

    What you current code is might also help.
    I tried with HSERIN but the picaxe doesn't receive nothing, with SERIN i changed also the freq to 8, 16 and 30 mhz but nothing changed.

    try to read at this : http://www.ka7oei.com/ft817_meow.html i hope it help to understand something.

    ciao Andrea.

  10. #10
    Senior Member
    Join Date
    Sep 2011
    Location
    Bath,UK
    Posts
    741

    Default

    Hi Andrea. Iz3kxw

    I have successfully controlled my FT897, which uses the same Yaesu protocol and like has been ssuggested added a delay of 104uS (in my case as I use 9600 baud) and this simulates the required extra stop bit. In PICAXE receive mode it works fine as the PICAXE only needs 1-stop bit, but gets two which is in effect a pause during receive.

    I suspect you have a connection/polarity problem on receive, are you using RS-232 (inverted data) or TTL/RS423. You can test your communications by changing freqency or band as the FT will output the change of frequency data and you shoudl be able to display that in debug mode or on a LCD display.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •