Click to See Complete Forum and Search --> : I recently saw a topic comparing VB to C++....
cvaden
Jan 26th, 2000, 01:02 PM
It was stated that VB can 'almost anything that C.. can do. If this is the case then my question is this:
1. Can I talk through the serial port to a non-telecom device, i.e. Homemade remote..?
Basically send a 5+ volt pulse to some sort of J/K and turn on a light for example.
2. How can I determine which pin I am sending data on and can I control this?
3. What type of data can I send?
4. And lastly, can all of this be done through a parallel port? Mainly, desirable because of it's bidirectional capabilities.
Any information would be greatly appreciated!
<c>
Buzby
Jan 27th, 2000, 12:00 AM
Any programming language worth it's salt can access API calls - and I think it's these you will need to use to talk directly to the parallel port in this way. Search the net for API websites or get a book from the library - or, if you know which API calls you need then run the API TEXT VIEWER applet provided with VB to copy and paste the API call definitions into your project.
------------------
Mark "Buzby" Beeton
VB Developer
BuzbyB@HotMail.Com
chrisjk
Jan 27th, 2000, 05:42 AM
C++ is much faster than C++. Wow! Where can I get this *new* version of C++?? :)
DiGiTaIErRoR
Jan 27th, 2000, 06:32 AM
C++ is faster then C++! BUT!!! is C++ faster then VB?! ;)
------------------
DiGiTaIErRoR
VB, QBasic, Iptscrae, HTML
Quote: There are no stupid questions, just stupid people.
XxEvilxX
Jan 27th, 2000, 06:38 AM
yes c++ is way faster then vb i know i program with both of them sometimes it alldepends on what i am doing
Juan Carlos Rey
Jan 27th, 2000, 08:25 AM
Hi, cvaden.
Nobody mention de parallel port question.
Try Inpout32.dll. It can be found (among many other places) in:
http://www.lvr.com/parport.htm
Also check Jan Axelson's page on parallel port tutorials.
------------------
I wish I was patient... RIGHT NOW!
FirstKnight
Jan 27th, 2000, 09:14 PM
Hm...I could tell you all about the Win32 API and how to use it, but then someone at VB-World would be without a job. So I'll just tell you the easy way. I had a similar project, in wich I wanted to open a electronic gate after a user was verified. So I asked a friend of mine, to design a simple device that works with a relay switch which is activated through a EPROM. What basicly happend is that the device plugs into a COM Port and all I had to do to open the gate, was send the character "a" to the COM port.
Maybe you know someone that could build you something like that, coz it makes things a lot easier.
------------------
Hennie Pieterse
Senior Programmer
Datcor International
hennie@nix.co.za
Telephone: +27 15 7816335
ICQ Number : 61636095
Today is yesterday's tomorrow
JHausmann
Jan 28th, 2000, 12:35 AM
Messed up on what? That C++ is way faster than C++ or thinking that it's way faster than VB?
KENNNY
Jan 28th, 2000, 03:13 AM
lol, i used to think VB was written in VB
:)
MicahCarrick
Jan 28th, 2000, 11:02 AM
Don't know about the serial port, but as for the parellel, for electronics purposes, check out www.aaroncake.net (http://www.aaroncake.net) He has a bit of info on programming the parallel port for electronics applications in both VB and QB.
------------------
Micah Carrick
http://micah.carrick.com
micah@carrick.com
ICQ: 53480225
SteveCRM
Jan 29th, 2000, 12:38 AM
That is interesting, does anyone know exactly how much faster C++ is?
Steve
cvaden
Jan 29th, 2000, 12:55 AM
I just wanted to thank the few people that actually addressed my question...it has helped a lot!
Also, I wanted to say to people who have been discussing the nonsense....I didn't know I could learn something from nothing!
I never stopped to think what language the VB app itself was written in. Even in nonsense, wonders never cease!
<c>
MrChunky
Jan 29th, 2000, 03:01 AM
Ohh...look at that flaming icon!!! Chunktastic brothers and sisters!
Sorry, needed to be said. And now you can disable Smilies if you need to. Fantastic! I'm in super chunky VB HEAVEN!
------------------
Regards,
The Chunkster
I appologise for my extrovert behaviour
Remember, Mr Chunky is funky!
cvaden
Jan 29th, 2000, 03:20 AM
Why is my Icon on Fire?
PhilipG
Jan 29th, 2000, 04:17 AM
I do Hardware I/O, Serial, and Parallel projects all the time using VB. First of all, Hardware I/O CANNOT be accomplished using the tools shipped with VB. However, you can get a simple io library from www.lvr.com/parport.htm. (http://www.lvr.com/parport.htm.)
VB has built in Serial comm functionality through the MSComm control. It even handles hardware handshaking signals and of course you can use it to manipulate ANY hardware connected to the PC's Com port.
VB has NO built in parallel functions, although when you think about it, a parallel is nothing more than an address right? So again, grab you a IO library from Jan's page above and use the address of your parallel (378H or whatever)
VB has the ability to do USB communications through the API. In the future, USB will be pretty common for hardware interfacing.
VB is slower than C++, but C is faster than C++, but Assembly is faster than C. Depends on how time critical your hardware is as to what language you use. Today, with 800Mhz computers, I haven't found a single project of mine that needed anything faster than VB.
Take it easy
------------------
HTH,
Philip
phgarman@home.com
I am in TOTAL agreement with PhilipG. I couldn't have said it better myself.. hehe..
Assembler is where it all started Bay-Bee... :)
Knight Vision
Juan Carlos Rey
Jan 29th, 2000, 07:09 AM
Phillip, that was the URL I gave before...!
As for speed, I think an Indy car is faster than a family van, and a Dragster is still faster than an Indy, but which one would you choose to go midtown?
Speed in programming is sometimes not determined but the language itself but the way in which you design your app, and besides that, speed is totally useless in certain kind of programs. Most of the time the processor is waiting for the user to select an option or input a text, and the processing times is totally out of question.
JeffSM
Jan 29th, 2000, 08:54 PM
why C++ is faster then VB :) ?
Internal code of C++
Public Function RTrim(c)
....
commands...
....
End Function
Internal code in VB:
Public Function RTrim(c)
MSDalay()
....
MSDalay()
commands...
MSDalay()
....
MSDalay()
End Function
Jefferson
Serge
Jan 30th, 2000, 01:38 AM
I can give an example of comparison between VB and C++. This example is simply to test loops in VB and C++.
I wrote a For...Next loop in VB from 1 to 1000000 (million). I set the timer and BOOM....it took 52 Milliseconds.
Then I did the same thing in C++.....BOOM.....it took 10 milliseconds.
Then for testing purposes, I inserted If condition inside of that loop, so it looked something like this:
Dim i As Long
For i = 1 To 1000000
If i =50 Then
'I didn't put any code inside of the IF
End If
Next
As you can see I didn't put anything inside of the If condition.....and....BOOM...it took 513 milliseconds (10 times more).
i did the same thing in C++ so it look something like this:
void CMyDlg::OnButton()
{
int start;
int finish;
int i;
start = GetTickCount();
for (i=0; i<100000; i++)
{
if (i/10 == 1)
{
}
}
finish = GetTickCount();
finish = finish - start;
char str[15];
_itoa(finish, str, 10);
MessageBox(str);
}
Whoa.....it took only 13 milliseconds.
So, you can see that difference as simple as loops is dramatic.
Just my $0.02
P.S I tested it on PII-400 128MB RAM.
------------------
Serge
Programmer Analyst
sdymkov@microage.com
Access8484@aol.com
ICQ#: 51055819 (http://www.icq.com/51055819)
[This message has been edited by Serge (edited 01-30-2000).]
PhilipG
Jan 30th, 2000, 01:54 AM
One note,
The original post was about hardware\software differences between VB and VC++.
When your hardware demands that a signal be there exactly 50ms from a byte of data being sent...this is a very different situation. Even C++ can't guarentee that.
From my experience, I recommend you use the highest level language you can get away with. When working your way up the chain, file size increases and speed decreases, but programming is simplified.
It's kinda the programmers decision as to which tool is the best for the situation. In my experience, hardware interfaced to a typical x86 can typically be handled through VB just fine. C++ is good stuff for hardware and byte manipulation. C and Asm are VERY cumbersome for writting Windows Apps, but if your app is a dos program, I highly recommend C.
Sorry for yet another post to this flaming thread, but I just felt the thread was heading down the wrong direction...Although we could start another post about C++\VB Speed differences.
Phil
MicahCarrick
Jan 30th, 2000, 07:46 AM
Well said phillip. Speaking of assembly ... I'm an electronics student, know where i can find some good assembly resources?
------------------
Micah Carrick
http://micah.carrick.com
micah@carrick.com
ICQ: 53480225
Tyler C
Jan 30th, 2000, 10:56 AM
I have proof straight from the top that C is the slower of the languages:
/*
TOP SECRET Microsoft(c) Code
Project: Chicago(tm)
Projected release-date: MAY 1998
$History$
*/
#include "win31.h"
#include "win95.h"
#include "evenmore.h"
#include "oldstuff.h"
#include "billrulz.h"
#define INSTALL = HARD
char make_prog_look_big[1600000];
void main()
{
while(!CRASHED)
{
display_copyright_message();
display_bill_rules_message();
do_nothing_loop();
if (first_time_installation)
{
make_50_megabyte_swapfile();
do_nothing_loop();
totally_screw_up_HPFS_file_system();
search_and_destroy_the_rest_of_OS/2();
hang_system();
}
write_something(anything);
display_copyright_message();
do_nothing_loop();
do_some_stuff();
if (still_not_crashed)
{
display_copyright_message();
do_nothing_loop();
basically_run_windows_3.1();
do_nothing_loop();
do_nothing_loop();
}
}
if (detect_cache())
disable_cache();
if (fast_cpu())
{
set_wait_states(lots);
set_mouse(speed, very_slow);
set_mouse(action, jumpy);
set_mouse(reaction, sometimes);
}
/* printf("Welcome to Windows 3.11"); */
/* printf("Welcome to Windows 95"); */
printf("Welcome to Windows 98");
if (system_ok())
crash(to_dos_prompt);
else
system_memory = open("a:\swp0001.swp" O_CREATE);
while(something)
{
sleep(5);
get_user_input();
sleep(5);
act_on_user_input();
sleep(5);
}
create_general_protection_fault();
}
Like that? Hehehehehe. ;)
Tyler C
Gimpster
Jan 31st, 2000, 05:04 AM
Why is the folder on this post flaming???
------------------
Ryan
Serge
Jan 31st, 2000, 05:19 AM
Because the topic has more then 15 replies. See the explanations on the buttom of the root thread.
------------------
Serge
Programmer Analyst
sdymkov@microage.com
Access8484@aol.com
ICQ#: 51055819 (http://www.icq.com/51055819)
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.