I am sorry that I am not well versed in Qbasic.
I am writing a progarm to send data to the serial port in order to control a device which is used in electronics. I must send various characters which is all working except for one problem. I cannot seem to send a CHR$(19).
I am using com port monotoring software to view what is happening. I can send any character to the port, but when I send CHR$(19), is simply skips.
For instance, if I send a string such as CHR$(17); CHR$(18); CHR$(19); CHR$(20), the communication will send three bytes, leaving out the 19.
I am using OPEN "COM1:9600,N,8,!,CD0,CS0,DS0,OP0, RS,RB512,TB512" FOR RANDOM AS #1. I have experimented with other formats, but nothing seems to work.
Any clues?
Sending Data Thru Com Port Problem
- burger2227
- Veteran
- Posts: 2466
- Joined: Mon Aug 21, 2006 12:40 am
- Location: Pittsburgh, PA
Control Character 19 is used in the COM port to designate XOFF to end a transmission. Character 17 turns a transmission on as XON.
Why are you sending control characters? They are used to CONTROL things.
ASCII codes from 0 to 31 are control characters. Send something else.
Ted
Why are you sending control characters? They are used to CONTROL things.
ASCII codes from 0 to 31 are control characters. Send something else.
Ted
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
Thank you for the reply.
I am working with reading and writing to RFID devices using a reader/programmer. I must have the ability to send varied data including all possible 256 possible byte combinations, as the data I am writing can have any value.
I have the origianl software which comes with the device I am working with, and I am sniffing the commands. I am using Qbasic to recreate software which will be dedicated for my use.
The OEM software is sending commands and data, in part being 13hex (CHR$(19) through the port just fine. However, I have now tried for a few hours various ways to send that character with no luck.
Would be grateful for any help.
Thanks.
I am working with reading and writing to RFID devices using a reader/programmer. I must have the ability to send varied data including all possible 256 possible byte combinations, as the data I am writing can have any value.
I have the origianl software which comes with the device I am working with, and I am sniffing the commands. I am using Qbasic to recreate software which will be dedicated for my use.
The OEM software is sending commands and data, in part being 13hex (CHR$(19) through the port just fine. However, I have now tried for a few hours various ways to send that character with no luck.
Would be grateful for any help.
Thanks.
- burger2227
- Veteran
- Posts: 2466
- Joined: Mon Aug 21, 2006 12:40 am
- Location: Pittsburgh, PA
The data link escape character (DLE) was intended to be a signal to the other
end of a data link that the following character is a control character such as
STX or ETX. For example a packet may be structured in the following way:
(DLE) <STX> <PAYLOAD> (DLE) <ETX>.
Send CHR$(16) with both CHR$(17) and CHR$(19) and see what happens.
I've never tried that though.
end of a data link that the following character is a control character such as
STX or ETX. For example a packet may be structured in the following way:
(DLE) <STX> <PAYLOAD> (DLE) <ETX>.
Send CHR$(16) with both CHR$(17) and CHR$(19) and see what happens.
I've never tried that though.
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
- burger2227
- Veteran
- Posts: 2466
- Joined: Mon Aug 21, 2006 12:40 am
- Location: Pittsburgh, PA
You could try sending HEX$ values, but that would require 2 bytes per value. Convert the value with HEX$(number%)
and send two characters. Add a "0" if the length is only 1. When it is received, add the two characters together and
add &H to VAL(&H1F) to get the numerical value. All you will be transmitting is the text numbers
0 to 9(ASCII codes 48 to 57) and A to F(65 to 70) .
Take a look halfway down this link:
http://www.lvr.com/serial_ports_dotnet.htm
and send two characters. Add a "0" if the length is only 1. When it is received, add the two characters together and
add &H to VAL(&H1F) to get the numerical value. All you will be transmitting is the text numbers
0 to 9(ASCII codes 48 to 57) and A to F(65 to 70) .
Take a look halfway down this link:
http://www.lvr.com/serial_ports_dotnet.htm
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0