Serial Software vs Hardware


Yesterday 22:13
Forum: Proton Plus Compiler v3
Starter: gdesantis
Views: 0
Replies: 0
Yesterday 18:35
Forum: The Lounge
Starter: Les
Views: 0
Replies: 11
+ Reply to Thread
Results 1 to 5 of 5

Thread: Serial Software vs Hardware129 days old

  1. #1
    Junior Member Rox's Avatar
    Join Date
    Sep 2014
    Posts
    13
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    6.81 MB

    0 Not allowed!

    Default Serial Software vs Hardware

    Hi, can someone have a look, I have software and hardware serial on the same for..next loop, the software serial is for debugging. The issue is on the hardware serial there's extra zeroes, i can't find where its coming from.

    The srout returns the data's: 1 5 0 1 255 0 , which is correct with length 6 bytes.
    The hrsout returns : 1 0 5 0 0 0 1 0 255 0 0 0


    Code:
    TX_Recieve:                                         ' use only for payload with ack
         spi_array[0] = R_RX_PAYLOAD                    ' Read Rx payload command
         NRF_CSN = 0
         If mbBuffer[2] = 5 Then
            nrf_ptr = bLength  
         EndIf                                  
         GoSub SPI_NRF
         NRF_CSN = 1
         RsOut "Len:",Dec bLength,13
          For i = 1 To bLength                  'Copy spi buffer to modbus buffer
               mbBuffer[i] = spi_array[i]
               HRSOut mbBuffer[i]
               RsOut Dec mbBuffer[i]," "
               
           Next 
         Return
    Thanks in advance.

    Complier Version: 3616

  2. #2
    Fanatical Contributor Tim's Avatar
    Join Date
    Jan 2003
    Posts
    7,564
    Thumbs Up
    Received: 65
    Given: 91
    Total Downloaded
    895.24 MB

    0 Not allowed!

    Default Re: Serial Software vs Hardware

    You don't say what array type mbuffer is. I suspect if you use the Dec modifier before the Hrsout you will get the same results
    Tim

  3. #3
    Junior Member Rox's Avatar
    Join Date
    Sep 2014
    Posts
    13
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    6.81 MB

    0 Not allowed!

    Default Re: Serial Software vs Hardware

    Thanks Tim, Im using a terminal for Hrsout where i can set the Dec Modifier on the terminal itself.. will try Hrsout with Dec modifier this evening.



    Rox

  4. #4
    Junior Member Rox's Avatar
    Join Date
    Sep 2014
    Posts
    13
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    6.81 MB

    0 Not allowed!

    Default Re: Serial Software vs Hardware

    Tim! you are right its sending an ascii, if I put dec modifier on Hrsout they're the same result in ascii.. i will need to convert it to Integer, or else the Modbus Master (UI/HMI) will interpret the reply as error... I still dont know how, i will research, I tried the Val command but failed.

    Rox

  5. #5
    Junior Member Rox's Avatar
    Join Date
    Sep 2014
    Posts
    13
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    6.81 MB

    0 Not allowed!

    Default Re: Serial Software vs Hardware

  6. Solved!

    the extra zeroes are Null terminations, below strips the extra zeroes.

    For i = 1 To bLength
    bTemp = spi_array[i]
    HRSOut bTemp
    next

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Analogue PIR - Hardware and Software
    By rpm26 in forum Proton Plus Compiler v3
    Replies: 6
    Last Post: 27th January 2015, 09:33
  2. Difference between hardware and software USART
    By Zain in forum Serial / Ethernet
    Replies: 2
    Last Post: 14th June 2013, 16:02
  3. Hardware and Software Interrupts
    By ~ Sy ~ in forum The Lounge
    Replies: 4
    Last Post: 13th August 2009, 08:16
  4. hardware/software uart problem
    By richardy in forum Proton Plus Compiler v3
    Replies: 2
    Last Post: 22nd July 2007, 23:28
  5. SPI Software / Hardware
    By dmTulsa in forum Proton Plus Compiler v3
    Replies: 10
    Last Post: 27th October 2006, 21:50

Members who have read this thread since 6th December 2018, 09:08 : 0

Actions :  (Set Date)  (Clear Date)

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