and sending it to Hyperterminal (or any other application) is a matter of using the USART - again, see examples provided with the library...
A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Unfortunately ''count'' is not a very helpful term. When the ADC converts an input analog channel, it returns an unsigned integer value. For zero or negative input volts, it returns a value of zero. For 3.3 or higher volts, it returns a value of 4095. (Don't go too negative or too high to avoid damaging the ADC). In between zero and 3.3 volts, the ADC returns a corresponding ratioed value.
No ''counting'' is required, just a simple read. Look at the examples in the Library for further information on how to convert and read a channel. If I have misunderstood your question, please restate. Cheers, Hal
Nothing in the code you've shown writes anything to the USART! Remember: to the STM32, Hyperterminal is irrelevant! All the STM32 knows is that it transmits bytes through the USART - where those bytes go from there is entirely immaterial to the STM32. See:[DEAD LINK /public/STe2ecommunities/mcu/Lists/ARM%20CortexM3%20STM32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/ARM CortexM3 STM32/Hyperterminal is not the only terminal program!!&FolderCTID=0x01200200770978C69A1141439FE559EB459D758000626BE2B829C32145B9EB5739142DC17E]https://my.st.com/public/STe2ecommunities/mcu/Lists/ARM%20CortexM3%20STM32/Flat.aspx?RootFolder=%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fARM%20CortexM3%20STM32%2fHyperterminal%20is%20not%20the%20only%20terminal%20program%21%21&FolderCTID=0x01200200770978C69A1141439FE559EB459D758000626BE2B829C32145B9EB5739142DC17E
A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
actualy in my application my data (Analog temperature value ) i want read this so i am confg here RCC_Configuration(); SYSTICKS_Configuration(); GPIO_Config(); TIM2_Configuration(); NVIC_Configuration(); USART_Configuration(DBG_USART,115200); ADC_Config(); for read this channel.... u16 readADC1(u8 channel) { ADC_RegularChannelConfig(ADC1, channel, 1, ADC_SampleTime_55Cycles5); // Start the conversion ADC_SoftwareStartConvCmd(ADC1, ENABLE); // Wait until conversion completion while(ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC) == RESET); // Get the conversion value return ADC_GetConversionValue(ADC1); } but i didnt see the count value in hyperterminal so plz tel me what is the thing is wrong thanx
How have you verified that your WriteSerial() routine actually works?
eg, have you tried it with a simple ''Hello, world'' program? Remember that serial comms is very, very slow relative the CPU execution - how do you ensure that the USART is ready before you call WriteSerial() again...?
A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
You still haven't showed the code of your WriteSerial() function!
And you still haven't said how you know that it actually works at all! But this doesn't look right:
Here, you are passing a string to it:
WriteSerial( DBG_USART, '' hello \r\n'' );
But here, you are passing a u16 integer value:
WriteSerial( DBG_USART, ADC_val );
That can't be right, surely??!
A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
''Perhaps you should convert the number into ASCII before pushing it out to the serial port?''
Indeed! The commented-out lines suggest that she might have been trying to do that: //strcat(ADC_val,'':'');
//sprif(ADC_val,ADC_val);
But there seem to be some basic problems there with (lack of) understanding how strings work in the 'C' programming language...?
A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.