Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Serial Port access in Dark Basic ?

Author
Message
Test Engineer
16
Years of Service
User Offline
Joined: 7th Aug 2008
Location:
Posted: 8th Aug 2008 00:07
I purchased DB many years ago at 1.12. I need to do a project to create a paint type program on a grid of 64x32 with 4 colors (black, red, green, yellow). It is for a LED Display board I wrote code for in BASIC using a Parallax SX48/52 micro-controller. I would like to have a graphics gui that the user can "paint" their picture and then send the picture DATA of the 64x32 grid and color out to the serial port so that the micro-controller can read the data in. I currently use a text file with the character or display DATA and color codes and then SEND it as a TEXT file across Hyperterminal at 38400 8-N-1 No Flow to the micro-controller. The attached picture is a modification of the display that I connected a real time clock chip - but I want to be able to send lines, circles, etc.. This works but using a text file is a bit boring and I would like to create a 3 or 4 color GUI to do this.

Can DB support the serial port now? Do I need to get DB Pro? Can I upgrade with a discount if needed? Is there any example paint type program available to study that someone created?

I wanted to stay away from VB 6.0 as DB has such a cool graphics look and it has even been much longer since I used VB 6.0.

Comments and help please.

Thanks,

Tim Gilmore

Attachments

Login to view attachments
Pixelator
17
Years of Service
User Offline
Joined: 8th Jul 2007
Location: here
Posted: 18th Aug 2008 17:11
1. i have loads of parallax products aren't they great.

2. use c, prefferably c+ or c++. Darkbasic is much to high level for that unfortuntely. it is desined for making games, so the serial , game , or usb ports are only used for game controllers like joy sticks.

also, if ya want a challange go for assembly code.

Your signature has been erased by a mod
Test Engineer
16
Years of Service
User Offline
Joined: 7th Aug 2008
Location:
Posted: 18th Aug 2008 17:20
Well unfortunately I do not know C programming - just BASIC type languages. I was thinking of Visual Basic 6 as I used that about 10 years ago but I wanted to have a cool look with a paint brush palate of 4 colors (red, green, orange, black/off) and thought Dark Basic Pro would be the answer using a DLL for the Serial Port access. I'm not doing anything spectacular with the serial port currently with Hyperterminal. 38400, 8 N 1 NoFlow. No CTS, DTS, just Tx and Rx only.

Comments?
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 18th Aug 2008 20:10 Edited at: 18th Aug 2008 20:18
In theory, you should be able to send your data to the serial port if you have DBC using the Net Game connection functions. All you're doing is sending and receiving data which is what the functions do. If you have DBC already, try the following code to see if you can at least detect the available communication ports on your PC:



Check out this tutorial by TDK_man . It is about multiplayer commands which are the commands used for new connections including serial connections. You would have to adapt the commands to your purposes:

http://forum.thegamecreators.com/?m=forum_view&t=59539&b=10

Enjoy your day.
Pixelator
17
Years of Service
User Offline
Joined: 8th Jul 2007
Location: here
Posted: 19th Aug 2008 22:07 Edited at: 19th Aug 2008 22:11
oooohhh, i never thought of using the internet game commands to send data because i only use ip, not serial. genious. now if i could acctually use the multyplayer commands...


[edit] you will need to upgrade to at least 1.13 enhanced to use the multyplayer commands tho. while your at it might as well just get 1.20 instead.

Your signature has been erased by a mod
Pixelator
17
Years of Service
User Offline
Joined: 8th Jul 2007
Location: here
Posted: 19th Aug 2008 22:38
oooohhh, i never thought of using the internet game commands to send data because i only use ip, not serial. genious. now if i could acctually use the multyplayer commands...

Your signature has been erased by a mod
Test Engineer
16
Years of Service
User Offline
Joined: 7th Aug 2008
Location:
Posted: 20th Aug 2008 22:39
I tried using the program in Dark Basic Professional and it just brought up a blank black screen for a few seconds and then dropped the blank black screen down exposing the windows background.

I have never used DB Pro and haven't used DB alone in over 4-5 years. It appears that something should have printed but I saw nothing. Anything I should have seen?

Thanks.


sync on
sync rate 60

free net game

rem list the possible connection types
perform checklist for net connections
lastcon=checklist quantity()
rem assign the connections to our own array
dim connection$(lastcon)
for con=1 to lastcon
connection$(con)=checklist string$(con)
next con

rem list the connections and allow the user to choose one
for con=1 to lastcon
print con;": ";connection$(con)
next con
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 24th Aug 2008 05:31
Hi,

In Dark Basic Classic the screen looks like the attached file on my PC

Enjoy your day.

Attachments

Login to view attachments
Pricey
22
Years of Service
User Offline
Joined: 22nd Feb 2003
Location:
Posted: 27th Aug 2008 00:48
I think the network commands in DBC use DirectPlay which will only let you send a pre-defined data format through the port designed for communicating with other computers using DirectPlay.

What you want to do is send low-level bit code through the port to communicate with your controller right? DirectPlay just isn't flexible enough to allow you to do that.

If I was you, I'd look around for a DLL to enable you to do this, maybe linking to a Windows system DLL will give you the power? This is possible, if not, you'll just have to code your own DLL to do it, this will be hard but ultimately will give you the most flexibility, as a tailor made DLL will do exactly what you want to do allowing you to combine the low-level power of C++ with the graphical power of DBC.

Attila
FPSC Reloaded TGC Backer
20
Years of Service
User Offline
Joined: 17th Aug 2004
Location:
Posted: 29th Sep 2008 04:33
try to open "com1:" as file

a.e.


then use write byte or write string to put data onto the port
Pixelator
17
Years of Service
User Offline
Joined: 8th Jul 2007
Location: here
Posted: 1st Oct 2008 03:38
actually, you could send bit code , i think, if you used a memblock and then sent that but im not sure because i am new to memblocks (just got 1.2) so im not sure if they have a heading or not.

Your signature has been erased by a mod

Login to post a reply

Server time is: 2025-06-07 08:27:04
Your offset time is: 2025-06-07 08:27:04