|
THANKS SO MUCH IT GAVE ME A STARTING POINT.
I TRIED TO RUN IT BUT COULD NOT WORK.
-WHEN SHOULD I RUN THE FORM(WHEN I SEND SOME JOB TO PRINTER OR BEFORE) AND
-SHOULD THIS APPLICATION BE RUN FROM THE COMPUTER WHICH IS PHYSICALLY CONNECTED TO THE PRINTER?
-ARE THERE CHANGES I NEED TO MAKE TO CUSTOMIZE THE APPLICATION IN ORDER TO SUITE MY REQUIREMENTS?
ANY HELP IS APPRECIATED.THANKING YOU IN ADVANCE
|
|
|
|
|
Im not sure if the print-monitor API runs 'across machines' ..
I would build the print monitor into a dll, install it on all the machines with printers attached.
The print monitor itself could connect to a centralised machine with MS-SQL installed on it to write the records of what you've captured, and include what machine wrote the log record with the number of pages etc
Try these for brain food
http://www.codeguru.com/cpp/w-p/printing/article.php/c5893[^]
http://msdn.microsoft.com/en-us/library/ms802185.aspx[^]
oh, here's some to help you get by on this forum .. STOP SHOUTING - drop the all caps replies please
'g'
|
|
|
|
|
In execution, Win32 SDK func RegisterDeviceNotification() returns fail all the way. here i list my code as below.
HidD_GetHidGuid(&m_guidHID);
// 注册设备的GUID,以便响应系统热拔插消息
// 设备的GUID, 不同的设备有不同的GUID,根据实际情况设定
DEV_BROADCAST_DEVICEINTERFACE DevInt;
//memset(&DevInt,0,sizeof(DevInt));
ZeroMemory( &DevInt, sizeof(DevInt) );
DevInt.dbcc_size = sizeof(DEV_BROADCAST_DEVICEINTERFACE);
DevInt.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
DevInt.dbcc_classguid = m_guidHID;
HDEVNOTIFY hNotifyDevNode;
//hWnd = TForm->Handle
hNotifyDevNode = RegisterDeviceNotification(hWnd,&DevInt,
DEVICE_NOTIFY_WINDOW_HANDLE);
I prefer C++ Builder as my development environment, and Windows XP2 sp2 SDK. Did i do Something Wrong? Many thanks in advance
|
|
|
|
|
I need to control a set of LEDs from a usb port. Can someone help or relate me to an article on how to do that please? I think I will try to use C# coding to access the usb port. Thanks
|
|
|
|
|
Hi,
1.
depends on how many LEDs. You could easily connect 3 to one serial port (e.g. a USB-to-RS232C cable); and use the SerialPort class to control the output control lines.
2.
you could connect any number using external logic, basically implementing a shift register (needs data, clock, clear as a minimum; without an additional latch, they would flicker when a new data stream gets sent). This needs an external power supply.
3.
you could connect any number supported by it by using a micro-controller. This too needs an external power supply.
4.
yes C# can be used for such things.
5.
have you googled? searched CodeProject articles? there are several.
[EDIT]
Of course you would need at least a series resistor to limit the current and keep things alive. Depending on the LED and the voltages of the serial port, I would go for 1000 to 4700 ohm. Lower = more current = brighter = more dangerous. Don't go anywhere under 470 ohm!
[/EDIT]
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
modified on Friday, August 14, 2009 10:11 AM
|
|
|
|
|
You cannot attach an LED directly to the port and control it. There has to be an interface between the two. You can Google for "control LED USB[^]" for some example projects.
You can also look at Phidgets.com for good interface kits, complete with drivers and an easy to use API.
|
|
|
|
|
Hi.
You asked the same question a year ago:
http://www.codeproject.com/Forums/1649/Csharp.aspx?fid=1649&select=2672552&tid=2672552[^]
My question is why do you want to "flash LEDs"?
I doubt that your real desire is to have your PC light up an LED. So, it then comes down to what do you want to control with your PC, the reason, and so on.
A super simple solution is the following:
I/O Ports Uncensored - 1 - Controlling LEDs (Light Emiting Diodes) with Parallel Port[^]
And an USB to Parallel adapter (~$15).
http://www.amazon.com/Sabrent-SBT-UPPC-Parallel-6-Foot-Printer/dp/B0007UVRVO[^]
But, if it's for something that going to be built and packaged, then that's different. In that case, your best bet could be to go with a USB bridge that has parallel outputs. You can use something like the Silicon Labs CP2103. Or, even the CP2102, and use the RS232 signals.
https://www.silabs.com/products/mcu/Pages/CP2103EK.aspx[^]
It's ~$30 for the test kit, and the chips are easy to get and very cheap.
Also, FTDI makes a number of chips, like the FT245R.
http://www.ftdichip.com/Products/FT245R.htm[^]
I've used the CP2103 a lot. It's awesome for a simple, cheap, small space solution to have an embedded controller or FPGA communicate to a PC. Now, I need something faster than ~1MBit transfer. So, I'm going to use an FTDI chip.
Otherwise, there are other products/boards, like at Phidgets.com, that have relays on the board so that you can drive more current.
_______________
Joe
modified on Saturday, August 15, 2009 7:21 PM
|
|
|
|
|
Hi.
Since it seems like this type of questions comes up every now and then. So, here's a quick list of other resources to look at:
For something to use in the lab, dataq is one of the main companies that businesses go to for low-cost/mid-range solutions. A very cheap whay to get a few I/O pins and have it in a packaged form is:
DI-158 Starter Kit
Low-Cost USB Data Acquisition Device
http://www.dataq.com/products/startkit/di158.htm[^]
* Low-cost, compact, USB data acquisition starter kit.
* Record data with 12 bits of measurement accuracy at rates up to 14,400 samples/second. WinDaq High Speed Acquisition software required for recording rates over 240Hz.
* Convenient USB interface.
* Four ±10V or optional ±64V fixed differential inputs.
* Four digital bits for general purpose I/O.
* Two 0V to 1.25V digital to analog output ports.
Another pre-built board to consider is:
http://www.xdimax.com/sub20/sub20.html[^]
SUB-20 Multi Interface USB Adapter
USB to I2C, SPI, GPIO, RS232, RS485, Ir, LCD
* Full Interface Crosspoint - converts any to any
* USB to I2C Master and I2C Slave, USB to SMBus
* Up to 8MHz USB to SPI Master and SPI Slave
* USB to GPIO - 32 GPIO, PWM Outputs
* USB to ADC - 8 Analog Inputs (A/D Converters)
* USB to RS232, USB to RS485, USB to ModBus
* USB to IR (USB to Infrared) Adapter
* 8x2 LCD, Leds, Push Buttons
* Field upgradable and customizable
* NI LabVIEW Support
If this is for an end product or for a board, and you want to use Ethernet for connectivity, then Lantronix has a number of good solutions:
Good solution for a board:
XChip Direct SoC
http://www.lantronix.com/device-networking/embedded-device-servers/xchip.html[^]
Embedded Device Gateway SoC Co-Processor XChip
* Connects to host microcontroller for serial to Ethernet (LAN) applications
* Robust networking and applications firmware included – no coding required; zero royalty licensing agreement
* Integrated 10-100 MAC/PHY; 256K SRAM; up to 230 Kbps data rate
* Compact 12mm x 12mm 184 BGA package
* 2 PIO (Programmable I/O) pins (software selectable)
Another good solution is the XPort Direct+. The development kit is cheap, and it's through hole. However, for a product, it's more costly and takes up more area.
XPort Direct+ Embedded Device Server
http://www.lantronix.com/device-networking/embedded-device-servers/xport-direct-plus.html[^]
* Powerful and affordable networking for any device with a serial interface on its microcontroller
* Integrated module with RJ45 and dedicated networking SoC
* Web server, TCP/IP protocol stack and Windows deployment software
* Up to 921 Kbps data rate
* Compact low profile (<12 mm)
* 2 x 12 pin, 2 mm headers
* Three GPIO pins (Programmable I/O)
* RS-232/RS-485 ready
* 256-bit AES encryption for secure communications
So, the above should be plenty of info to get someone very well started on having a PC be able to connect to a remote device, to control a few lines, to read analog voltages, or to send out an analog signal (DAC).
Good Luck!
____________
Joe
|
|
|
|
|
In our network 15 computer are inter-connected. Now we are planning to add a storage device that will collect all 15 system data.
But we can't accommodate a separate system for that so that
we are thinking Is any additional device that will work as mass storage device???
If you have any idea please post it.
|
|
|
|
|
I have device running Windows CE 5.0.
I am developing an application for it in C# using a SQL server mobile database.
In order to install the database on the device,I first have to add SQLserverCE.dll.But I don't know why the folder or dll is not available. I tried to install Microsoft SQL Server MObile Developer Tools.but still nothing.
I also reinstalled SQl Server 2005...
|
|
|
|
|
Hi,
I have a raw pdo device which sample code needs administrative rights in order to work, othwerwise fails with an access denied error.
Which SSDL should I use to have it working under user mode code?
I have tried SDDL_DEVOBJ_SYS_ALL but this specifies that the code must run as system.
I'm trying to put the sample code that right now runs on the console, into a control panel applet.
Should the applet run as system?
Some help would be really appreaciatted.
Thanks,
Nuno
|
|
|
|
|
|
Hi,
I made it! I have read the document you passed me and decided to create a more open SDDL which I defined as:
DECLARE_CONST_UNICODE_STRING(
MY_SDDL,
L"D:P(A;;GA;;;SY)(A;;GRGWGX;;;BA)(A;;GA;;;WD)"
);
And gave to the world GA permissions.
My question now is.. what are the implications of having a not so restrictive security options?
What are usually the SDDL for custom devices?
Thanks,
Nuno
|
|
|
|
|
sinosoidal wrote:
And gave to the world GA permissions.
My question now is.. what are the implications of having a not so restrictive security options?
What part about World (Everyone) having ALL access do you not understand? Did you read the articles I gave you in this previous response[^]? More specifically the How safe is your device namespace?[^] article which outlines a possible security hole scenario.
sinosoidal wrote: What are usually the SDDL for custom devices?
Have you tried SDDL_DEVOBJ_SYS_ALL_ADM_RWX_WORLD_R_RES_R?
"D:P(A;;GA;;;SY)(A;;GRGWGX;;;BA)(A;;GR;;;WD)(A;;GR;;;RC)"
Best Wishes,
-David Delaune
|
|
|
|
|
Hey guys .... i bought a new laptop(TOSHIBA AMD Turion Dual-core 3GB RAM) but it even doesnt act like a 256MB RAM ....it is very slow that I cant tell about it ...... my 1GB desktop runs much faster than the new laptop ..... by the way I usualy write C# codes on my laptop and listen musics ....... and it's operating system is VISTA.............. Please help me what to do about it
Thank you
There is no word Impossible in my mind dictionary
|
|
|
|
|
I have a requirement to be able to send a digital signal to a piece of hardware when a certain event happens in my software (and I'm not an electrical engineer by any means). I basically need a TTL pulse to go high for about 50ms and then back to zero. The hardware has a "16 channel digit I/O" that basically looks like a parallel port that I'll need to connect to, but I'm not sure what is the quickest, cheapest and cleanest way to go about generating the signal. It seems that the preferred method used to be to write to the parallel port of the computer, but the laptops we use don't have parallel ports and it is my understanding that writing to the parallel port is complicated in XP and later version of Windows by cutting off direct access and requiring a driver. I've seen USB-parallel adapters, but I have no experience with them.
Another thought I had was to use some like this, which connects to the USB port, comes with drivers and code samples that work in C# and seems very programmer friendly, but it has 8 outputs (when I need only 1) as well as inputs that I don't need (but might be useful for some other project perhaps?).
Does anybody have any ideas or advice they can share with the clueless?
|
|
|
|
|
Hi,
if all you need is one or a few signals (in or out, doesn't matter), the easiest and cheapest way would be through the control pins of a serial port, either a regular one or a USB-to-RS232C cable one.
Use the SerialPort class to open the port, and some of its properties to either read or write the control pins.
remarks:
- RS232C does not use TTL voltage levels; voltages may go anywhere from +15V to -15V so you may have to add resistors and a diode or zener diode.
- a better alternative would use an opto-coupler between your serial port and your target hardware.
- exact timing is not possible under Windows; generating a pulse that typically lasts some 30 milliseconds or more, should not be a problem. On average. When you're unlucky, your app will start the pulse and be kicked out for something more urgent Windows wants to do. You can reduce probability of this happening drastically by temporarily raising thread priority to real-time!
- serial ports based on USB-to-RS232C cable are bound to offer less control on timing, as they have to put their data and events in USB packets first.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Thanks, sounds like a good suggestion. So if I'm understanding it correctly, I should be able to use a USB-serial adapter (we have a bunch of them lying around, so that shouldn't be a problem) and the SerialPort class and I should be able to control the DTR and RTS pins by using the SerialPort.DtrEnable and SerialPort.RtsEnable properties respectively. Is that correct?
Thanks for the heads up on voltage levels. I'll have to confirm exactly what the instrument I'm connecting to is expecting and then put something together to handle it. I have a guy who should be able to help me with that.
|
|
|
|
|
Wjousts wrote: I should be able to control the DTR and RTS pins by using the SerialPort.DtrEnable and SerialPort.RtsEnable properties respectively. Is that correct?
yes, as long as you don't enable hardware handshake on the port (then the driver would take over), so keep Handshake at None.
one more warning: as long as the port is not open, the output control lines will be at their default level, you'd better check that is acceptable for your peripheral device.
and one suggestion: you might consider pulling one input pin high/low at the far end, so your app can check to some extent your device is actually connected.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
If you want your pulse timing to be even remotely precise, I would suggest using a serial port. At 110 baud, a character code 0xE0 will generate a pulse that's about 54.5ms long; an 0xF0 would generate one about 45.5ms long. If the serial port will support non-standard baud rates, you could specify exactly 180 baud, in which case a 0x00 would yield exactly 50ms. Using RS232 levels, the line would idle at minus (typically) 9-12 volts, and the pulse would be +9-12; at TTL levels, the line would idle high and pulse low.
Note that sending characters back-to-back will generate pulses with a certain amount of time between them. Sending 0x00 at 180 baud would yield 50ms pulses with 33ms spacing. Using other baud rates and characters would allow different spacing, though I don't know how low serial ports can go (some serial-to-USB adapters may not even go down to 180). If you can only get down to 200 baud, you could try setting 8 bits space parity and sending 0x00. That would yield 50ms pulses with 5ms typical separation.
One advantage of using the serial-port data wire instead of the DTR line is that the data wire's pulse length will not be affected by code execution. If a user program turns DTR on and then triggers a garbage collection, the DTR wire may remain set for an arbitrarily-long length of time. By contrast, if the user code sends a byte out the serial port, the pulse length for that byte will be fixed no matter what else happens in the system.
|
|
|
|
|
I have a problem when trying to monitor CPU. My machine has Core2Duo CPU. But, when I'm trying to request number of processors using WMI, the return value is 1. Here's my code(VB .Net) :
Dim noCPU As Int64<br />
Dim mgtScr As ManagementObjectSearcher = New ManagementObjectSearcher("root\CIMV2", "Select * from Win32_ComputerSystem")<br />
For Each mgtObj As ManagementObject In mgtScr.Get<br />
noCPU = Convert.ToInt64(mgtObj("NumberOfProcessors"))<br />
Next<br />
mgtScr.Dispose()
Is my code right?How it's must be?After that, how can I get the CPU usage and CPU temperature from each processor / core?
I'm sorry, I can write in English very well, cause I'm an Indonesian
25160506848319
|
|
|
|
|
Hi,
the way Microsoft uses the terms core, processor, CPU is confusing me all the time.
What you probably want is hidden under NumberOfLogicalProcessors .
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hi
I want to know the code/method/procedure how to write in boot sector of usb pendrive.
Thanks in advance
|
|
|
|
|
I am using intel D845GVSR chipset family motherboard, from last 1 week i am facing a problem related to sound issue.
My sound got disabled, no sound is coming from speaker.
I reinstall whole window XP, then after installing board drivers sound comes. then after restart it again got disabled. I dont know what is the reason.
In device manager, under sound option its not showing realtek device.
after fresh installation it shows the device, but as i install driver and restart my pc the sound device again got disabled.
On motherboard cd there is option for system info, there i saw a message that my audio device is disabled. I also checks my BIOS setting, there also audio is enabled.
I reinstalls Xp for 2-3 times, every time after few restarts(or as all drivers installation completes) sond got disaled.
Can anyone plz having a solution of this issue.
regards
|
|
|
|
|
Hi all,
This is my first post in quite a while - it's good to be back.
I have a series of related questions for the experts out there. There's quite a lot of stuff below, and I would really appreciate any advice that anyone can give on any of the questions I have. Feel free to point out anything that i've understood wrong or got mixed up. The questions really are my way of trying to follow through to the lowest level possible some stuff about communicating with hardware programmatically. I always find i want to understand what i'm doing to as high a level as possible. Just so you know at what level to phrase your responses, I write best in C# and C++ and have limited knowledge of C and Assembly code. I'm currently an undergraduate physicist at Uni, but the questions i have aren't at all related to my course. If possible, im looking to complete this project using C/C++.
My questions started when I was looking into controlling the parallel port from a program. I didn't care which language I used, but wanted to understand what was going on. I discovered the inp and outp methods in the conio file, but was pointed to the CreateFile and Read/WriteFile functions in the API by MSDN. My first question is:
Am i correct in presuming that the API calls end up using the same method as inp and outp to do their stuff?
Either way, I would like to know how these functions actually work. I was told by one of my tutors that the inp and outp functions are converted pretty much straight into a single op-code - at least, there's no lower level between inp/outp and assembly code as i imagine there would be if you used the win API (for some reason i imagine the api eventually goes thru to calling inp and outp and that we use the api because you cant interact directly with I/O ports in user code). Anyway, my second question is:
Does anyone know the assembly code for reading/writing to, say, the parallel port (traditionally port at address 0x378) or ports in general.
If i am forced to use the win API CreateFile, WriteFile etc functions, is it actually possible to use these to send a single bit to one of the pins of the parallel port so that it goes high? If so, how would i go about doing this? I think i know how to do it using outp, but im not so sure when using the API.
Whilst researching this stuff i ended up on DeviceManager. I was looking at the Resource tabs for different devices. I saw that I/O range (4 numbers) was available for Devices classed as Ports, such as the Parallel port (beginning at 0x378 for example) and that using the command line Debug program (in cmd.exe) i could query and edit the pins on various ports. I again presume Debug does this through the use of inp and outp, or the API?
However, i was looking at my audio device. Its property page points to the audio controller (under System Devices). Under the Audio Controller properties page, I can look at the Memory Range. This is now 8 numbers, and is not a port address. However, i wanted to know whether it was still possible to communicate with the Audio Controller using this memory range? How would i go about doing so?
If i cant do that then the audio controller points me towards the PCI Bus, device 27. The PCI bus does have an I/O Range so i could communicate with it this way, but i have no idea at what address the Audio Controller begins...How can i find this out? I obviously don't want to accidentally access the wrong device or port!
Of course, going so low has its advantages, but it would be simpler to access the audio device through its driver - i've no doubt that the manufacturers offer such functions, but i have no idea how to find out how to access them. The properties page for the audio device shows me the driver file, but i don't know where to go from here. I'm aware of COM objects and the information in the registry, but not sure how link the stuff together.
Finally, does microsoft offer some decent API documentation, such as a functions/files list which i could use instead of Prof. Google...? There must be decent documentation somewhere, or how does anyone get anything done using it?!
Thank you for your time and patience. Any help at all is greatly appreciated.
Yours,
Ed
Edit:
I've just found the article on controlling LED's using C# and the API functions there. Whilst this is a very good article, i'm still keen to have a deeper understanding of how these API functions work, what they end up calling (e.g. inp, outp) and the other questions in my post above. The functions used in that article are actually wrapped from some random site, and so again, i wish to go deeper in my understanding, and actually know how the stuff works!
|
|
|
|
|