Hi. I havent been doing this microcontroller stuff long, but i have set myself an ambitious challenge of making a program for my mums company. She has one very old computer that has a piece of software on it that manages orders, it was written for her in about '92… then on any normal computer, details of the orders then get processed into an invoice etc from a user. The system is ridiculous but shes been using it so lon she cant be bothered to change it, any way…
I want to make a decice that connects to each computers inputs (usb/serial etc) and when the details have been output by the old computer, it finds them, takes a copy and outputs to a text file on the other computer.
Now all the computer stuff, saving data to a text file i can handle, but firstly, i dont know if anyone knows about api’s but i read about them so you can control applications from code, so you can click buttons etc from code but that is how i have been told to grab the data.
Is my orangutan up to this, can i put all the code on there and when pluged in can do everything from it or do i need applications on each computer, and then the arangutan just stors the data.
Has anyone done anythin similar so i may be able to see an example?
It doesn’t sound like this is a very good use for the Orangutan because it’s really not designed for applications like this. The mega168 does not have a lot of memory, which in turn means it’s not a great device for storing/transferring large data files. It seems to me like you could solve this problem with a much simpler approach:
Write code on computer 1 to generate a text file of your data
Copy the text file onto a portable data-storage device such as a USB flash drive.
Use the portable data-storage device to get the text file to computer 2
Or is the problem that computer 1 is so old that you have no way of getting the text file off of it?
Your suggested approach would require you to write custom software for both computers and your Orangutan so the computers could talk to the Orangutan. I guess this could be a fun excercise, but it would be a lot of work. There are certainly other less complicated projects that could serve as a better introduction to microcontroller programming.
Well for one the only input on the old computer is serial - i havent seen a portable hard drive with a serial connection… secondly its not really for efficiency purposes, its more like i found something to make a project for to learn about the orangutan.
I can imagine i would send each piece of data one string at a time.
The text file gets laid out like this:
Name:xxxxxxxxxxxx
Address:xxxxxxxxxxxx
Contact number:xxxxxxxxxxx
Name:xxxxxxxxxxxx
Address:xxxxxxxxxxxx
Contact number:xxxxxxxxxxx
etc.
So i would go along until next Name: is found, store the string after it as a variable, send that to orangutan which then sends message to computer two, to grab value of variable “Name”. And store that to text file, then the process starts again but now for Address:.
It would be a slow process probably, but it seems like a far fetched stepping stone for me now, so if i managed to do it i would be very impressed by myself.
I have seen tutorials about talking to computers via the serial port using a terminal. A) is it as easy for usb, and B) do i have to use a terminal, can i not write a simple program to communicate with it?
USB is fairly complicated. My recommendation is that you use a USB-to-serial adapter such as our USB-to-serial adapter or our Orangutan USB programmer (which can serve as a limited USB-to-serial adapter). This lets you connect your Orangutan to a computer with a USB port and communicate with that computer using serial, which is a much simpler protocol than USB. The USB-to-serial adapter just looks like a serial port to your computer.
If you want your Orangutan to talk to a computer that has a serial port, you will need to use something like our serial adapter, which converts the logic-level serial signals used by the Orangutan to the higher voltages used by RS-232 serial ports on computers. Because of this voltage difference, you cannot simply connect your computer’s serial port to an Orangutan. If you only want one-way serial communication between your computer and your Orangutan, you can build your own level-shifter circuit like nexisnet describes in this thread. This could save you money and give you an interesting side project in electronics.
You can definitely write your own computer software to talk to your Orangutan using serial. There are many examples of this in a variety of different languages on this forum already, but I’m not sure if any of them would work on a computer that is as old as you are describing. On your newer computer, I’d recommend using .NET (C# or VB). On the older computer, you’ll need to figure out what programming environments are possible and how to access the serial port from those environments. It might end up being simplest for you to just use a terminal on your older computer.