Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

vb question

Status
Not open for further replies.

Medtronic

New Member
Can you help me to communicate between a 8051 based micro controller and a PC via RS232 ?
I built this µC system some years ago; the PC interface is written in Qbasic.
Everything was all right untill I switched to Win XP.
I'm looking for either a Qbasic version supported by XP or an RS232 diver useable for instance in visual basic.
Thanks a lot in advance
 
this was frequently asked question.
if you have VB you are all set, just use microsoft's comm component (MSCOMM.OCX) there are plenty examples of code, yuo just need to google or ask here if you get stuck.
 
akg said:
in qbasic the program will be tring to access the port using the h/w registers directly, which is not allowed by xp.. u need to go with windows API or better to use mscomm control in vb
hi
thanks a lott for replay
i already switched to vb ad use mscomm , its working under 98 but not
working with XP my question is why and what can i do
 
In my opnion XP is the biggest virus micro$oft has brought out :evil: But if you have the driver for Nigel's software it's called port In/Out and that has an applet for using vb also c++. I haven't tried using it yet so I don't know if it would work but you could give it a try and report back to us if it does work,

Cheers Bryan :D
 
bryan1 said:
In my opnion XP is the biggest virus micro$oft has brought out :evil:

XP is based on Windows 2000 which is based on NT 4.0, which is based on NT 3.5... The problem comes from the fact that people switch directly from the 95/98/ME series to XP and expect it to work exactly the same as the old OSes.

The fact that XP can play games and replace the 95/98/ME OSes 99% of the time is a small miracle. Having to use the API or a third party DLL to access communication ports is a very small price to pay in my humble opinion... :lol:
 
Medtronic said:
hi
thanks a lott for replay
i already switched to vb ad use mscomm , its working under 98 but not
working with XP my question is why and what can i do

I have VB (5 and 6) code that uses the MSComm control under XP with no problem.

Try the following.
Start a new project.
Place a mscomm control and a text box on the form.
Copy this code to the form.

Code:
Private Sub Form_Load()
    MSComm1.RThreshold = 1
    MSComm1.Settings = "115200,n,8,1"
    MSComm1.CommPort = 1
    MSComm1.PortOpen = True
End Sub

Private Sub MSComm1_OnComm()
    Text1.Text = Text1.Text & MSComm1.Input
End Sub

Change the speed, com port parity etc to what your circuit uses.
Run it and let us know the results.

If you have a modem installed then you can try sending it a command. Add the following line to the END of the form load event. (and change port settings etc)

MSComm1.Output = "AT" & vbCrLf

The modem should reply with OK.

HTH

Mike.
 
The reason your having problems with XP compared to 9x is that 9x was not a real OS and was very insecure. In XP (and NT4/2000) no program may access the hardware directly. It has to be done via a API.
 
gregmcc said:
In XP (and NT4/2000) no program may access the hardware directly. It has to be done via a API.

MSCOMM.ocx doesn't have any problem in accessing the serial port in WinXP.
 
we use VB6 and mscomm all the time - and on XP (it's the best OS out there at the moment) never had any problem. note that we keep on buying more PCs (one or two per month) for years, use built in serial ports, variety of multiport cards, virtual ports (usb<>rs232). none of them had any problem. are you sure it's the mscomm you have trouble with and not something else in your program? what are port settings? are you sure there is no other application in xp using com port (ActiveSync perhaps if you have PDA for example)? forget your program, boot into xp and try to open that port using hyperterminal. it will tell you if port is already in use.
 
if mscomm is not working on xp..i would be nice to isolate the problem..is that with ur prg or with the OS.. to check ..use any standard win uthility that access ur specified com port ,utils like hyperterminal,windows dialer etc, with ur settings (baud,parity) etc applied.. if that can open ur com port..then ur prg is to be checked.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top