Jump to content


Photo

Rs232 #2


  • Please log in to reply
55 replies to this topic

#41 Recreate

Recreate

    Furry

  • GMC Member
  • 2928 posts
  • Version:GM8

Posted 04 July 2009 - 03:33 PM

You'll have to forgive the fact that I don't know much about serial communication, but I have a few questions.

I bought an arduino microcontroller recently, and I've known that it has the ability for serial communication. However, given my computer lacks a serial or parallel port, as well as most computers, I bought the USB model. Yet, I have the suspicion that it'll still be able to communicate serial messages with the PC.

This is the guide that describes how the arduino is hooked up to the PC:
http://arduino.cc/en/Guide/Windows

This is the reference page on serial functions:
http://arduino.cc/en/Serial/Begin

Edit: Here's a simple tutorial for serial.
http://www.ladyada.n...no/lesson4.html

If there's anything else you'd like to see concerning the arduino's serial communication, I can help find it.

I don't know much of the difference between USB and RS232. Is this beyond the scope of your DLL, even though I suspect that the communication to the arduino is serial when its programed?

The arduino has a chip that creates a virtual serial port to communicate to the arduino.
There is a massive difference between USB and Serial, USB is all digital, Encoded Signals, Serial is not, Its like saying you don't know the difference between a steam powered car, and a solar car :)
I'm getting myself An Arduino Duemilanove, It would be pretty neat if i could get Gm to communicate with my arduino :D

Edited by Recreate, 04 July 2009 - 03:37 PM.

  • 0

#42 Recreate

Recreate

    Furry

  • GMC Member
  • 2928 posts
  • Version:GM8

Posted 21 September 2009 - 10:40 PM

Got myself the arduino, And i almost got it to communicate with my PC, Can someone post a mirror of http://www.filedropp...rduinogamemaker that the guy above my put?
It is blocked on (the current network i am connected to), Its a long story...
  • 0

#43 Buff-Robotix

Buff-Robotix

    Who Took My Pants!?!

  • GMC Member
  • 309 posts

Posted 27 September 2009 - 02:35 AM

Does anyone have the original rs232 dll? I'm having problems with this one
  • 0

#44 FantiX

FantiX

    GMC Member

  • GMC Member
  • 174 posts

Posted 12 November 2009 - 04:52 PM

i need USB support. my device does not register as a com port, but as USB port.
  • 0

#45 Buff-Robotix

Buff-Robotix

    Who Took My Pants!?!

  • GMC Member
  • 309 posts

Posted 14 November 2009 - 01:01 AM

i need USB support. my device does not register as a com port, but as USB port.


Your USB should be registered as a COM port. Check your Device manager in Your control panel for the COM number.
  • 0

#46 FantiX

FantiX

    GMC Member

  • GMC Member
  • 174 posts

Posted 19 November 2009 - 11:30 AM

i need USB support. my device does not register as a com port, but as USB port.


Your USB should be registered as a COM port. Check your Device manager in Your control panel for the COM number.



Yes you´re right! last time i tried, a program was already using the USB device, thats why this dll failed to connect though.
  • 0

#47 Buff-Robotix

Buff-Robotix

    Who Took My Pants!?!

  • GMC Member
  • 309 posts

Posted 20 January 2010 - 08:28 AM

I'm thinking about getting an arduino myself. I thought of a less efficient way of connecting arduino and gamemaker. If arduino can read text files of some sort then you can have gm write arduino commands in a text file then have the arduino program interpret the code and send it to the arduion board. its not direct but it would get the job don.
  • 0

#48 zmaj

zmaj

    GMC Member

  • GMC Member
  • 323 posts

Posted 27 January 2010 - 05:57 PM

I think microcontroller's send's binary data as output... how to read and send that???
I have problems too...
When microcontroller sends data GM receive something, but I can't see what...
Also, when I try to send something to microcontroller , they only blink twice, and that is all...
Same microcontroller work fine with other programs...
Can someone help with this?
  • 0

#49 zmaj

zmaj

    GMC Member

  • GMC Member
  • 323 posts

Posted 29 January 2010 - 07:04 AM

I think microcontroller's send's binary data as output... how to read and send that???
I have problems too...
When microcontroller sends data GM receive something, but I can't see what...
Also, when I try to send something to microcontroller , they only blink twice, and that is all...
Same microcontroller work fine with other programs...
Can someone help with this?

I was been a stupid...
Yes there are a byte's and they are unreadable.. but... ( I was talk about microcontrollers... ) :(
Look these...

CREATE SECTION

if(RS232_CreatePort("COM1",1)!=1) //Try and open Com port 1 with ID 1
{
show_message("Error creating COM1");
game_end();
}
RS232_SetPortProperties(9600,8, 0,1,1)// these settings are setting of microcontroller... 9600= baudrate, 8 bytes are length of the message, etc...
RS232_SetTimeouts(-1,0,0,10,1,1); //Set the read/write timeouts to a typical value
str='poruka: ';
fajl= file_text_open_append('log.txt'); // all put in txt readable file
//***********END OF CREATE SECTION****************************************


STEP EVENT **************************************************
*
str=real(RS232_ReadByte(1)); //Try and read up to 1 character ( byte) form Com1

if real(str)!=-2 {
//if real(str)>64 or real(str)<90 or real(str)=32{ // more another filter for readable characters look the ASCII table for more
slovo=dekoder(str)
file_text_write_string(fajl,string(slovo))
file_text_writeln(fajl);
//}
}
//************************* END OF STEP EVENT *****************************


// DRAW EVENT **********************************
draw_text(20,20,string(str)) // just to see what was happend
// **************** END OF DRAW EVENT ****************


// How to write to microcontroler....
// PRESS <SPACE> EVENT ********************************
RS232_WriteByte(48,1); // write number 0 on the Com Port 1 ( ASCII )
// END OF PRESS <SPACE> EVENT *****************************

// SCRIPT DEKODER *************************************
// Change byte to readable characters for more look the ASCII table...
slovo='';
switch(argument0){
case 32: slovo=' '; break;// space
case 48: slovo='0'; break;
case 49: slovo='1'; break;
case 50: slovo='2'; break;
case 51: slovo='3'; break;
case 52: slovo='4'; break;
case 53: slovo='5'; break;
case 54: slovo='6'; break;
case 55: slovo='7'; break;
case 56: slovo='8'; break;
case 57: slovo='9'; break;

case 65: slovo='A'; break;
case 66: slovo='B'; break;
case 67: slovo='C'; break;
case 68: slovo='D'; break;
case 69: slovo='E'; break;
case 70: slovo='F'; break;
case 71: slovo='G'; break;
case 72: slovo='H'; break;
case 73: slovo='I'; break;
case 74: slovo='J'; break;
case 75: slovo='K'; break;
case 76: slovo='L'; break;
case 77: slovo='M'; break;
case 78: slovo='N'; break;
case 79: slovo='O'; break;
case 80: slovo='P'; break;
case 81: slovo='Q'; break;
case 82: slovo='R'; break;
case 83: slovo='S'; break;
case 84: slovo='T'; break;
case 85: slovo='U'; break;
case 86: slovo='V'; break;
case 87: slovo='W'; break;
case 88: slovo='X'; break;
case 89: slovo='Y'; break;
case 90: slovo='Z'; break;
default: break;
}
return slovo;

// END OF SCRIPT DEKODER ******************************************

// GAME END EVENT ****************************
file_text_close(fajl);
RS232_ClosePort(1)
// END OF GAME END EVENT **********************************

And this metod work....
I was try this metod on the PIC 16F877A microcontroller.... with display and with huge posibilities... :)
tnx for your time.. :lol:

Edited by zmaj, 29 January 2010 - 07:26 AM.

  • 0

#50 deformed thought

deformed thought

    GMC Member

  • GMC Member
  • 104 posts
  • Version:GM7

Posted 30 January 2010 - 05:30 PM

It would be nice if you could please tell me what Rs232 is used for ::lmao::
  • 0

#51 ChIkEn AtE mY dOnUtS

ChIkEn AtE mY dOnUtS

    Pwner of barcodes

  • GMC Member
  • 2409 posts

Posted 30 January 2010 - 06:10 PM

It would be nice if you could please tell me what Rs232 is used for ::lmao::


Google.
  • 0

#52 Fabricio

Fabricio

    GMC Member

  • New Member
  • 1 posts
  • Version:GM8

Posted 18 April 2012 - 02:14 PM

What is the arguments of the functions RS232_WriteString and RS232_ReadString? I'm trying do send and receive strings, but it doesn't work.
Thx!
  • 0

#53 Buff-Robotix

Buff-Robotix

    Who Took My Pants!?!

  • GMC Member
  • 309 posts

Posted 18 April 2012 - 06:38 PM

What is the arguments of the functions RS232_WriteString and RS232_ReadString? I'm trying do send and receive strings, but it doesn't work.
Thx!


RS232_WriteString(str, length, ID)
str is the string to be sent.
length is the length of the string to be sent (string_length(str) )
ID is the ID of the com port that you created and would like to send str to.
Returns the bytes sent, if successful this should be length.

RS232_ReadString(length, ID)
length is the maximum length that can be received, so if you are expecting anything, make it some huge number.
ID is the ID of the com port that you want to receive stuff from, get this from creating the com port.
Returns the string that it receives, returns an empty string if it fails.

RobotiX
  • 0

#54 lukeescude

lukeescude

    GMC Member

  • GMC Member
  • 535 posts
  • Version:GM:Studio

Posted 19 June 2012 - 01:53 AM

Andbna, would it be possible for you to release the RS232 DLL source code?

I need to be able to write any length of packets, and you only have functions for a single byte or 8 bytes.

Thanks!
  • 0

#55 KillerLink

KillerLink

    GMC Member

  • New Member
  • 1 posts
  • Version:GM8

Posted 22 November 2012 - 06:50 PM

Hey there,
most important thing first: Thank you for This wonderful extension! Its epic : D

If got a question: I have the following setup: My PC has a bluetooth Module, listed as COM7. On the other side, there is a Microcontroller with a Bluetoot Module.
If I use Read/Write Byte, everything is fine. (The Microcontroller returns what i have sent him, like i programmed it)

But i also tried to use Read/Write String. For example, i write "Hello World" and only get random chars back, and only one at a time. and if i didnt sent anything, nearby always it reads "€" somehow.
Do you know why? Any Tipps?

Thank you!
  • 0

#56 BluebirdoBluB

BluebirdoBluB

    GMC Member

  • New Member
  • 6 posts
  • Version:GM8.1

Posted 22 March 2013 - 07:06 PM

So quick question, the RS232_ReadByte() has only one argument right? The number of bytes to read from the buffer? So if say, I had one byte on which direction to move a character, and a second byte on whether or not to fire a bullet, it would look like "RS232_ReadByte(2)"? Is there a maximum amount that can be read at once with ReadByte()? A simple explanation of the argument for this function would be much appreciated, thanks.


  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users