|
-
Jan 26th, 2000, 02:02 PM
#1
Thread Starter
Lively Member
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>
-
Jan 27th, 2000, 01:00 AM
#2
Frenzied Member
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
[email protected]
-
Jan 27th, 2000, 06:42 AM
#3
PowerPoster
C++ is much faster than C++. Wow! Where can I get this *new* version of C++??
-
Jan 27th, 2000, 07:32 AM
#4
-
Jan 27th, 2000, 07:38 AM
#5
Addicted Member
yes c++ is way faster then vb i know i program with both of them sometimes it alldepends on what i am doing
-
Jan 27th, 2000, 09:25 AM
#6
Hyperactive Member
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!
-
Jan 27th, 2000, 10:14 PM
#7
Lively Member
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
[email protected]
Telephone: +27 15 7816335
ICQ Number : 61636095
Today is yesterday's tomorrow
-
Jan 28th, 2000, 01:35 AM
#8
Frenzied Member
Messed up on what? That C++ is way faster than C++ or thinking that it's way faster than VB?
-
Jan 28th, 2000, 04:13 AM
#9
Hyperactive Member
lol, i used to think VB was written in VB
-
Jan 28th, 2000, 12:02 PM
#10
Addicted Member
Don't know about the serial port, but as for the parellel, for electronics purposes, check out 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
[email protected]
ICQ: 53480225
-
Jan 29th, 2000, 01:38 AM
#11
Frenzied Member
That is interesting, does anyone know exactly how much faster C++ is?
Steve
-
Jan 29th, 2000, 01:55 AM
#12
Thread Starter
Lively Member
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>
-
Jan 29th, 2000, 04:01 AM
#13
New Member
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!
-
Jan 29th, 2000, 04:20 AM
#14
Thread Starter
Lively Member
-
Jan 29th, 2000, 05:17 AM
#15
Addicted Member
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.
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
[email protected]
-
Jan 29th, 2000, 07:34 AM
#16
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
-
Jan 29th, 2000, 08:09 AM
#17
Hyperactive Member
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.
-
Jan 29th, 2000, 09:54 PM
#18
Registered User
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
-
Jan 30th, 2000, 02:38 AM
#19
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:
Code:
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:
Code:
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
[email protected]
[email protected]
ICQ#: 51055819
[This message has been edited by Serge (edited 01-30-2000).]
-
Jan 30th, 2000, 02:54 AM
#20
Addicted Member
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
-
Jan 30th, 2000, 08:46 AM
#21
Addicted Member
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
[email protected]
ICQ: 53480225
-
Jan 30th, 2000, 11:56 AM
#22
New Member
I have proof straight from the top that C is the slower of the languages:
Code:
/*
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
-
Jan 31st, 2000, 06:04 AM
#23
Hyperactive Member
Why is the folder on this post flaming???
------------------
Ryan
-
Jan 31st, 2000, 06:19 AM
#24
Because the topic has more then 15 replies. See the explanations on the buttom of the root thread.
------------------
Serge
Programmer Analyst
[email protected]
[email protected]
ICQ#: 51055819
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|