Serialport readbyte not reading the correct data

Hello everybody
I'm writing a software in VB.net to communicate with an external device with modbus I have a problem while reading data received from the device , to put it in example , using
sp1.ReadByte() the data sent from the device is this :
05-03-04-00-00-01-9F-FE-0B
but I receive this
05-03-04-01-9F-FE-0B
I use this to read Data
Dim reponse As Byte() = New Byte(5 + (2 * nombre_registrre - 1)) {}
For i As Integer = 0 To response.Length - 1
response(i) = CByte(sp1.ReadByte())
Next
It seems like 0x00 are ignored , I tried to send stream of hex manually and Ive got the same problem , always readbyte ignore 0x00 bytes
Why is that ?
thank you so much for your help
Hey :)

you are expecting 9 bytes ..
is  (5 + (2 * nombre_registre - 1))  = 9 ... No that is impossible the answer of this equation will always be even
therefore 
for i as integer = 0 to responce.length-1  
dont read 9 bytes ... it will read an even number of bytes.
Something is wrong in your code
I don't think it's has someting to do with my buffer length , If so why do I receive the other bytes (Not 0x00 bytes)
as I said before , the only bytes I can not receive are 0x00 , I think its something with readbyte() function
Hey :)

Similar Messages

  • N81 does not retain the correct date...

    My N81 got a very strange problem: it does not retain the correct date....
    Usually it's wrong by two days ago....!
    The S.O. Ver. is: 10.0.32 
    Thanks you and sorry for my english...! :-)

    hi there, have you checked that there is a firmware update for your model? v10 sounds like the original firmware for the N81. i would suggest checking on your PC via Nokia Software Updater for any firmware updates. the latest firmware version for the N81, unbranded or not, is v21.  
    If you found this or someone's comments helpful or like what that person has to say, please give some Kudos to their post!

  • My wife's iTunes ID will no longer work.  Tried to reset password but did not get email, tried to reset by answering personal questions' but will not accept the correct date of birth.  Has it been hacked?  How can I fix this?

    My wife's iTunes used ID will not work.  Tried resetting the password, but email was not received.  Tried using personal questions method, but would not accept the correct date of birth, so could not go any further.  Has her iTunes ID been hacked?  How can I fix this?

    Thanks for that advice @randers4.
    I linked through and submitted my info as a "topic not covered" in the iCloud section. After entering the serial number of my MBP it turns out I wasn't eligible for technical support (though I don't think this is hardware related support) and the final suggestion was to take my computer into an Apple store. I called my local Apple reseller and asked for assistance. The customer service rep was very nice but unable to help, so suggested I call Apple Support on 1300 321 456. I did so and, again, spoke to two very polite and helpful customer service people (I was transferred to security services). I didn't have to be on hold to speak to either rep for more than a few seconds! After trying a few different things, he worked out what was happening...
    So, to cut a long story short, to solve the problem in my OP, all I had to do was log out of iCloud in my System Preferences and log back in using my current Apple ID. [Edited to add that I had to sign out of everything I was currently signed in to with my Apple ID before logging out and in again.]
    Problem solved!
    Message was edited by: NotBaconBits

  • Mini Calendar does not show the correct date

    Hi there ,
    in iCal on the bottom left side of the window is the mini Calendar, when I switch between months in this mini Cal,it does not show the correct month anymore and even the button "Today" can not revert the day back ( for example we are now in September, when I open iCal it shows it correctly but after going to next or previous months using the triangles on this mini Cal, the problem comes up ! )

    Maybe it wasn't receiving the correct info from your carrier. You're supposed to turn your phone off once in a while so the carrier can update stuff. I had originally heard that you should do it once a day but I never did that.

  • My Airdrop Photos are not showing the correct date when I receive them from my Family.

    When I recieve photos via Airdrop or Shared Photo Stream they are not in the correct order in my Camera roll. The Dates are off. What is happening here?

    You don't need to delete photos from your camera roll to save on backup sizes, you can turn individual items on and off for back up in your iCloud back up settings.
    Apple States that the last 3 back ups are accessible, which means the photos from your back up may not be removed immediately.
    Being able to back up to the cloud can be very useful, especially if you don't have access to a computer or have infrequent access to one, however unless you specifically need to use iCloud for back up, you will find backing up to iTunes significantly more convenient and possibly more reliable.
    More about iCloud v iTunes Back Up

  • Not getting the correct data at reciever side

    Hi
    I have done mail adapter... My senario is Mail --> XI --> File... In this mail adapter is sender. i have give the url as pop://<ip address> the xi server is picking up the file...
    Source File Is:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:Mail_Message_Type xmlns:ns0="http://mailtofiledemo.com/ravi">
       <Order>
          <Header>
             <Name>Ravi</Name>
             <Address>Vsp</Address>
          </Header>
          <Item>
             <material>Computer</material>
             <units>3</units>
             <price>90000</price>
          </Item>
       </Order>
    </ns0:Mail_Message_Type>
    Target File is:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:File_Message_Type mlns:ns0="http://mailtofiledemo.com/ravi">
    <row>
       <name>Ravi</name>
       <address>Vsp</address>
       <material>Computer</material>
       <units>3</units>
       <price>90000</price>
    </row>
    I have  an unread mail in my Inbox and i have attached the source file to that mail... the server is picking up the file but in receiving side i am not getting the correct target file... i am getting the target file like:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:File_Message_Type xmlns:ns0="http://mailtofiledemo.com/ravi"></ns0:File_Message_Type>
    </ns0:File_Message_Type>
    eventhough if i dont have any unread mails in my inbox i am getting the same file at target side continuosly...so please give me the solution as early as possbile or else my folder will going to be overflow with that target file
    Thanks & Regards
    Ravi Shankar

    Ravi,
    Have to check the Transport Protocol used by internal Mail Server. The parametes you pass to the mail adapter should be same to the internal mail sever where you are trying to send and also check with XIPAYLOAD option.
    If this helps to u. Allot the points please.
    Thanks
    Gowri K

  • The percentage completed UI is not showing the correct data

    Hi All,
    I have received complaints from one of my larger customers that a very long form we have created is not showing the correct % completed at the bottom. They get to the penultimate page (the last page only have three text boxes on) and it state that only 41% of the form has been completed.
    It looks to me like the UI is not updating as the questions are being completed. Rather it waits until you move to the next page.
    This is what makes our form look rubbish - you are being told that you have only completed 41% of the form only to move on to the next page and bam, you only have three more boxes to complete.
    Can somebody help me out here.
    Thanks,
    Bill

    Hi Bill;
    I can take a look at your form but you are right that only the pages are accounted for in the percentage and not the form fields so it can be far off from reality.  If there is skip logic in a form that can make it vary more.  It is likely that it is working "correctly" (considering how we calculate) in your form but if you send me the link to your form at [email protected] I can see if it is not.
    Thanks,
    Josh

  • Not reading the right data value

    So I am reading data from a txt file that I created,in particular I am trying to pull out the first column which is the time data.  When I read it using the "Read from spreadsheet file.vi" I am getting unexpected values. For example when the first value in the file is 1491.044016 it displays 1491.044067, it does this for every value? I thought it may have been a formating issue but I set the vi %.9f on the formating field I'm not sure why it is handling the values this way? Any insights?
    thanks,
    Chris

    Are you using LabVIEW 7.1 or older? In this case, "read from spreadsheet file" uses only SGL precision, which is not sufficient for your desired resolution.
    See also: http://forums.ni.com/ni/board/message?board.id=170&view=by_date_ascending&message.id=315189#M315189
    Solution: Read the file as a plain string and then use "spreadsheet string to array" with DBL as type.
    ... or upgrade to LabVIEW 8.0 or higher.
    LabVIEW Champion . Do more with less code and in less time .

  • Input sream does not read the entire dat

    when i read the response from the socket connection, it reads only the part of the response.
    iS=soc.getInputStream();
    BufferedInputStream bufIn = new BufferedInputStream(iS);
    BufferedReader inp = new BufferedReader(new InputStreamReader(bufIn));
    char[] res=new char[32000];
    inp.read(res,0,res.length);
    why it reads only a part of the response?

    Use readFully() from DataInputStream (this will read bytes, so you'll have to convert that to what you need) or manually force it to read the whole thing (if the array is not full, force the reading of the remaining part)...

  • Issues logging data - does not save the correct data

    I am having 2 issues:
    1. I am having issues with my logging occuring at the right time.
    I have a few things occuring based on the state of 'Injection'. In the case of logging, the following needs to happen:
    When injection is 'True' nothing should occur. When injection goes 'False', data logging should occur. If my injections are 'continuous' the boolean goes:
    True, False, True, False. I would have 2 logging sessions during both 'False' occurrences. What appears to be happening is that the logging occurs during the 'True' state. I am not sure why. 
    2. The logging needs to save a certain amount of samples to the text file. If my 'False' state lasts for 1 second, I need to have 1000 samples. If 2seconds, 2000 seconds, if 1.5seconds, 1500 samples..you get the idea. At current I am only getting 100 samples at a time, at dt of .1
    Code below:

    belopsky wrote:
    Thanks Dennis.
    i seem to have issues w my UI updating when I specifiy samples to read. It appears to lag, which is OK, as long as the timing is still correct..
    Can I acquire continuously, without specifing how many samples, but specify how many samples to read?
    DAQmx Read will return the number of samples requested immediatly if they are available otherwise it will wait for the number of samples requested to be avilable and return the number of samples requested.  This of course, means that the loop will only iterate no faster than "number of samples * Sample rate". (probably what you mistook for "Lag")  IF the number of samples requested is not available before the timeout period DAQmx Read will return with the number of samples available and a timeout in the error cluster so your calling code can handle the exception intelegently.  If the number of samples requested is -1 DAQmx Read returns the number of samples available now without waiting at all.
    Clear?
    Jeff

  • The central syslog is not showing the correct date

    Time     SAP instance    Type Nr  Clt User         TCode           Priority Grp N Text
    95:52:83 ceas4359_DBP_04 BTC  011 500 SYS_LOGISKIS                          F7  7 Spool: Invalid Output Device
    95:52:83 ceas4359_DBP_04 BTC  011 500 SYS_LOGISKIS                          F7  7 Spool: Invalid Output Device
    95:52:93 ceas4359_DBP_04 BTC  007 500 SYS_LOGISKIS                          F7  7 Spool: Invalid Output Device
    95:52:93 ceas4359_DBP_04 BTC  007 500 SYS_LOGISKIS                          F7  7 Spool: Invalid Output Device
    95:54:57 ceas4359_DBP_04 BTC  011 500 SYS_LOGISKIS                          F7  7 Spool: Invalid Output Device
    95:54:59 ceas4359_DBP_04 BTC  011 500 SYS_LOGISKIS                          F7  7 Spool: Invalid Output Device
    95:54:59 ceas4359_DBP_04 BTC  011 500 SYS_LOGISKIS                          F7  7 Spool: Invalid Output Device
    95:54:60 ceas4359_DBP_04 BTC  011 500 SYS_LOGISKIS                          F7  7 Spool: Invalid Output Device
    95:54:71 ceas4359_DBP_04 BTC  011 500 SYS_LOGISKIS                          F7  7 Spool: Invalid Output Device
    95:54:71 ceas4359_DBP_04 BTC  011 500 SYS_LOGISKIS                          F7  7 Spool: Invalid Output Device
    95:54:79 ceas4359_DBP_04 BTC  011 500 SYS_LOGISKIS                          F7  7 Spool: Invalid Output Device
    95:54:86 ceas4359_DBP_04 BTC  011 500 SYS_LOGISKIS                          F7  7 Spool: Invalid Output Device
    95:54:86 ceas4359_DBP_04 BTC  011 500 SYS_LOGISKIS                          F7  7 Spool: Invalid Output Device
    Please suggest , the needful !
    Database system - oracle
    Release - 10.2.0.2.0
    Component version - SAP ECC 6.0

    Only creative cloud subscribers get the new features. If you were a Cloud subscriber your version would be 16.4.0 not 16.0.4.

  • IPhone not showing the correct date on emails

    I have done a search through this forum and haven't come across this problem so I thought I'd flag it as one of you may know a fix.
    When emails are downloaded to my iPhone the date it displays is always one or even two days out. E.G. I downloaded emails today (Monday) and the date showing is Saturday, even though the emails were definitely sent to me today.
    Any ideas?

    What type of email?

  • Not getting the correct date..y?

    hi my pblm is that i am adding some date to a databse..the code like this
    <%@ page language="java" import="java.sql.*,java.text.SimpleDateFormat,java.util.*" %>
    <%
    SimpleDateFormat dateFormat = new SimpleDateFormat("dd-mm-yyyy");
    String d1=request.getParameter("dob");
    java.util.Date utilDob = dateFormat.parse(d1);
    out.println(utilDob);
    java.sql.Date sqlDob = new java.sql.Date(utilDob.getTime());
    out.println(sqlDob);
    st.setDate(12,sqlDob);
    My error is that whatever date i entered i am getting it as anyday/january/year
    the month is always january in the out.println() and in the database as well...y?
    help me plzzz...

    Your format string is incorect. Lowercase m stands for minute. You need an uppercase M for month.
    ie dd-MM-yyyy
    See the [SimpleDateFormat API|http://java.sun.com/j2se/1.5.0/docs/api/java/text/SimpleDateFormat.html] for details.
    Cheers,
    evnafets

  • PCI6534 not reading the data correctly

    Hi,
    I am using PCI6534 to read the digital data from out of ADC. I am using port 2 as the input port and PFI3 as the external trigger ( given to the clock of the ADC). I am not able read the data properly ( missing the first few bits of data).

    Hi,
    I am using PCI6534 to read the digital data from out of ADC. I am using port 2 as the input port and PFI3 as the external trigger ( given to the clock of the ADC). I am not able read the data properly ( missing the first few bits of data).

  • HT204053 How can I delete my iCloud account which I do not remember anything about the information that I entered about 4 years ago. It always asks my birth date but it seems I did not enter my correct date how can I bypass this question???

    How can I delete my iCloud account which I do not remember anything about the information that I entered about 4 years ago. It always asks my birth date but it seems I did not enter my correct date how can I bypass this question???

    You cannot delete the account from the server (partly to prevent the username from becoming available again and some-one else using it to pretend to be you).. Having disengaged your devices from it, go to http://icloud.com and delete any data in there such as contacts and calendars. Then just ignore it.

Maybe you are looking for

  • How can i store the data from the list to MS-Access?

    Hi all, We all know that from alv it is possible to export data to Ms-excel or word or text file. Can anyone tell me how can i store the data from alv or reports to Ms-Access? Thanks in Advance, Abhijit

  • Should I update to adobe creative suite design standard cs6?

    I currently have creative suite design standard cs5.5. I have the cs5.1 of both indesign and photoshop. Currently I can purchase the upgrade for $275. I would like to know if it is worth the money or not?

  • Confused about pointers

    how do pointers work in java? for example - does a linked list just store pointers to objects? so if you add the same object to 2 linked lists, and then use get(index) in the first list to change that object somehow, would the object in the other lis

  • Error in accounting entries in depot process

    Hello all 1. At the time of stock transfer to depots, excise entries are correctly generated and cenvat sales clearing account is getting debited. 2. At the time of billing from depot to the end customer, sales (revenue account) is wrongly credited w

  • Fonts in AI

    I cannot get a font to change from regular to italics. Any help. I have tried finding the Italics font file online but I can't. The font is SavingsBond. And I can get it to work if I use the SavingsBond regular but I need it to be italicized and that