And "unsigned long" would be how many bit????<div class="quote" style="line-height: 1.5"><br><br>-------- Original Message --------<br>Subject: Re: [chbot] Programming 8-bit microcontrollers<br>From: Synco Reynders <synco.reynders@gmail.com><br>To: Christchurch Robotics <chchrobotics@lists.linuxnut.co.nz><br>CC: <br><br><br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>To get a nice value for 'setting' you should cast to be 32 bit before multiplying. Like:</div>ms = (uint32_t) setting *1000<div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 23 September 2016 at 15:34, Volker Kuhlmann <span dir="ltr"><<a href="mailto:list0570@paradise.net.nz" target="_blank">list0570@paradise.net.nz</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This is for AVR, but should hold for any 8-bit job. Spot the problems:<br>
<br>
static const uint16_t setting = 15*60;<br>
class values {<br>
uint8_t a, b, c;<br>
uint32_t d;<br>
uint8_t e;<br>
uint16_t f;<br>
};<br>
static const values defaults {<br>
50, 1, 10, 0xFFB070, 5, 0x03FF<br>
};<br>
void func() {<br>
unsigned long ms;<br>
ms = setting * 1000;<br>
...<br>
}<br>
<br>
The program doesn't work in 2 places.<br>
<br>
First solution wins a free copy of the night light firmware.<br>
<br>
First correct solution wins 2 free copies of the night light firmware.<br>
<br>
Prize giving on Monday...<br>
<span class="HOEnZb"><font color="#888888"><br>
Volker<br>
<br>
--<br>
Volker Kuhlmann<br>
<a href="http://volker.top.geek.nz/" rel="noreferrer" target="_blank">http://volker.top.geek.nz/</a> Please do not CC list postings to me.<br>
<br>
______________________________<wbr>_________________<br>
Chchrobotics mailing list <a href="mailto:Chchrobotics@lists.linuxnut.co.nz">Chchrobotics@lists.linuxnut.<wbr>co.nz</a><br>
<a href="http://lists.ourshack.com/mailman/listinfo/chchrobotics" rel="noreferrer" target="_blank">http://lists.ourshack.com/<wbr>mailman/listinfo/chchrobotics</a><br>
Mail Archives: <a href="http://lists.ourshack.com/pipermail/chchrobotics/" rel="noreferrer" target="_blank">http://lists.ourshack.com/<wbr>pipermail/chchrobotics/</a><br>
Meetings usually 3rd Monday each month. See <a href="http://kiwibots.org" rel="noreferrer" target="_blank">http://kiwibots.org</a> for venue, directions and dates.<br>
When replying, please edit your Subject line to reflect new subjects.<br>
</font></span></blockquote></div><br></div>
</blockquote></div>