PDA

View Full Version : COMM Module?



Lee Allen
22-03-2007, 15:05
There is a reference to a COMM module in the TB version history at the end of 2005
but I cannot find any other information about it and nothing in the help file.

COMMs are a particular interest of mine and I would like to know if this module
exist and where can I find any info about it? Any other way to handle comms
in TBasic other than raw API?

Thanks in advance for any info on this subject

ErosOlmi
22-03-2007, 15:36
Yes, there is a COMM module with the below functions already developed but we had some problems with PB owner.
To make it short PB is saying we have violated compiler licence so we cannot use PB communication fuctionalities in a thinBasic module.
After reading again and again the few lines of PB compiler licence we didn't found any limitation but, you know, our project is a free project and we are not in a condition (at the moment) to try to go against.

What do you need COMM module for?
We can try to develop something in another way.

Let me know.
Eros

_________________________________________________

List of already supported COMM functionalities:


COMM_Get, COMM_Close, COMM_Line,
COMM_Open, COMM_Print, COMM_Recv,
COMM_Reset, COMM_Send, COMM_Set,
COMM_FreeFile, COMM_EOF

List of COMM equates:


%COMM_BAUD, %COMM_BREAK, %COMM_BYTE,
%COMM_CD, %COMM_CTSFLOW, %COMM_DSRFLOW,
%COMM_DSRSENS, %COMM_DTRFLOW, %COMM_DTRLINE,
%COMM_NULL, %COMM_PARITY, %COMM_PARITYCHAR,
%COMM_PARITYREPL, %COMM_PARITYTYPE, %COMM_RING,
%COMM_RLSD, %COMM_RTSFLOW, %COMM_RXBUFFER,
%COMM_RXQUE, %COMM_STOP, %COMM_TXBUFFER,
%COMM_TXQUE, %COMM_XINPFLOW, %COMM_XOUTFLOW


A little test modem script:


uses "Console"
uses "COMM"

dim nModems as long = 9
dim Count as long
dim CountATI as long
dim hComm as long
dim nBytes as long
dim sBuffer as string

for count = 1 to 9
hComm = comm_freefile
console_writeline("Opening COM" & Count & " as hComm=" & hComm)
comm_open("COM" & Count, hComm)
if err = 0 then
console_writeline("...open ok.")

for CountATI = 1 to 5
console_writeline("Now sending ATI" & CountATI)
comm_print(hComm, "ATI" & CountATI)
SLEEP 1000 ' delay for modem to respond
nBytes = COMM_Get(hComm, %comm_RXQUE)
COMM_recv(hComm, nBytes, sBuffer)
console_writeline(sBuffer)
next

console_writeline("...closing port COM" & Count)
comm_close(hComm)
else
console_writeline("Error: " & err)
end if
next

console_writeline("----------------------------------------")
console_writeline("End testing. Press any key to finish.")
console_writeline("----------------------------------------")

Lee Allen
23-03-2007, 01:43
OK to know the reason for my interest in COMM module you need the background.

My main work is using computers for industrial applications, control and testing etc. I was attracted to ThinBasic because it is aimed at automation and is simple for users to use and understand. I want to investigate how far I can take this. My current project is developing functionallity in a hardware device called The Mule. The Mule is a unique device which allows one computer to control another computer. Using the Mule you can interface to any existing application or process even if not originally intended for automated control.

Thin Basic is exciting because many of the people I work with are busy engineers who understand computer technology but do not have the time to learn new systems they just want to get the job done. Thin Basic is good for them because it is easy to learn at the basic level yet provides a host of functionality at a higher level when needed. To help them all I need do is link TB and The Mule.

I have already developed a low level DLL for basic control. It contains COMMs and a specialised command interpreter for a scripting language we call Bray. Bray does a good job of simplifying communications with The Mule but lacks many of the basic functions of regular computer language like loops, decision making, calculation etc.

Rather than spend my time building these functions into Bray I decided a better way would be to hook into existing languages. We have already started to develop interfaces with a number of computer languages including Thin Basic (see link below).

To control the Mule hardware we work through the COMM port or USB port. I was interested to know what COMMs facility might already be available through TB. I can use API functionality if necessary but always look for the easist way first !

Reference web links...
Mule hardware: http://www.barcodeman.com/altek/mule/
Bray script interface: http://www.barcodeman.com/altek/mule/bray/braydll.php

ErosOlmi
23-03-2007, 05:35
Lee,

it is very interesting and I also see you did a great job with thinBasic. We are honored to see a thinBasic dedicated page in your web site.
For us the best feedback is discovering that our language is used for real life applications. Even if now thinBasic can be considered a general scripting language, its development started some years ago exactly for that: automation in real everyday problems.

Well, back to the issue. Because you already seems a PB customers, you can consider the option to write a new thinBasic module using thinBasic SDK for Power Basic. As PB customer you will not have licence problems on this. SDK is included into thinBasic installation and you will find it in SDK directory under thinBasic installation path. Just in case I've sent you a mail with SDK attached. All thinBasic modules are developed using thinBasic SDK for Power Basic so I suppose you will have enough interfaces to start. We can support you step by step in this development and, if needed, we can also add new interfaces to thinBasic Core. More, TBGL and TBDI modules have been developed respectively by Petr and Mike using SDK so I'm quite confident you will have no problems with SDK for PB.

Let me know what do your think about it: thinBasic_Mule.dll module.
Eros

kryton9
23-03-2007, 06:06
Interesting links and site. I am glad Eros mentioned the thinBasic page on your site. I dug around and see you already have a nice example.

I am remember reading about thinBasic's history in other posts and I remember Eros saying that thinBasic started just for this type of automation control. Looks like a perfect match!!

Lee Allen
24-03-2007, 19:21
Thanks for your encouragement guys. I will take a close look the SDK to see what can be done.