|
Thats a good question, and not documented that clearly, but it seems (and I havent personally dug into this functionality to that extent) that the calling thread is notified if there is an outstanding IRP on the devobj and can then decide to terminate or not the operarion. This is from the DDK:
"When I/O is synchronous, each I/O operation must wait for the preceding operation to complete before it begins. With the FILE_SYNCHRONOUS_IO_ALERT operation, waiting threads are alerted to the delay and can terminate the operation."
All IRPs will be synchronous, each having to complete before the other can start. You will probably get a STATUS_PENDING from ZwWriteFile() for example. Is this what you get?
Morality is indistinguishable from social proscription
|
|
|
|
|
Just saw your last post, if you are in user mode why call ZwCreateFile(), surely its easier to call CreateFile() since much of this work will be done for you.
Morality is indistinguishable from social proscription
|
|
|
|
|
i bought a usb to rs232 converter and i tested it using loopback and hyperterminal and it is working
but i can't know the values of logic 1 and logic 0 , is it 0 to 5 volts or what !!
i mean do i need MAX232 to connect it to an AVR micro ?
|
|
|
|
|
RS232C is a standard that specifies different aspects of the serial interface, including voltage levels. Microprocessors don't give those voltages (and don't require the corresponding supply voltages either), so yes you typically need a level converter (MAX232 is a popular possibility).
You should learn to use Google, and look for:
- the RS232C specifications;
- the datasheets for the components you intend to use;
- some relevant articles (CodeProject has at least 3 articles mentioning MAX232).
Warning: if you make a mistake, you're likely to damage one or more of the parts involved. So it is very wise to do first experiments with a part that is easily replaced, such as your USB-to-RS232C cable or a plug-in card in a desktop computer, and NOT with a serial port on the motherboard.
|
|
|
|
|
i understand what u say but i am a bit confused
i think that USB uses voltage levels (0-5v) , how it is supposed to get the levels of RS232 (in the USB to RS232 cable) without external power source
thnx for caring
|
|
|
|
|
While the original RS232 spec called for voltages of around 12 to 18V, modern implementations are almost exclusively 5 volt designs. The USB standard provides for each port to deliver a small amount of 5 volt power to connected devices, which is what makes possible many popular USB devices, including your RS232 converter. The key word is "small" however, and USB does not provide enough power to deliver a serial connection very far.
Driving a cable requires the ability to source and sink a fair amount of current, primarily because the cable "looks like" a capacitor that must be charged and discharged for every change of state. Microprocessors like the AVR are built mainly using CMOS technology, which cannot source or sink much current, so external bipolar circuits are almost always required. Special circuits like the MAX232 require very little input current, and so can be driven by a micro directly, but they can move larger currents on the RS232 side. Depending on what form your AVR takes (bare processor, development board, custom circuitry) you may or may not need this extra buffering. Check the documentation for what you have to work with. If it specifies a serial port without mentioning RS232, you can be fairly sure that you need to provide this extra circuit for the connection to the outside world.
Will Rogers never met me.
|
|
|
|
|
Although RS232C requires both positive and negative voltage levels, neither a microprocessor (with the addition of an external device such as MAX232) nor any other chip will have great difficulty in conforming to the specification.
All USB-to-RS232C cables I've seen (quite a few actually) were OK. If you have to worry, it is about your peripheral, assuming you would venture to design and build one yourself.
The (MAX232) drivers provide RS-232 voltage level outputs (approx. ± 7.5 V) from a single + 5 V supply via on-chip charge pumps and external capacitors. That is what one source of information has on the subject.
End of story. The sequel is on Google.
|
|
|
|
|
Most logic is active low, so logic 1 is 0 volts. I am not saying it is like this for RS232, its been a long time since I touched it and I cant be bothered to google it.
You can easilly see, stick an oscilliscope on the data wires and see what they are reading when its idle.
Morality is indistinguishable from social proscription
|
|
|
|
|
|
Thats why I said I wasnt saying RS232 is like this, but its common of circuits to have active low logic. And he did ask about the logic.
I thought RS 234 was the differential one alowing long cable lengths? Could be wrong though. Its been a while.
Morality is indistinguishable from social proscription
|
|
|
|
|
RS485 is differential, using two signal lines of opposite polarity. RS232 uses one line, but uses +V and -V for logic levels.
Will Rogers never met me.
|
|
|
|
|
|
I want to practise writing win32 ddk drivers.
Need some hardware, cheap and interesting. Any suggestion?
Thanks in advance.
BTW, I had posted many times until it was posted successfully, is it the problem of the forum?
|
|
|
|
|
Try eBay or any of the discount resellers in your locality.
It's time for a new signature.
|
|
|
|
|
|
The explanation in msdn is too brief to me.
FILE_SYNCHRONOUS_IO_ALERT
All operations on the file are performed synchronously. Any wait on behalf of the caller is subject to premature termination from alerts. This flag also causes the I/O system to maintain the file-position pointer. If this flag is set, the SYNCHRONIZE flag must be set in the DesiredAccess parameter.
Any wait? For example, when WaitForSingleObjectEx's bAlertable is FALSE ?
In fact, I'm not clear about the concepts. Does it mean that ZwReadFile/ZwWriteFile (in synchronous mode) will
returned prematurely when there are APC's?
modified on Sunday, August 29, 2010 8:08 PM
|
|
|
|
|
i wrote a small code to test the ADC in atmega16 , the code doesn't contain errors but i tried to simulate the code on proteus and it doesn't work
here is the link for the code and proteus file i used to simulate
http://uploading.com/files/cb852548/adc.rar/
it is very simple but it doesn't work
i wish anybody can help ,
thnx in advance .
|
|
|
|
|
People are unlikely to download and unpack some packed file just to help out. Paste the relevant code (inside PRE tags!) if you think it's useful. Also explain "doesn't work", it is not informative at all.
|
|
|
|
|
thnx very much , it has just worked 
|
|
|
|
|
then you could add the solution so others might benefit.
|
|
|
|
|
i will explain the problem and the solution :
i wrote a code just to take an analog i/p and convert it to digital then send it to portc
and the output could be seen on leds connected to portc
the could is easy and has no errors :
.include "m16def.inc"
.def temp = r16
.org $000
rjmp start
start:
cli
ldi temp,$5f
out spl,temp
ldi temp,$04
out sph,temp
ser temp
out ddrc , temp
clr temp
out ddra , temp
rcall adc_initial
sei
Main_loop:
in temp , adch ;read adc high
out portc , temp
rjmp Main_loop
adc_initial:
sbi acsr , acd
ldi temp , $60 ;single i/p (ADC0)
out admux , temp ; *1 gain - left adjust result
;ref = Vcc
ldi temp , $a6 ;adc enable - auto trigger
out adcsra , temp ;/64 prescaling - no interrupt
ldi temp , $00 ;free running mode - no pull up
out sfior , temp
sbi adcsra , adsc ;start conv
ret
when i simulated the program on proteus it doesn't work at first , because i used to connect the AVR without connecting the Vcc pin and it was working so in all programs with no problems , but in this code you have to connect the Vcc pin 
|
|
|
|
|
|
ammeer_a wrote:
when i simulated the program on proteus it doesn't work at first , because i used to connect the AVR without connecting the Vcc pin and it was working so in all programs with no problems , but in this code you have to connect the Vcc pin
Sounds like a really detailed simulator. I'd think if external power was being applied would be overkill. Out of curiosity what happens in the simulator if you connect VCC to 50VDC or 120VAC instead of the 5(3.3?)VDC the chip being simulated is expecting. Does it error out with "Magic smoke released!"?
3x12=36
2x12=24
1x12=12
0x12=18
|
|
|
|
|
Initially it runs faster, and then it blows up. What did you expect?
|
|
|
|
|
I sh*t you not; I’ve never asked a question neither here nor in MSDN or other programing forums.
Here is my problem – my Alienware suddenly lost the monitor drivers and set them to some basic monitor with no 1920x1200 resolution option. I removed the driver, restarted the thing and it still insists that I have some old CRT monitor instead of 22’’ Dell widescreen. I’m out of ideas how to fix this without a system restore. The OS is Weven and my best guesses what causing this mess are:
0. I’m not using a DVI cable, so this could confuses the OS.
1. MS Security Essentials cleaned a couple of nasty viruses two weeks ago, so they could have left some crap behind.
Any ideas beyond the obvious “format-reinstall” routine?
The narrow specialist in the broad sense of the word is a complete idiot in the narrow sense of the word.
Advertise here – minimum three posts per day are guaranteed.
|
|
|
|