English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I've asked this question before but got no answers so im gonna simplify the question. What is the best way to send a constant "1" signal through a serial cable with Liberty BASIC? All it needs to do is trigger a transistor to turn a motor on and off. I know, I should use C or something, but im fairly familiar with BASIC languages and the liberty site boasts good hardware interface. THANKS!

2007-08-15 11:28:26 · 4 answers · asked by Legs M 3 in Computers & Internet Programming & Design

Good advice about the diode. Your probably right, its about time I learn C. Any chance you know where to download a free compiler? ;)

2007-08-15 11:36:41 · update #1

If i wanted to make it wireless, could i just set up an ocillator on the cable and add a little to the circuit on the other end or should i amplify the signal?

2007-08-15 11:43:07 · update #2

Ive been thinking of buying something like that for quite a while, and you might have just convinced me to buy one! On another note, its it worth it for certain features to buy a C compiler, or are the free ones adequate? Also, C or C++. I know the latter is newer, and that there is quite a bit of crossover between the two. I gather the main differeneces are simply in sintax, so should I start with C, or with C++?

2007-08-15 11:57:32 · update #3

cool stuff

2007-08-15 15:30:39 · update #4

4 answers

I would recommend using C -- its simple to do and will compile to native code for your platform. Also, if you're building your own controllers that hookup to your serial/parallel port be sure to throw a diode in between them otherwise you might get some back voltage, damaging your port/mobo.

Yes, there are many free C compilers for virtually any platform. I recommend GCC if you're using Linux or Windows. I like the Microsoft Embedded C++ for PocketPC.

As a side note, if you find this kind of thing interesting you may be interested (as I am) in Microcontrollers such as the AtMega 128 -- these little gadgets are small microprocessors (about 33MHz with only 128k of memory) but they have a wide collection of I/O ports you can hookup for control/communication applications. There are existing componetns you can innexpensively buy to connect to these things to add features like GPS, long range wireless communication, etc., etc. Highly recommend it :)

Update: I recommend learning C for operating system tasks (microcontrollers/stuff you're working with now) C++ is just a small jump but there are enough features within it to distinguish it from C. Also, the free/open source compilers are adequate -- no need to spend any $$$.

2007-08-15 11:32:28 · answer #1 · answered by mdigitale 7 · 0 0

The first link below contains code for controlling the RTS line with Liberty basic (you can't use the DATA line as there's no way to keep it at a constant level).

The second link shows a project where people used Liberty to control lights via the parallel port. This gives you up to 8 data lines.

The last two links show a very cheap and easy-to-use RX/TX pair for transmitting a signal. I've used these before to make wireless controllers for game consoles....they work really well! Good luck.

2007-08-15 11:53:04 · answer #2 · answered by Mark F 6 · 0 1

According to http://babek.info/libertybasicfiles/lbnews/nl97/3.htm , the basic outline for what you need to do is this:
1- create an instance of the needed DCB structure
2- open the User.DLL
3- build the DCB
4- open the comm port
5- read or write to the port
6- close the port when done
7- close the DLL
The site has sample code and tutorials.

As to your free compiler question, since you want to stick with windows, why not just grab http://www.mingw.org/ or http://www.cygwin.com/ ?

2007-08-15 12:11:08 · answer #3 · answered by Just Jess 7 · 0 1

For COM1:
OUT &H3FC, 10
to turn on RTS or
OUT &H3FC, 1
to turn on DTR.

&H2FC for COM2:
DTR is Pin 20 on a 25 way serial port and RTS is pin 4 (or 4 and 7 on a 9 way).

You don't need C, you can even do it with debug.

2007-08-15 11:43:50 · answer #4 · answered by Del Piero 10 7 · 0 0

fedest.com, questions and answers