<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>ADC for windshield wiper, Error C67: Sensor_value undefined identifier</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/29500/adc-for-windshield-wiper-error-c67-sensor_value-undefined-identifier</link><description> 
Hey guys hows it going 
Im working on a programming assignment where we have to write a
program to control windshield wipers, and im having some trouble
compiling it. The code seems fine to me, but in the main.c file, it
keeps bringing up this error</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: ADC for windshield wiper, Error C67: Sensor_value undefined identifier</title><link>https://community.arm.com/thread/127752?ContentTypeID=1</link><pubDate>Wed, 19 Sep 2012 11:13:31 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:7c088925-7472-4587-b65b-99660681d9a5</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
Please read the manual: &lt;a href="http://www.keil.com/support/man/docs/l166/l166_l22.htm"&gt;http://www.keil.com/support/man/docs/l166/l166_l22.htm&lt;/a&gt;&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ADC for windshield wiper, Error C67: Sensor_value undefined identifier</title><link>https://community.arm.com/thread/127751?ContentTypeID=1</link><pubDate>Wed, 19 Sep 2012 00:57:30 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:d7b99cde-dcb5-478d-bdad-693c8f82ff7b</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
I don&amp;#39;t use the C166 but google or the manual should help with the
meaning of the errors.&lt;/p&gt;

&lt;p&gt;
But can&amp;#39;t you even guess the meaning of these two?&lt;/p&gt;

&lt;pre&gt;
*** ERROR L127: UNRESOLVED EXTERNAL SYMBOL
    SYMBOL:  PWM_init
    MODULE:  main.obj (MAIN)
*** ERROR L128: REFERENCE MADE TO UNRESOLVED EXTERNAL
    SYMBOL:  PWM_init
    MODULE:  main.obj (MAIN)
&lt;/pre&gt;

&lt;p&gt;
Where are your PWM_init?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ADC for windshield wiper, Error C67: Sensor_value undefined identifier</title><link>https://community.arm.com/thread/117004?ContentTypeID=1</link><pubDate>Tue, 18 Sep 2012 17:40:04 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:2b0e15ab-111c-48bb-9df7-36b4a8d73ae2</guid><dc:creator>Ken Kendall</dc:creator><description>&lt;p&gt;&lt;p&gt;
Well seems that fixed the problem, but another problem presented
itself. They all compile alright individualy, but when i try building
the target, it return errors L22, L127 and L128, shown below. What do
they mean, and how can i fix them?&lt;/p&gt;

&lt;p&gt;
Cheers for you help :)&lt;/p&gt;

&lt;pre&gt;
Build target &amp;#39;Target 1&amp;#39;
linking...
*** WARNING L22: CLASS RANGE NOT GIVEN IN INVOCATION LINE
    CLASS:   NCONST
*** WARNING L22: CLASS RANGE NOT GIVEN IN INVOCATION LINE
    CLASS:   NCODE
*** ERROR L127: UNRESOLVED EXTERNAL SYMBOL
    SYMBOL:  PWM_init
    MODULE:  main.obj (MAIN)
*** ERROR L128: REFERENCE MADE TO UNRESOLVED EXTERNAL
    SYMBOL:  PWM_init
    MODULE:  main.obj (MAIN)
    ADDRESS: 0AC6H
Program Size: data=520(near=518) const=208(near=208) code=3288
Target not created

&lt;/pre&gt;
&lt;pre&gt;



&lt;/pre&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ADC for windshield wiper, Error C67: Sensor_value undefined identifier</title><link>https://community.arm.com/thread/106370?ContentTypeID=1</link><pubDate>Mon, 17 Sep 2012 01:18:37 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:a8485bea-9e07-441a-88f6-789a78d4b56b</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
So - what was the result of moving the declaration of the
variable?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ADC for windshield wiper, Error C67: Sensor_value undefined identifier</title><link>https://community.arm.com/thread/80557?ContentTypeID=1</link><pubDate>Sun, 16 Sep 2012 22:38:04 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:cd57671d-fa9a-4a3e-8dd8-557f0415e839</guid><dc:creator>Ken kendall</dc:creator><description>&lt;p&gt;&lt;p&gt;
Sorry didnt notice the markup for code. I&amp;#39;ll repost in a better
format. As for the compiler, not quite sure but im working with C167
on Keil uvision3.&lt;/p&gt;

&lt;pre&gt;
#include &amp;lt;reg167.h&amp;gt; /* special function registers of the C167 */
#include &amp;lt;stdio.h&amp;gt; /* Standard input/output header file */
#include &amp;lt;adc.h&amp;gt; /* ADC Header File */
#include &amp;lt;pwm.h&amp;gt; /* PWM Header File */
#include &amp;lt;timer.h&amp;gt; /* Timer Header Files */


/* Main Program */
void main(void) {
unsigned int ADC_Result;
&lt;b&gt;unsigned int sensor_value;&lt;/b&gt;

/* initialize serial interface, 9600 bps, 8-N-1 */
DP3 |= 0x0400; /* PORT 3.10 DIRECTION CONTROL: OUTPUT (TXD) */
DP3 &amp;amp;= ~0x0800; /* PORT 3.11 DIRECTION CONTROL: INPUT (RXD) */
P3 |= 0x0400; /* PORT 3.10 DATA: HIGH (LINE IDLE) */
S0TIC = 0x80; /* SET TRANSMIT INTERRUPT FLAG (TX COMPLETE) */
S0RIC = 0x00; /* CLEAR RECEIVE INTERRUPT FLAG (NOTHING REC.) */
S0BG = 0x40; /* SET BAUDRATE TO 9600 BAUD */
S0CON = 0x8011; /* SET SERIAL MODE */

/* Initialise ADC */
ADC_init();

/* initialise PWM */
PWM_init();

/* Initialise Timer */
Timer_init();

/* Control the wiper motor, depending on return ADC result */
while(1) {

/* Wait for a sweep cycle to end, to avoid starting a new cycle when one is already running */
while (T3&amp;gt;0) { };

/* Return result from ADC and load it into ADC_Result */
ADC_Result=ADC_read();

/* Normalise by eliminating top bits and rescale to 0-5v */
&lt;b&gt;sensor_value = (ADC_Result &amp;amp; 0x3FF) / 1024 * 5;&lt;/b&gt;

/* Outputs for various states */
&lt;b&gt;if (sensor_value &amp;gt; 4.5) {&lt;/b&gt;
PWM_set(1); /* Sets the Off-Phase to 100% of the pulse width */
PTR3=0; /* Resets PWM */
T3R=0; /* Sets the timer off */
printf(&amp;quot;No Rain Detected!\n&amp;quot;);
}

&lt;b&gt;else if (sensor_value &amp;lt;= 4.5 &amp;amp;&amp;amp; sensor_value &amp;gt;=1.5) {&lt;/b&gt;
PWM_set(0.5); /* Sets the Off-Phase to half of the pulse width */
T3=0x9860; /* Loads a timer value of 2 seconds (Prescale value of 1024) */
T2=0x960; /* Loads auxiliary timer with 2 seconds */
PTR3=1; /* Starts PWM */
T3R=1; /* Starts the timer */
printf(&amp;quot;Few Showers Detected!\n&amp;quot;);

while (T3&amp;gt;0) { }; /* Wait for Sweep cycle to cmplete */
PWM_set(1); /* Sets the duty cycle to zero */
&lt;b&gt;T3=(1.67*sensor_value)-2.5; &lt;/b&gt;/* Loads a delay timer value proportional to the sensor value */
&lt;b&gt;T2=(1.67*sensor_value)-2.5;&lt;/b&gt; /* Loads the auxiliary timer with the same reload value */
T3R=1; /* Starts the timer */
}
&lt;b&gt;else if (sensor_value &amp;lt; 1.5)&lt;/b&gt; {
PWM_set(0); /* Sets the Off-Phase of the pulse width to zero */
T3=0x4C30; /* Loads a timer value of 1 second (Prescale factor of 1024) */
T2=0x4C30; /* Loads the auxiliary timer with 1 second */
PTR3 =1; /* Starts PWM */
T3R =1; /* Starts the timer */
printf(&amp;quot;Heavy Rain Detected!\n&amp;quot;);
}
}
}
&lt;/pre&gt;
&lt;pre&gt;



&lt;/pre&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ADC for windshield wiper, Error C67: Sensor_value undefined identifier</title><link>https://community.arm.com/thread/67714?ContentTypeID=1</link><pubDate>Sun, 16 Sep 2012 22:04:32 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:82e3ff3a-9b95-4f6c-acf6-2e84fd181cb4</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
Do you work with a compiler that supports having new variables
within blocks, and not just directly at start of functions?&lt;/p&gt;

&lt;p&gt;
By the way - you found the markup for bold text. You didn&amp;#39;t see
the markup for code? Does your post look readable with free-flowing
text instead of using the original line breaks and indentation?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>