Jump to content

Cockpit builders: Can LUA write directly to COM port?


Recommended Posts

Well, it appeares that there are easy ways to drive analog voltmeters through COM port. One would get an analog voltmeter, remove original scaling and print the scaling of choice, get e.g. angle of atack via LUA to com port, and, walla, you get the Angle of Atack instrument next to your monitor.

 

So can LUA weite directly to COM port?

Thermaltake Kandalf LCS | Gigabyte GA-X58A-UD3R | Etasis ET750 (850W Max) | i7-920 OC to 4.0 GHz | Gigabyte HD5850 | OCZ Gold 6GB DDR3 2000 | 2 X 30GB OCZ Vertex SSD in RAID 0 | ASUS VW266H 25.5" | LG Blue Ray 10X burner | TIR 5 | Saitek X-52 Pro | Logitech G930 | Saitek Pro flight rudder pedals | Windows 7 Home Premium 64 bit

Link to comment
Share on other sites

Hajduk,

My knowledge of LUA is limited, but if LUA doesn't support it directly, I'm pretty sure you can pass values from LUA to the programming language of your choice (C/C++, VB, Java) and have methods in that language deal with the COM port. That's one of the beautiful things about LUA. Do some research on '"Lua/C++ interface" in Google (or similar), and you'll find what I'm talking about.

 

EDIT: Here's a bit of text on registering C function within Lua; the whole section is about the Lua C interface...

http://www.lua.org/pil/26.html

 

Good Luck,

 

-spearsd

 

 

Well, it appeares that there are easy ways to drive analog voltmeters through COM port. One would get an analog voltmeter, remove original scaling and print the scaling of choice, get e.g. angle of atack via LUA to com port, and, walla, you get the Angle of Atack instrument next to your monitor.

 

So can LUA weite directly to COM port?

Link to comment
Share on other sites

I fully understand the principals and am aware that LUA can pass value to other programs written in other programming languages. But that’s all I know about programming. Last time I wrote visual basic code was years ago. And it was very basics stuff.

 

Anyway, I would need a programmer to write numbers to COM port and I could read those numbers through micro-controller such as Basic Stamp and drive a voltmeter with that micro controller.

Thermaltake Kandalf LCS | Gigabyte GA-X58A-UD3R | Etasis ET750 (850W Max) | i7-920 OC to 4.0 GHz | Gigabyte HD5850 | OCZ Gold 6GB DDR3 2000 | 2 X 30GB OCZ Vertex SSD in RAID 0 | ASUS VW266H 25.5" | LG Blue Ray 10X burner | TIR 5 | Saitek X-52 Pro | Logitech G930 | Saitek Pro flight rudder pedals | Windows 7 Home Premium 64 bit

Link to comment
Share on other sites

So, how exactly are you planning on implementing this? Do you want to pass output values (0-255) to a Basic Stamp via an RS232 port and output that passed value to the Basic Stamp's 8-bit D/A port with a connected analog meter? So, you don't need to write the COM port low level, right?

 

Assuming you want to write the serial port high-level... I was unable to find any core Lua support for serial communications, though I did come across LuaX which claims to have full serial hardware control among its many addition extensions. Quite honestly, I'm not sure how/if this can be done in plain-vanilla Lua directly (showing my ignorance of Lua yet again), though it can easily be done in C/C++ and passed in via Lua registered C functions. If I had more time, I'd help whip something up for you in C. Sorry, I can't be of more help to you ;-)

 

-spearsd

 

 

I fully understand the principals and am aware that LUA can pass value to other programs written in other programming languages. But that’s all I know about programming. Last time I wrote visual basic code was years ago. And it was very basics stuff.

 

Anyway, I would need a programmer to write numbers to COM port and I could read those numbers through micro-controller such as Basic Stamp and drive a voltmeter with that micro controller.

Link to comment
Share on other sites

So, how exactly are you planning on implementing this? Do you want to pass output values (0-255) to a Basic Stamp via an RS232 port and output that passed value to the Basic Stamp's 8-bit D/A port with a connected analog meter? So, you don't need to write the COM port low level, right?

 

Exactly! I would use SERIN function of Basic Stamp to receive values through COM port and PWM function (Pulse Width Modulation) to output voltage on I/O basic stamp pin(s). BS2SX is the stamp I got! It has 16 I/O pins. So, theoretically it can drive up to 16 analog voltmeters, or 16 of whatever else you program the stamp for!

Thermaltake Kandalf LCS | Gigabyte GA-X58A-UD3R | Etasis ET750 (850W Max) | i7-920 OC to 4.0 GHz | Gigabyte HD5850 | OCZ Gold 6GB DDR3 2000 | 2 X 30GB OCZ Vertex SSD in RAID 0 | ASUS VW266H 25.5" | LG Blue Ray 10X burner | TIR 5 | Saitek X-52 Pro | Logitech G930 | Saitek Pro flight rudder pedals | Windows 7 Home Premium 64 bit

Link to comment
Share on other sites

Hajduk, I didn't realize you did not need another piece of software at the other end of the cable. So, the program I made might be able to be slightly modified to work with your setup. If you did need another piece of software, it would have meant a quite a bit more programming in C++.

 

If you email me (su27jetfireAThotmail.com) or post in here the data format you need and the data you want to export from Lua, I can take a look at the program I made. I don't think I would have to change that much in my program to make it compatible.

sig36aa.jpg
Link to comment
Share on other sites

You are the man! I will be out for a bussines trip all next week. However, I will get in contact with you as soon as I can.

 

As of this time, I am working on translating Flaming Cliffs manual into Serbian languge. I figure, it will take me approximately three monts to finish the job. So after that goes the cokpit instruments building project. So I will not rush.

 

Besides, I will be in Africa for a month (May). There I will have planty of time to get the info you are looking for.

 

Regards,

Thermaltake Kandalf LCS | Gigabyte GA-X58A-UD3R | Etasis ET750 (850W Max) | i7-920 OC to 4.0 GHz | Gigabyte HD5850 | OCZ Gold 6GB DDR3 2000 | 2 X 30GB OCZ Vertex SSD in RAID 0 | ASUS VW266H 25.5" | LG Blue Ray 10X burner | TIR 5 | Saitek X-52 Pro | Logitech G930 | Saitek Pro flight rudder pedals | Windows 7 Home Premium 64 bit

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...