1. interfacing Euphoria to the 'real' world


Is there a complete working lib yet to allow Euphoria code to send and recieve signals from the "real world"? Possibly using the usb port?

useless

new topic     » topic index » view message » categorize

2. Re: interfacing Euphoria to the 'real' world

I'm sure this isn't the answer you want to hear, but "it depends". Anything you plug into your computer is going to be registered at the O/S level first. If you want to use Euphoria to create a driver for your device, I would suggest that perhaps Euphoria isn't the best tool for the job, though I'm sure it's doable, and that whatever library you're looking for probably doesn't exist.

Let's look for a moment at the many different types of devices that currently plug into a computer via USB. Some will present themselves as a mapped device port with a corresponding file handle, such as "COM3:". If the O/S treats your device like a serial port, there are a number of very good libraries for working with them, though I'm sure many have not been updated in a number of years. If the O/S treats it like a HID, sound card, or disk drive; you can use the standard win32lib (or whatever GUI lib) routines for that device as if it were hardwired into your computer.

Many devices are wireless ethernet enabled, so you can create your own TCP or UDP protocol and use the sockets library to communicate with the device over the existing network infrastructure. Some devices already have a built in web browser, so it would be even simpler, just needing to interact with the existing pages over TCP port 80.

The last thing to look at would be either an Arduino or RaspPi that is connected via USB. I don't know much about the RaspPi other than it is a standalone computer running Linux. The Arduino presents itself as a serial port to the computer, so you can read and write data to it via the various serial port libraries. The only thing lacking is direct pin control, so you would have to install a program on the Arduino itself (typically using their "Processing" language) that interprets the serial commands and controls the pins that way.

I know this is a complicated answer to a simple question, and I hope I've answered it to some extent.

Mike Sabal

new topic     » goto parent     » topic index » view message » categorize

3. Re: interfacing Euphoria to the 'real' world

useless_ said...


Is there a complete working lib yet to allow Euphoria code to send and recieve signals from the "real world"? Possibly using the usb port?

useless

I wrote a wrapper for FTDI USB UART devices (ftdi_D2XX.e) for Windows. FTDI does have drivers for multiple platforms, including Raspberry Pi.

Some products that I have been using:

I am currently using the FTDI devices to let Euphoria programs communicate with hardware based on the Propeller chip, as well as XBee radio transceivers. Detecting specific USB devices works well, without even using numbered com ports. To explain, "Virtual COM port (VCP) drivers cause the USB device to appear as an additional COM port available to the PC. Application software can access the USB device in the same way as it would access a standard COM port." I don't use that method, because COM port numbers get confusing and it adds an unnecessary layer. I use D2XX instead. "D2XX drivers allow direct access to the USB device through a DLL." It still operates as a serial port. Once you identify the device, you open it, set the baud rate, set flow control, turn DTR/RTS on or off as you wish, etc.

It works without blocking and plays nicely with multitasking. I just haven't released it yet because i need to create an example program and write some documentation. I'll try to get that done soon.

new topic     » goto parent     » topic index » view message » categorize

4. Re: interfacing Euphoria to the 'real' world

ryanj said...

FTDI does have drivers for multiple platforms, including Raspberry Pi.

FTDI is also how one programs an Arduino. smile

-Greg

new topic     » goto parent     » topic index » view message » categorize

5. Re: interfacing Euphoria to the 'real' world

Hi Kat,
I recall you had posted some info on previous impressive low-level hardware interfacing you had done yourself on Commodore computers.
If your current interfacing needs are limited to a few digital/analog and Pulse width modulation ports, I can suggest
a Vellerman P8055N-2 board that uses a USB cable and documented callable DLL functions.

This is what I am doing while playing with some alternate energy experiments (Bedini etc)
I don't think there will be a single interface lib created for all hardware, as there are many hardware devices out there.
As the Raspberry Pi becomes more popular, there are lots of clones with extra capacity and resources.

new topic     » goto parent     » topic index » view message » categorize

6. Re: interfacing Euphoria to the 'real' world

fizzpopsoft said...

Hi Kat,
I recall you had posted some info on previous impressive low-level hardware interfacing you had done yourself on Commodore computers.

Yeas, and i am currently cutting the shelf boards which will hover over my new desk for resuming Vic20/C64 stuff.

fizzpopsoft said...

If your current interfacing needs are limited to a few digital/analog and Pulse width modulation ports, I can suggest

Not going to limit myself on what the Commodores can connect to, except as far as i can tell there won't be anything PC/wintel/nix compatable.

fizzpopsoft said...

a Vellerman P8055N-2 board that uses a USB cable and documented callable DLL functions.

I went to http://www.vellemanusa.com/products/view/?id=500349 and followed all the links to their retail sellers, and none stocked Velleman stuff. Shame. It's going to be difficult to transfer data from the wintel boxes to the Commodores, just so i can make use of that data while connected to the real world. I saw the k8055 on ebay, spec say 20ms per command, figuring two 4bit inputs to make a byte, the transfer rate is 25 bytes per second. At that rate it will take 418 years to transfer a 330 Gbyte drive.
I am considering a virtual dual-ported pata drive, so the pc can read/write "files" on one port, and the non-PCs can read/write the other port. It's wierd Euphoria can connect to the internet across the world so well, and cannot connect to anything on my physical desktop right in front of me.

useless

new topic     » goto parent     » topic index » view message » categorize

7. Re: interfacing Euphoria to the 'real' world

I recall that the Commodore 1541 drive could not store much, and was unreliable too.
not bad for its day, but todays hardware is far superior. So I assume you want your Commodores
to access large amounts of data, stored presently on wintel hosted harddrives?
IIRC, Commodores supported RS232, I had a adaptor that apparently just raised voltage levels.
If that's too slow, possibly a PIC chip that supports USB 2.0 for the wintel side and you grow your own
on the Commodore side with as many parallel pins (for bandwidth) as the Commodore can support.
use the Microchip search tool to find the PIC chip best suited for you.

OT - I still have my VIC20 and C64 with various associated hardware, and Transactor magazines.
Won't ever throw those away!

new topic     » goto parent     » topic index » view message » categorize

8. Re: interfacing Euphoria to the 'real' world

I see that the C64's USR port has 8 programmable ports, PB0-PB7 labelled as C through L.
See http://www.commodore.ca/manuals/pdfs/commodore_pet_vic-20_c64_port_pinouts.pdf
With a highspeed Schmitt trigger in between this and the PIC chip, should be doable with your
hardware experience. Don't think the Commodore could interface with any faster method than the USR port without internal soldering.

new topic     » goto parent     » topic index » view message » categorize

9. Re: interfacing Euphoria to the 'real' world

fizzpopsoft said...

I see that the C64's USR port has 8 programmable ports, PB0-PB7 labelled as C through L.
See http://www.commodore.ca/manuals/pdfs/commodore_pet_vic-20_c64_port_pinouts.pdf
With a highspeed Schmitt trigger in between this and the PIC chip, should be doable with your
hardware experience. Don't think the Commodore could interface with any faster method than the USR port without internal soldering.

Don't need schmitt devices on the 1Mhz computers, i used 74LS extensively right on the expansion buss.

What i want to do is swap the 6510/6502 for the 65C02S, on a separate daughterboard inside, and push it up to 10Mhz, adding speed and reducing power consumption. I also want to add a second cpu, svga, more and faster static ram, and trap the unused opcodes. Then glue on some avr as peripherals (adc, dac, pwm, i2c, twi, etc), and memory map some functions for hardware multiply, etc.. There is soooooo much that can be done to improve the old machines without breaking their spirit. For instance, it always bugged me that when the REU was available, why didn't the C64 store the var names in internal ram, but point to the REU for the contents of the vars? So much happened with computers after the VIC20/C64, yet almost everything new can be backported into them.

useless

new topic     » goto parent     » topic index » view message » categorize

10. Re: interfacing Euphoria to the 'real' world

useless_ said...


Is there a complete working lib yet to allow Euphoria code to send and recieve signals from the "real world"? Possibly using the usb port?

useless

What exactly do you mean by the "real world"? What do you want the usb port to connect to?

For me, i connect to Propeller chips, which, in turn, connect to other hardware. But, i have to write custom firmware for my custom devices. As time goes by, i am getting better and better bits of source code and pcb design files to copy and paste into new applications, so it's getting easier.

Pretty soon, i hope to add FTDI USB serial communication, network, and multi-process communication to FluidAE with a common protocol/data packet format. I think once the communication protocol's message format is defined, any type of computer or micro-controller could be programmed to talk to a FluidAE program. I haven't quite figured out the design yet, but, i do have bits and pieces of working code that will help me with this.

new topic     » goto parent     » topic index » view message » categorize

11. Re: interfacing Euphoria to the 'real' world

@Kat
This bit of hardware may interest you, as it has the protocols you mentioned:
PIC32MX795 processor - 80MHz, 512K Flash, 128K RAM, MIPS based CPU core (free development tools from Microchip)
You can get it for $40 on a ubw32 stick that has 73 I/o pins in standard pitch, and USB connector.

Now, imagine if we could port the Commodore ROM to this chip... opcodes won't be 1:1 of course, but even at 2:1 80MHz would be faster than the upgraded 6510 chip, and you can use the 32 bit registers when needed.
(OT) I have 2 of these ubw32's , my intent is to program and fit them into a small handheld device and "beat the wheel" at the roulette casinos. My PC based Euphoria program works already but its still work and the casino could wise up anytime and warn me off if I don't keep a low profile.

new topic     » goto parent     » topic index » view message » categorize

12. Re: interfacing Euphoria to the 'real' world

That sounds like fun. Did you ever see this book http://en.m.wikipedia.org/wiki/The_Eudaemonic_Pie?

new topic     » goto parent     » topic index » view message » categorize

13. Re: interfacing Euphoria to the 'real' world

The casinos here change dealers (wheel spinners) often and alternate direction of spin (standard procedure) to avoid pattern matching.
Sorry, can't tell as to my method, sure you understand ;)
But is does involve calculations that a computer is ideal for. This is rather OT though!

Because euphoria is easy to write and debug, and executes quickly, it was perfect to develop my method with.

new topic     » goto parent     » topic index » view message » categorize

14. Re: interfacing Euphoria to the 'real' world

ryanj said...
useless_ said...


Is there a complete working lib yet to allow Euphoria code to send and recieve signals from the "real world"? Possibly using the usb port?

useless

What exactly do you mean by the "real world"? What do you want the usb port to connect to?

Whatever i want it to connect to. Anything functioning as a big PIO chip would be a great start. On the olde VIC20/C64, or a new lowly AVR, i can set a pin as output and write to it to turn something on, or set it as input to recieve a bit of data. Same goes for bytes. Many olde PIO chips have decent speed, many AVR could function as PIO chips. Many have buffers, can generate interrupts, handshake with other computers, generate parity bits, and make PWM signals. There were/are PIO chips made for most cpu families, and built into the modern microcontrollers.

But i have no wintel platform that can do that, and apparently i cannot buy one.

useless

new topic     » goto parent     » topic index » view message » categorize

15. Re: interfacing Euphoria to the 'real' world

Just curious as to who deleted Kat's latest post and why.

Lonny

new topic     » goto parent     » topic index » view message » categorize

16. Re: interfacing Euphoria to the 'real' world

ryanj said...
useless_ said...


Is there a complete working lib yet to allow Euphoria code to send and recieve signals from the "real world"? Possibly using the usb port?

useless

What exactly do you mean by the "real world"? What do you want the usb port to connect to?

I tried to talk to Ryan on irc about this, but he ignored me, i got no responce at all.

I can't wrap my head around windose programming, even tho i have done multitasking on the C64, and written a threaded http server in mirc. I need some help on making Euphoria talk to the real hardware world outside the box.

Sparkfun sells several USB to whatever "breakout" pcbs like https://www.sparkfun.com/products/199 , which apparently there is software for providing access to. I would be very happy to buy the hardware for anyone who can provide a working Euphoria install package to use any of these high performance "breakout" boards on winxp (which i think will be identical to all win32 OSs). Other financial compensations we can discuss in private.

What i will do with it is add a software layer (on top of the Eu code you provide) to make use of other hardware which i plug into the "breakout" board, basically making the wintel platform, running Euphoria, look like the biggest fastest AVR in the world, with all the peripheral input-output pins and ports anyone can imagine.

I am suggesting USB for this only because it seems to exist on all wintel/nix platforms and box/laptops/Pi/etc forms, but if there is a big speed or cost advantage to it, i am completely open to ethernet interfaces too.

useless

new topic     » goto parent     » topic index » view message » categorize

17. Re: interfacing Euphoria to the 'real' world

I mentioned the Sparkfun boards only because they exist, and are representative of what's possible, affordable, and already made. Any other pcb that also exists, with an AVR, PIC, Propellor, whatever on it, to convert USB to serial or parallel, which windose recognises, has some speed, and you can make Euphoria connect to, is fine.

useless

new topic     » goto parent     » topic index » view message » categorize

18. Re: interfacing Euphoria to the 'real' world

Kat, would this work? https://www.sparkfun.com/products/7841 8 I/O pins for parallel reading and writing. I think the data transfer rate is up to 1 MB/s. I believe it works the same way as the serial chip (https://www.sparkfun.com/products/718), it just splits the bits into 8 parallel I/O pins.

I have only tried the USB to serial chip, but I think most of the FTDI chips use the same dll library, so they should work with my code. I'll try to release my FTDI library soon.

new topic     » goto parent     » topic index » view message » categorize

19. Re: interfacing Euphoria to the 'real' world

ryanj said...

Kat, would this work? https://www.sparkfun.com/products/7841 8 I/O pins for parallel reading and writing. I think the data transfer rate is up to 1 MB/s. I believe it works the same way as the serial chip (https://www.sparkfun.com/products/718), it just splits the bits into 8 parallel I/O pins.

I have only tried the USB to serial chip, but I think most of the FTDI chips use the same dll library, so they should work with my code. I'll try to release my FTDI library soon.


Anything you can give me beats having nothing! It has 8 parallel and 5 handshake lines, real nice!

Is there a reason that on a buss this fast:

USB 2.0 was released in April 2000 (now called "Hi-Speed"), adding higher maximum signaling rate of 480 Mbit/s (effective throughput up to 35 MB/s or 280 Mbit/s), in addition to the "USB 1.x Full Speed" signaling rate of 12 Mbit/s.

the thruput is only one megabyte per second? Even though all my computers are ancient and run only USB1 (1.5 megabyte, so 1 megabyte is acceptable for a start), to get full USB2 i can install a new card, if the "breakout" and Euphoria can deal with it.

useless

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu