Serial Port in VB .NET 2008 1 Attachment(s) Hi, Since I discovered the free download of Visual Studio .Net Express 2008 over at the microsoft site, I have had a small play bringing some of my VB 6 code over to the new standards. Attached is a small sample I just wrote to communicate with the Serial Port. The s/w enumerates all available ports automatically and data entred into the upper text box is transmitted to the port on clicking the Tx button. The data sent is terminated by vbCr character (chr(13)) but this can be modified in code. Pauses are used to wait for any recieved data to be filled in the buffer, and the Rx data is then added to the RichTextBox. Again these can be modified or replaced by Do..While loops depending on what device you communicate with. This is not the best way of working with VB.NET, I am reading a lot about threading at the moment. However this very simple code works in my application 100%, and hopefully it can give others a small head start. Good luck! Code: Public Class Form1 |
Uses: This program was intended for communicating with some industrial control application, but is working well with mobile phone over AT command set. Tested with SE K850i connected on USB data link (PC Suite driver installed), and set to phone mode. Send AT command "AT" http://i4.photobucket.com/albums/y105/picogsm/AT-1.png Send AT service request "AT*" http://i4.photobucket.com/albums/y105/picogsm/AT-2.png You can find details of AT command set HERE Have fun! |
FBUS command for nokia 1600 Sir would u plz tell how to read nokia firmware detail with usb ....coz i am sending FBUS command to phone command sent sucssesfully but didn't get answer from phone would u plz give some help how to communicate with phone with Visual Basic just read phone type and imei..... Thanks a lot |
Sending SMS using .NET sOURCE Code!!! Hi. As it was not easy for me to find a source code, I will put the page here for make easy for the people: http://www.codeproject.com/KB/IP/Sen...using_Net.aspx if you are using VB8, I recommend u to read this: https://forum.gsmhosting.com/vbb/f83/serial-port-vb-net-2008-a-688748/ |
Code in both links is the same thing, only the top link has the added AT command for sensind SMS. Also, you will have problems using that with most manufaturers mobile, as it is working with TEXT mode SMS. Most big manufacturer support only PDU mode. You can find info how to make PDU text messages at: http://www.embedtronics.com/nokia/fbus.html I will merge this with the sticky thread - to make it more accessable for others :) |
Quote:
The source code posted above is for sending AT commands only, you must modify it to send FBUS commands. AT command = string data FBUS = hex data You can find examples how to send FBUS in visual basic by searching the forum, this can be converted to .NET quite easy :) |
how to read from port in VB6 Sir thanks for reply, actually i am trying to read phones type and imei through FBUS, sending command with MSCOMM in hex values....but didn't get answer from phone how to read data from port and put in string don't get .... data written to com port sucessfully seen in sniffer but unable to catch answer.... |
how to read from port in VB6 Sir thanks for reply, actually i am trying to read phones type and imei through FBUS, sending command with MSCOMM in hex values....but didn't get answer from phone how to read data from port and put in string don't get .... data written to com port sucessfully seen in sniffer but unable to catch answer.... phone is nokia 1600 connected to usb. |
hi sir i've downloaded the attachmet and when i tried to open the program it gives me an error and didn't open. i wanna to interface Ericsson T290i with AT COmmand i want when the mobile recieve a message it converts it to binary code that microcontroller understand it to turn on/off devices. i want to know how could i read message from the program i downloaded coz i tried with hyper terminal it gives me error in the reding msg code. so plz i want u to help me sorry if i ask silly question i havn't worked with visual studio before i hope u understand me. |
you must download also the visual studio package from the first link. There is some core files needed to run the exe |
how to read buffer from comm port Sir when i send command to phone in hex i unable to catch ACK from phone in which event i write code or how i get or read answer from phone plz help |
1 Attachment(s) Seems you are using VB6, so why are you posting your question in this thread? You should make a new, or better still make a forum search. Any way, take the attachment. Its simple com port source code in VB6, very old source. It is already posted in the forum a few times. |
Dave.W, can You explain little more about sending comand via usb and recived answer back procedure? I'm coding on delphi, and i found very small info about that on forum... I've seen on this section some code for Delphi by SEMC, but i can't understand how do that... Thanks... and Sorry, if i post in wrong section... |
Hi JayDi, All I know is in the first post really. You must install SEMC Data suite then the mobile becomes like a virtual com and you can access with serial port control. I suppose there is other levels of communication also. |
is available for delphi ??? |
I think there must be many sources out there for delphi in the net already. Visual studio is a relativly new kind of language, with very few websites helping with serial comms, thats why I post here :) |
thx man it s very interesting for beginners !! br |
thanks man i've worked with t290i and AT Command it works well. now i'll try to make the MCU recieve the msg that the mobile recieve automatically and switch on/off devices |
hi, Dave.W i got this error when I sent this AT Command AT+CPBR=1,250 that command is for phonebook extraction System.InvalidOperationException was unhandled Message="The port is closed." Source="System" StackTrace: at System.IO.Ports.SerialPort.ReadExisting() at SerialPort_Test.Form1.SerialPort1_DataReceived(Obj ect sender, SerialDataReceivedEventArgs e) in C:\Documents and Settings\Administrator\My Documents\Downloads\SerialPort_Test\SerialPort_Tes t\SerialPort_Test\Form1.vb:line 74 at System.IO.Ports.SerialPort.CatchReceivedEvents(Obj ect src, SerialDataReceivedEventArgs e) at System.IO.Ports.SerialStream.EventLoopRunner.CallR eceiveEvents(Object state) at System.Threading._ThreadPoolWaitCallback.WaitCallb ack_Context(Object state) at System.Threading.ExecutionContext.runTryCode(Objec t userData) at System.Runtime.CompilerServices.RuntimeHelpers.Exe cuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) at System.Threading.ExecutionContext.RunInternal(Exec utionContext executionContext, ContextCallback callback, Object state) at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state) at System.Threading._ThreadPoolWaitCallback.PerformWa itCallbackInternal(_ThreadPoolWaitCallback tpWaitCallBack) at System.Threading._ThreadPoolWaitCallback.PerformWa itCallback(Object state) InnerException: |
it is really easier in C# .net , and specially , You can compile and MSL for later compile for linux. |
tnx guys For this Nice topic |
Dave.W can explain how can i send nck codes via usb to nokia bb5 phones, i try to use at comand but not all phones have "Phone to Network Lock" facility Enabled |
thx man it s very interesting for beginners !! |
Dim i As VariantType |
2 Attachment(s) Dim i As VariantType |
Dave.W I want to write an application using visualbasic2008 which will run on my PC and communicate to a mobile phone using AT commands. ( nokia 1202, 1203) like reading phone imei, security code, restore factory state, unlock sp lock |
Quote:
|
cool man. but where to find AT COMMANDS |
Quote:
|
Dave.W its grateful that u have provided me with such a beatiful and simple tutorial. i was in search of such tutorial for long a time. I have managed to add a progressivebar and a timer. I am about to start prepairing gsm AT commands like read imei, firmware version, model , make and so forth. please guide me how to send all AT commands at once. and please can you give me AT commands for " read security code, write flash etc...etc.. |
Quote:
|
can this (JAU Delphi Sources) be converted to vb ? or c++ |
HOW to get device id in VB 2008,bcz in this code only available com port is showing but my question is how i get dtail of attached device or how to filter proper device by serial port in vb 2008. |
Quote:
- Send a command with known response to each port in turn - Monitor response. For example send AT command "AT?" to each port. If Returned data is "ATOK" then you know is connected an AT compatible device. If not then try next port. Now you can check identity of connected device. Good luck. |
Quote:
New Microsoft Word Document.doc can u got my topic and give me pfoper command for that. |
There is no such thing like that using serial ports. You must study how to use USB. You can find source by fr3nsis in the fourm, it will help you. Good luck. |
Hello, I know it has being a long time since this post was created, but I am trying to communicate with an Encoder using Silicom Lab CP210X USB/UART bridge , at first I use a RS 232 class , couldn't get any reply from the encoder ( The hardware is good as the hotel is using it during the day with the C++ application who come with it) , then I tried AnySerialPOrt , a very nice C# app written by Orhan who let you build driver for serial port, still no reply, the format in which the string has to be sent is at follow. The EIA RS232C standard interface is employed to connect ADEL interface network system with the hotel management system. 3.1.2 Data Format Data format: 1 start bit, 1 end bit, 8 data bits, no verification; The communication rate is from 2400bps to 19200bps. 3.2 Data Protocol 3.2.1 Control Character STX (0x02):Tag the beginning of the data. ETX (0x03): Tag the end of the data. ENQ (0x05): Test the connection. ACK (0x06): Response to the end which transmits the data and show that the transmitted data is correct. NAK (0x15): Response to the end which transmits the data and show that the transmitted data is wrong. RS (0x1E): Tag the beginning of the new field (region) and is followed by the field identification code. 3.2.2 Information Format Information format: <STX>ddssff[data]<ETX>cc When the receiving end gets the information complying with the above format, it will respond with “ACK” if the calculated verification is same as the received verification. Otherwise, it will respond with “NAK”. The above responses (ACK and NAK) are applied to check the data integrality. They show neither the data content nor whether the execution result is right or wrong. Information Field Description dd Destination address, target (client) address ss Source address which tags the information source ff Command or answer code [data] Data region (optional) Destination address: 2-byte; virtual value: 00 to 99. Receive the information destination address or designate the client end to execute the commands. Source address: 2-byte; virtual value: 00 to 99 (00 is reserved by the system). Tag the information source. Command code: 1 byte ASCII code. Specify the command to be executed. Check character: 2-byte; Algorithm: Use 0x00 as the seed to do XOR with all the data after STX. The result of each XOR will be used as the new seed for the next XOR. The final 1-byte result will be transformed into a 2-byte hexadecimal ASCII code. Example: STX 0x30 0x39 0x52 ETX C1 C2 First calculation: 0x00 XOR 0x30 = 0x30 Second calculation: 0x30 XOR 0x39 = 0x09 Third calculation: 0x09 XOR 0x52 = 0x5B Forth calculation: 0x5B XOR 0x03 = 0x58 Verification code of the first byte (C1): 0x5 ->ASCII 5 = 0x35 Verification code of the second byte (C2): 0x8 ->ASCII 8 = 0x38 ///////////////////////////////// I build the HEX convert module to XOR the data, when I send a string like <STX>0103E<ETX>CC, I expect a ACK or NAVK back if my dta is incorrect , but herre nothing, just: ======================= <20110403184211.296 SYS> Set timeouts: ReadInterval=100, ReadTotalTimeoutMultiplier=2000, ReadTotalTimeoutConstant=2000, WriteTotalTimeoutMultiplier=0, WriteTotalTimeoutConstant=0 <20110403184251.335 SYS> Purge the serial port: RXCLEAR, TXCLEAR <20110403184257.523 TX> <STX>0103E<ETX>44 <20110403184439.616 SYS> COM port is closed ====================== when checking with a serial monitor the data TX and TX to the enocder from the C encoder software I get those stange ASCSII char : =================== 000043: I/O Request (UP), 29.03.2011 16:47:51.090 +0.0 IOCTL_SERIAL_PURGE: Purge requests 000044: Write Request (DOWN), 29.03.2011 16:47:51.090 +0.0 Buffer size: 0x16 bytes FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 7E ˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙~ FF 00 DF 0B 17 7E ˙.ß..~ 000049: Read Request (UP), 29.03.2011 16:47:51.121 +0.0 Buffer size: 0x1 bytes Status: 0x00000000 7E ...ETC>>>>>>>>>>>>> ================== I think this is coming from the silicom Lab bridge ... I would appreciate any ideas or suggestion or if anyone has worked with Silicom lab bridge before .. Cheer's Alan |
problem in activating com port through usb to com port converter can u pls guide anyone |
waooooooooooooooo i have modified the string to send fbus commands, perfect, thanks dev, my programming skills are advancing |
Quote:
|
how to read data from serial port: sir i have a problem in receiving data through serial port . i have project in i have to receive voltage value through serial port please help me and send coding in vb.net Thanks in advance............... |
In fact dr dre beats studio headphones, the new school days in *******, shandong dongying city in a school in heilongjiang, Harbin minjiang elementary school... Many Chinese school Red dr dre headphones, has a garden and the elements. Even some school brand edge is hung with "Chinese garden" and signs. Many of the details of the book became a classic case of education workers, some teachers will take classmates said to "ZhangDouDou" folding headphone, "WangDouDou", most of the bad character called "steel beans". But SunYunXiao and bestseller, "the good mother is better than a good teacher," the author of YinJianLi all say "China is not true top studio headphones," the garden. |
[img]http://www.mercurialvaporsuperflyii.com/images/****-mercurial-superfly-iii-fg/****-mercurial-vapor-superfly-iii-fg-red-gold-no02011015-********-boots.jpg[/img] **** Mercurial Vapor Superfly Iii Fg Red Gold No02011015 Footbrawl Boots,****** AdiPURE IV Next up in the band of inaperture analysiss is the **** PWR-C 3.10. The abilityCat alternation is advised with one affair in apperception,****** Absolado X, power. And this PWR-C 3.10 absolution avalanche appropriate in line with the tchamp. The big account to this recharter is that **** accumulate it at an allowable amount while ensuring you get a top akin of backbone and achievement. For analysising, **** beatific over a brace of the Babridgement/White/Aged Silver blushway. It took best than I would accept adapted to get these calm ***** torn in. The solebowl in accurate proved to be boxy, with a annealed activity from the aboriginal affair cutting them. I concluded up wearing them about as an accustomed shoe in an attack to alleviate them up. Size astute,****** F50 Adizero, these are not acceptable for advanced bottomed amateurs. If you attending at the cossack from aloft, it absolutely anchorage in on the toes crbistro a actual bound fit. This aswell accepted to actualize a claiming thasperous tebite &n43760f1ba35dc394eb55fbairn117d5ef; my admonition is to in fact adjustment up a bisected-admeasurement to enabiding you get a added adequate fit. |
Wake up Dave. ;) Two spammers needed to be killed. |
Wwwaaoo nice post... Thanks!!! VB.NET ADVANCED! :) |
pls hap HTML code is Off ................................................. |
thanks friend!!!!!!!!! |
does SerialPort in VB.Net supports wavecom? please help me, maybe I am the one who is mistaken Here's the at command code : Code: ATZ |
Serial Port will support every thing based on Serial Protocol. May be you are not sending vbCRLF with commands? Br, Shadab Ahmad |
Hai Shadab Ahmad, thanks for your reply I used your application for modem 1206B/Q2303A Here is the code : Code: Public Class Form1 |
All times are GMT +1. The time now is 16:53. |
vBulletin Optimisation provided by
vB Optimise (Pro) -
vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
- GSM Hosting Ltd. - 1999-2023 -