Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

BASIC relay programming

Status
Not open for further replies.

TheFamousCash

New Member
I have no knowledge about "real" programming but have written a program in BBC BASIC which works well but I need to operate a UDIN 8-R relay unit (bought from Audon) from my program.
The unit works with the supplied software but I cannot translate the VB code to BBC BASIC.
Any advice please?

The Cash.
 
I don't anything about BBC basic, but the hardware doesn't look like anything too special; it basically hangs off a USB port, and presents itself to the OS as a virtual COM or serial port. So, provided you know how to access the serial port on the PC hardware and OS platform you are using BBC BASIC on, it should be somewhat straightforward. You should at least tell us what OS you are using BBC BASIC on, what version of BBC BASIC you are using, and what COM or virtual serial port the UDIN device shows up as. With that information, I might be able to code up something that may work (I don't have BBC BASIC, or even knowledge of it, beyond my general BASIC knowledge, but I do know VB, and no language is totally beyond me - but without it or the hardware, I would be coding "blind" so to speak)...
 
BBC BASIC was used on the BBC Computer, an ancient 6502 based machine intended for use in schools, manufactured by Acorn, who later invented ARM.

It certainly never had USB ports, and no capability for any.

BBC BASIC was probably the first 'enhanced BASIC', and was fairly powerful on a fairly powerful machine (for it's day).

VB though works in a completely different way, been3e vent driven, and programs woiuld need completely rewriting
 
Many thanks for your response. I should have probably mentioned I am using Richard Russell's brilliant emulator to run the BASIC programs on my Vista PC. He has been kind enough to write code translated from the Visual Basic code suppiled with the unit so I do have the means to incorporate in my program.
Unfortunately I am unable to grasp how to find the actual means to load to DLL file addresses or what the heck FT_Handle actually is!
It is simply the lack of knowledge of how to understand what everyone else seems to take for granted. "Just replace the variables with the correct data" does not help if I do not know what it is.
Any help would be greatly appreciated.
 
Your questions seem specific to the emulator, and to BBC BASIC, there's probably no one here who has ever used either.

But, to be honest, it sounds a really silly idea to try and do something like this with an emulator?, why not just use a proper PC language?.
 
I do not know any "proper" computer language so made the best I could.
Program is in place in a snooker hall and owner is delighted with program.
Just need to be able to control lights on/off.
I did not think it would be such a problem.
Thanks anyway.
 
I do not know any "proper" computer language so made the best I could.

Various types of BASIC (including VB), various varients of C (C++, C#), Delphi (varient of Pascal), Java - there are loads of languages.

Program is in place in a snooker hall and owner is delighted with program.
Just need to be able to control lights on/off.

Why not buy an old BBC computer and use that?, although you would need a different relay, USB is far too modern.

I did not think it would be such a problem.

Look at it this way, you need to do deliveries around the town, so you buy a nice new Ford van. But because you don't have anyone to drve it, you buy a horse and fasten it to the front of the van, and bolt a seat on top of the van for a carriage driver to control the horse. Except it's even worse than that, it's not a real horse, it's only got three legs, and the carriage driver is a blind quadriplegic.

As you have example code in VB, why not use VB?.
 
Thank you for your responses.
As I say, I have the VB translation into BBC Basic. Just a question of finding the correct addresses to use. E.G. FT_Handle.
I WILL get there, I always do. Just take me longer than a programmer.
Thanks anyway.
 
Everybody here -does- realize that BBC BASIC is available for a great many platforms (including Vista), right...?

BBC BASIC

When the OP was talking about it, I figured they were likely using one of the new flavors, and not an emulator running an original flavor (or otherwise), nor on original hardware. Furthermore, just because one may not have developed anything using it, does not mean it would be impossible for one to translate VB into another BASIC; providing it had methods for interfacing with a defined serial port (which even most of the old-school BASIC dialects had - at least for the port on the machine it ran on) - it really shouldn't be that difficult for any programmer worth their salt.

Even with an emulator, provided the emulator could expose the underlying OS ports to the emulated system, and the BASIC on that system had been updated with hooks or memory locations that could be PEEKed and POKEd (or OUT'd and INP'd - or whatever strategy is used), in theory it should be possible, as long as everything is set up properly (and it all works - lots of ifs, I know).

If BBC BASIC is absolutely needed, I would suggest ditching the emulator, and going for a version that runs natively on the OS being used. If BASIC must be used, and BBC BASIC isn't available for the platform, there are a ton of great BASIC interpretors and compilers out there, many of them free, that could be used.

I would personally stay away from VB in its current incarnation, unless one is fairly familiar with OOP structure, or wants to learn it, if one is only familiar with BASIC; the current incarnation of VB.NET is BASIC in "name only"; VB.NET is a radical departure from prior versions of VB (ie, VB6/5) that Microsoft released. I am not intimately familiar with it; I stopped using VB with version 6, and later moved on to other languages under Linux (Perl, Python, PHP, C/C++, etc). If I was to return to a BASIC under Linux, I would likely choose FreeBASIC and/or GAMBAS (I've also played with and enjoyed BLASSIC, which is an awesome old-school feel BASIC interpretor: **broken link removed**).

If you don't want to take the time to learn VB.NET, but you don't want to futz around with another version of BASIC, yet you are wanting to learn something new, then consider Python; I've found it to be a very easy yet powerful language to work with, at least under Linux. It has an "easy-to-use" like BASIC does, yet keeps open the door to more powerful options (like interfacing with C/C++ based libraries). While it isn't a compiled language, there are native compilers available for it; even interpreted, though, it runs very quickly - the issue of speed isn't likely to be a problem for most developers, especially on today's systems.

Ok - I now realize the above link is - the Russell emulator - doh! And it doesn't look like "easy" methods are available, but at least the author is willing to help the OP... I still stand by everything else; it might be easier translating the BBC BASIC into something like FreeBASIC, and adding the bits needed for serial access, rather than hacking an emulator - or having the author hack it...


It seems that serial port access -is- possible under Russell's emulator (at least under Windows?): https://www.bbcbasic.co.uk/bbcwin/manual/bbcwinf.html#introf - if everything is set up right, you should in some manner be able to input and output the same byte stream to the relay hardware (as defined in its specifications), as long as you have the proper virtual COM port set up with the right driver for the hardware (which should be set up by the installation process for the hardware). It looks like something that will take some fiddling, but it should be doable...
 
Last edited:
Status
Not open for further replies.

Latest threads

Back
Top