Good Morning!
I'm trying to send a few bytes through my serial port into a remote system, but i'm having a problem... Suposing that i'm trying to send the array of bytes:
68, 00, 00, 68, 00, 00, 00, 00, 80, 00, 01, 81, 00, 16
How to define this array?
Like this?
dim btArray as byte() = { &H68,&H00, &H00, &H68, &H00, &H00, &H00, &H00, &H80, &H00, &H01, &H81, &H00, &H16 }
I've made a test and i saw that &HA = 10 ..., so this is not the way i want this to work. What's the way to get the correct convertion?
Best regards.
4 1205
I think you can just insert those numbers in the curly brackets and they are your bytes, in c# it would be like this: - byte[] mybytes = new byte[] { 68, 00, 00, 68, 00, 00, 00, 00, 80, 00, 01, 81, 00, 16 };
I think you can do something like that? Try that and let me know if it doesn't work.
joedeene
The &H in VB means the followin number is in hex, you appear to want decimals, so just go as joedeene suggested and enter them as:
{ 68, 00, 00, 68, 00, 00, 00, 00, 80, 00, 01, 81, 00, 16 }
Hi Joe!
I've tryed to do what you've told. But there's a problem! Suppose that we put a byte AF inside this array... After compiling the code, is giving an error and don't let me to do what i want.
The main objective is to guarantee that this sequence reaches the remote system:
{01101000, 00000000, 00000000, 01101000, 00000000, 00000000, 00000000, 00000000, 10000000, 00000000, 00000001, 10000001, 00000000, 00010110}
I think you can just insert those numbers in the curly brackets and they are your bytes, in c# it would be like this: - byte[] mybytes = new byte[] { 68, 00, 00, 68, 00, 00, 00, 00, 80, 00, 01, 81, 00, 16 };
I think you can do something like that? Try that and let me know if it doesn't work.
joedeene
Well "AF" would be a HEX value so you would want to use the &h for those values.
10 is 10
0x10 is 16
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Sonoman |
last post by:
hi all:
I am trying to write a program using VB6. This program loops (well, not
yet) and reads a constant data stream from a serial port. Then it
outputs the "formatted" data to a textBox and...
|
by: willie |
last post by:
Hi,
I'm writing a program which requires the use of three serial ports and
one parallel port. My application has a scanning devices on each port,
which I can access fine with pyserial. ...
|
by: lamalice |
last post by:
Hi,
i want read the byte at this adress : 0x03fd.
It's the adress of the Line Status Register of the port COM1.
There is a bit who signal the end of sending.
I need read this bit but i don't...
|
by: joe bloggs |
last post by:
I am writing a mobile application to interface with a legacy system and I am
planning to use web services to communicate with this system. The legacy
system receives data through a serial port. ...
|
by: LongBow |
last post by:
Hello,
Is there a way, in .NET, to determine what are the avialable Serial
(Communications) Ports on a Windows OS and is there a way to determine
that port isn't being use other than attempting...
|
by: Ringo |
last post by:
I'm trying to send numbers over the serial port as bytes, not strings.
What I mean is if I want to send a 255, that should be 1 byte, not a 2
followed by a 5 and a 5. I'm trying to convert a...
|
by: colin |
last post by:
Hi,
Im familiar with c,c++ etc, and Ive spent a week trying to write my
first app in c#
it works reasonably well, but im having difficulty getting to grips with
inter thread signalling etc.
I...
|
by: ASPnewb1 |
last post by:
I'm running into a problem of how to send a string across to another machine via serial port using the serial port class.
The string that needs to be sent is like this,
...
|
by: lutherchp |
last post by:
A baffling end to my week! I open my serial port on my Debian PC (Debian version 5.0.1) I have a decent Null Modem lead going to another PC (I'll call it PC#2), with its port open with the same...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |