rs232

Blitz3D Forums/Blitz3D Programming/rs232

MattG(Posted 2004) [#1]
is there anyway to talk via the com port ? want to make a demo motion platform and use blitz3d.

thanks

Matt


MattG(Posted 2004) [#2]
ok found it .. you just do :

fileout = WriteFile("COM1")


MattG(Posted 2004) [#3]
nope , thats not what i needed , as i need to set baud rate etc...

anyone used the BuildCommDCB() API before ?? come on guys ?

Matt


RepeatUntil(Posted 2004) [#4]
Really?? This works?? Very nice tip!!

Did you really check that you were able to write data to COM1??

EDIT:
Sorry! I didn't see you third post... It would be too simple!!


MattG(Posted 2004) [#5]
i am pretty sure it does work , but i dont know what baud setting it defaults to .. you dont have any controll over it. ( well not that i can see) just looking into dll's that do it at the moment.

Matt


maverick(Posted 2004) [#6]
You can open the com port as a file and you can specify the baudrate it opens too also as part of the filename.
I can`t remember exactly what the file name is but i think it was WriteFile("comnumber:baudratehere,8,N,1") or something similar . I have used this method in the past and it works fine for output at whatever baud rate you like upto the port maximum,,,, BUT do not try to read from a serial port in the same manner , it crashes blitz quicksharp.

The other alternative is to use a DLL which is a far neater way and allows you to read and write to the com ,, plus other goodies like setting the buffers and hanshaking ect :-) Thats the way I do it


MattG(Posted 2004) [#7]
thanks maverick , there must be somthing wrong my end , it seems to work , ie locks the COM port so no other app can use it , but the STAMP2 PIC processor that i have connected to the serial port is not picking up the commands , (it works if i use windows terminal program)

thanks

Matt


maverick(Posted 2004) [#8]
the best way to check that it is working is to use a null modem rs232 lead (can get em for a couple of quid in maplin if your uk) and connect com1 to com2 on your computer ,then run hyperterminal on com2 and use com1 on your blitz program, anything sent in blitz then shows up in hyper terminal.

If your not bothered about that a window pop`s up when the com is opened I have a DLL that i have written a userlib interface for that lets you have full controll over the com port. The only limitation is the popup when the port is initialised this can be removed by paying for the comertial version of the DLL


MattG(Posted 2004) [#9]
i think the dll's sounds like the one i saw , i would love to have a copy of it , plus your userlib's , email mg@...

will give you full credit

thanks

Matt


maverick(Posted 2004) [#10]
Ok your the second person to ask me for the userlib I`ll write a little how to use instruction text then send tt too you . I can only provide you with the shareware version of the DLL (the one with the popup) as I am using the full DLL under a license and although I CAN distribute it with my programs I am not allowed to distribute it with Scource code. The functionality, use and ureslib of the lisenced version is IDENTICAL to that of the shareware version the only difference being a popup when initialising the port.


maverick(Posted 2004) [#11]
****Big sorry`s*****
I just downloaded the latest Shareware version of the RS232 DLL and it has been changed to a 90 day trial as opposed to a popup window and no limitations.
Also after studying the release TXT the has been a function added to the DLL called SioGetCode but for some reason Blitz doesn`t want to see this function.

I will contact the authour of the DLL and enquire about this.


MattG(Posted 2004) [#12]
ok cool maverick , i dont mind about the 90 day trail .. if it works i will buy it , but is it possible to send what you have at the moment (eg popup etc) as i would love to see if my stuff will work ... but if you want to doc it etc ... i can wait......

thanks again

Matt


maverick(Posted 2004) [#13]
Hi yes after consultation with the authours I have got the new version of the DLL working correctly. I am going to document this properly and add the modem function I didn`t bother with in the decls the first time round.

I`m also going to change the function names to make it a little more freindly.


Zenith(Posted 2004) [#14]
Also, the default settings of your com ports are set within the device manager in windows, just open up the Ports (COM & LPT) label, then double click one of the ports to edit its settings. (all of the settings are there I think)