![]() |
Outputting through parallel port or USB
Hi Guys.
Not sure if this forum deals with the electronic side of programming? I basically want to make a money counting machine thats connected to a PC. I will be using a universal hopper to count any size coin. My problem is, i don't know how to output to the printer port or USB. I have wrote the following simple code to try and show what i mean. Any help is much appreciated as always. If i'm asking the wrong kind of question please let me know :) Code:
#include<stdio.h> |
Re: Outputting through parallel port or USB
ah,so you want to count 5,10,or whatever the value coins
i don't get you want to count real coins by scanning with some machine ? i guess so .. if you want to print anything you need save that text you want to print in txt file by commands fopen (opens a txt file, wich is in your case empty),fwrite (writes in that file text), then fclose (closes file,saves what you've written there), so the remaining thing to do is to print that txt file. i don't remember wich commands are used for that |
Re: Outputting through parallel port or USB
Quote:
I didn't want to print anything, i just used printf as an example for the output in the compiled program :) |
Re: Outputting through parallel port or USB
so: you 're inputing quantity of coins in computer , then what?
I don't get , what is the purpuse of counting. Suggestion you have REAL coins 10, 20 for example for 10 is 0v, for 20 is +5v , you put coins in the hopper , hopper gives signas 0v, +5v to computer, and computer counts how many signals there are , so you're having resut how many 10 coins and how many 20 coins if so then what you need to output from PC? indeed you need to read signals from hopper in the case you want to create signals from PC to hopper (i don't understand why), then i guess you need to know other language than C , cuz C is "high-objective" language , and you need "low-objective" language. ( Assembler for example. or Pascal i don't know for sure) maybe in C there is such possibility, try to find this command in MSDN http://social.msdn.microsoft.com/Sea...ge%20signal&ac |
Re: Outputting through parallel port or USB
Quote:
Hopper connects to PC. A number of coins are loaded into the hopper, 10p's for example. Program is running on pc. You input how many coins you want counting out and the output in the program sends the signal that ammount of times to the hopper. The hopper doesn't send anything back. It just counts out how many times the signal is pulsed and churns out that many coins. Am i making more sense now? :) |
Re: Outputting through parallel port or USB
yes, now i get it)
i guess http://www.usbee.com/dxtb.html this will be it Digital Signal Generator The USBee DX has the ability to generate (output) samples from 8 or 16 digital signals at up to 24Msps or 12Msps in Signal Generator mode. In this mode, there is a single buffer that stores the samples to generate. Each sample is a long value made up of 4 bytes. The low order 2 bytes represent the 16 digital channels. Digital Signal 0 is bit 0 of each long value. The high two bytes are not used. These samples can then be generated on command. The maximum sample rate that is possible Signal Generator mode is 24Msps. This value can depend on your PC system and available processing speed and how many byte lanes are generating data. The basic rule of thumb is that the maximum bandwidth through USB 2.0 is near 24Mbytes/second. Therefore to generate 2 bytelanes (16 digital channels for example) would equate to a maximum sample rate of 12Msps. The method for generating a single output pattern using the Signal Generator routines is as follows: · Allocate the sample buffer (MakeBuffer()) · Fill the sample buffer with the pattern data you want to generate. · Start the generation running (StartGenerate (…)) · Monitor the generation in progress to determine if it is triggered, filling, or completed. (GenerateStatus()). · Terminate the generation. (StopGenerate()) The USBee DX can not generate analog output voltages using this mode. Variable analog outputs are possible using the PWM Controller and an external RC circuit. i don't know is these C-commands or not thought |
Re: Outputting through parallel port or USB
Quote:
Getting back to the original question :). I have been told that going through the serial port would be easier. I know someone who's going to alter my code. I'll report back when he has done it. |
Re: Outputting through parallel port or USB
yes, please)
it will be interesting |
Re: Outputting through parallel port or USB
Quote:
|
| All times are GMT +5.5. The time now is 20:33. |