473,378 Members | 1,351 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

how to write byte in 8051 Correctly

i have a hex code and need to write it in 8051

if the hex code is
"11 22 33 44 55 66 77 88"
"88 77 66 55 44 33 22 11" (hexadecimal)

but the result is

11 22 33 44 55 66 77 88 FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF

it is should be

11 22 33 44 55 66 77 88 88 77 66 55 44 33 22 11
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF


problem is ...
it can not write second hex code
just only write first hex code

i use serial port , VB6 ,keil C

and my english is very bad...

so i want to tried everyway to find the solution

so plz help me thx...
Nov 16 '12 #1
4 2376
zmbd
5,501 Expert Mod 4TB
And you did not post the code that you are using... when you do so please make sure that you format it using the <CODE/> button.
Also understand, that this appears to be a homework problem... can you please provide some insite as to why you are doing this?
Nov 17 '12 #2
that's not a homework...
it's our project

we use two 8051 chips and have to do read ,erase and write
i'm so sorry i forgot post my code

i want to ask how to send the code(hex)

now our problem is

11 22 33 44 55 66 FF FF FF FF FF FF
FF FF FF FF FF FF 88 88 77 66 55 44

why we can not ...put it on the correct address

when i sending a byte also have to send this byte address?
Nov 23 '12 #3
Expand|Select|Wrap|Line Numbers
  1. out(1) = &H66 'start
  2. out(2) = &H9  'length
  3. out(3) = &H1  'CMD
  4. out(4) = Val("&H" & Mid(codeline, 2, 2))  'addr
  5. out(5) = Val("&H" & Mid(codeline, 4, 2))  'addr
  6. out(6) = Val("&H" & Mid(b(x), 1, 2))
  7. out(7) = Val("&H" & Mid(b(x), 3, 2))
  8. out(8) = Val("&H" & Mid(b(x), 5, 2))
  9. out(9) = Val("&H" & Mid(b(x), 7, 2))
  10. out(10) = Val("&H" & Mid(b(x), 9, 2))
  11. out(11) = Val("&H" & Mid(b(x), 11, 2))
  12. out(12) = Val("&H" & Mid(b(x), 13, 2))
  13. out(13) = Val("&H" & Mid(b(x), 15, 2))
  14. out(14) = Not (out(6) Xor out(7) Xor out(8) Xor out(9) Xor out(10) Xor out(11) Xor out(12) Xor out(13))   'CRC
  15. If (i = z + 1) Then
  16. out(15) = &HAA
  17.  
  18. end if 
  19.  
  20. mscomm1.output=out
Nov 23 '12 #4
Rabbit
12,516 Expert Mod 8TB
It's hard to diagnose because we don't know what codeline is or b(x).
Nov 24 '12 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Steve - DND | last post by:
We are continually receiving timeout, and "Unable to write data to the transport connection" errors while using the System.Net.HttpWebRequest class from an ASP.Net web page. Below are the two...
7
by: PCH | last post by:
I'm trying to pull a data file that has an image (jpeg) embedded in it. I can locate the bytes for the image, but when I try to write it to a file, the image ends up being corrupt! the kb/b...
1
by: Mark | last post by:
Hello. How can I write binary data from byte to some file on disk? Thank you.
3
by: DaveS | last post by:
Hi! I am returning a byte array from a function and wish to print out the values of the array. However, I get Microsoft VBScript runtime error '800a000d' Type mismatch Here is the gist of...
0
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted...
3
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted...
9
by: andy.z | last post by:
If 2 people try to access the same text file at the same time to write to it - what happens in PHP ? What I mean is - presumably the first will be ok - But what will the second person actually...
3
blazedaces
by: blazedaces | last post by:
I was working all day yesterday (and will probably be for most of today) with bytecode where java wrote the bytecode and matlab read it... I had never worked with bytecode in great detail before so...
1
Krantor
by: Krantor | last post by:
Hi all, i am quite new to c# and was wondering if i could get assistance on an issue im having with writing a binary file from the database to my local machine, this is the code i have: string...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.