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.

interfacing PIC16F877A with Visual Basic 6.0

Status
Not open for further replies.

ryuko

New Member
hello

currently i'm working on project that requires me to send input from PIC16F877A to VB 6.0 through serial port.

My question here is how can i use visual basic codes to read input from the serial port (which is the microcontroller).

Please if anyone can help me, send me the codes or any information.



TQ
 
The simplest way is to use the MSCOMM control and a timer to poll the input stream.

I've attached the simplest demo I could muster that will receive data on com1 and put it in a text box. It contains a total of three lines of code so not too scary.

Mike.
 

Attachments

  • RS232Demo.zip
    1.3 KB · Views: 1,313
tq

tq mike.

i've also read from other website.they told me to use the code as follows:

MSComm1.CommPort = 2 ' Set the port number
MSComm1.Settings = "56000,N,8,1" ' Set UART parameters
MSComm1.PortOpen = True ' Required, might lock port
MsComm1.Output = "Text string" ' Send data
Buffer$ = Buffer$ & MSComm1.Input ' Read data

ur code is much simpler. i'll try first.
TQ
 
Last edited:
My code is simpler because I left everything as default. So, it's com1, 9600,n,8,1. To change any of the parameters look at the properties of MSCOMM1.

One thing to note that is not widely known is that the MSCOMM control doesn't work correctly with USB-RS232 converters unless you set MSCOMM1.RThreshold=1.

Mike.
 
if you don't obligate to use VB, i suggest you, use VC# or Delphi. working with thease are very simple than VB, i think.
 
if you don't obligate to use VB, i suggest you, use VC# or Delphi. working with thease are very simple than VB, i think.

I think you are wrong. The OE languages are just so much more confusing that I challenge you to produce the same code that is as understandable.

I posted my version, I look forward to yours..

Mike.
 
I think you are wrong. The OE languages are just so much more confusing that I challenge you to produce the same code that is as understandable.

I posted my version, I look forward to yours..

Mike.

Thank you Pommie,

I think VB is very good for Small programs or simple programs. but, in VC# and Delphi you have more power and ability. Of course, i have not worked with VB much.
 
Thank you Pommie,

I think VB is very good for Small programs or simple programs. but, in VC# and Delphi you have more power and ability. Of course, i have not worked with VB much.

I'm a Delphi user, wouldn't touch C with a bargepole - but VB is fairly easy to understand, and even the early interpreted versions were amazingly quick for an interpreter. You would probably be surprised how many applications, even commercial ones, are written using VB.
 
What makes you think VB is only good for small or simple programs? Anything you can write in C can be written in VB.

I'm still waiting to see you version of the above program in C.

Mike.
 
Hmm.. if I'm not mistaken, nowadays, VB is the same with C# as in what C# can do, VB can also do, which is because of .NET. There have been on going 'arguments' about which language is better, VB or C#.
As for me, I use C# not because it is better than VB, but because when I was studying, I was taught C so the natural progression would be to move on to C#.
 
usb

My code is simpler because I left everything as default. So, it's com1, 9600,n,8,1. To change any of the parameters look at the properties of MSCOMM1.

One thing to note that is not widely known is that the MSCOMM control doesn't work correctly with USB-RS232 converters unless you set MSCOMM1.RThreshold=1.

Mike.

actually i'm using USB-RS232 converter. before this,i've try to interface the PIC but when i run the VB code,my computer will automatically shutdown and restart.tq mike for the information.it might help me.

TQ :):)
 
Last edited:
Interfacing PIC16F84A with computer

hi,
i think am in the right session. i want to interface PIC16F84A to the Visual Basic.net , i want to get a value from the PIC counter and send it to the program ans assign it to a variable?..need help!!
 
yes..the digital input is from PIC

hi,
You could use the PC's parallel port to read the data, using a Visual Basic program.

It would help us if you gave more information in your posts about the problem, instead on these one liners.:)
 
pic to VB6.0

hi,
You could use the PC's parallel port to read the data, using a Visual Basic program.

It would help us if you gave more information in your posts about the problem, instead on these one liners.:)

i'm doing project about parking guidance system.

for this project, i used infrared sensor to detect the presence or absence of cars inside the parking lot.

if there is car the green led will on whereas if there is no car, red led is on

the sensors will give value 1 if it detects car whereas 0 for absence of car.

i need to send the output of the sensors to visual basic 6.0

in the visual basic there will be a form repsenting parking lots.

the form will display the condition of each parking lots whether empty or not.

i'm using 8 parking lots for this project..

i plan to use serial port to interface pic to VB
tq
 
Last edited:
Use the parallel port one of the handshake lines will make a good TTL level input, you'll still need a .dll that allows direct access to it if using XP.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top