1 00:00:11,920 --> 00:00:14,880 Phil King, and it's 8-Bit Redux Microcontroller Hacking. 2 00:00:15,000 --> 00:00:17,400 There's a few things I just need to say up front. 3 00:00:17,720 --> 00:00:20,280 I apologize if my demeanor is a little strange. 4 00:00:20,440 --> 00:00:22,840 My laptop sucks in more ways than I can possibly relate, 5 00:00:23,000 --> 00:00:25,220 so I'm actually going to be working off the same screen you're looking at. 6 00:00:25,380 --> 00:00:26,820 If this seems a little odd, I apologize. 7 00:00:28,980 --> 00:00:33,340 But to give you an idea of what's going on, who am I? 8 00:00:33,380 --> 00:00:36,780 I'm Phil King, and specifically I'm a hardware engineer right now 9 00:00:36,780 --> 00:00:38,620 who does a lot of embedded systems development. 10 00:00:39,800 --> 00:00:44,340 Specifically, I'm working on IR wireless networking at a place called NetSchools. 11 00:00:44,820 --> 00:00:49,920 I've also been a game developer and a hardware enthusiast for at least 10 years now, 12 00:00:51,220 --> 00:00:54,420 and hopefully what you're going to get out of this is some of the fun that I've had 13 00:00:54,420 --> 00:00:55,880 with 8-bit system development. 14 00:00:59,340 --> 00:01:00,160 Who are you? 15 00:01:00,480 --> 00:01:04,860 To be getting anything particularly useful out of this, I sort of tried to develop a profile. 16 00:01:05,160 --> 00:01:08,140 You know the basics of electronics and electronic logic. 17 00:01:09,380 --> 00:01:11,540 This is why I ended up in the Uber Hexer track, 18 00:01:11,660 --> 00:01:16,600 just a prerequisite that you are at least familiar with some of the basic terms. 19 00:01:17,380 --> 00:01:19,940 You know how to code, preferably in assembly language, 20 00:01:20,080 --> 00:01:22,160 for reasons I'm going to get to in a little more detail later. 21 00:01:22,420 --> 00:01:25,220 You believe that 1K is actually useful space. 22 00:01:29,300 --> 00:01:32,200 It is surprising how much you can do in 1K. 23 00:01:32,280 --> 00:01:34,140 It's surprising how few people do it anymore. 24 00:01:34,820 --> 00:01:38,700 But as I'll get into the architecture of some specific examples, 25 00:01:39,240 --> 00:01:44,160 1K is usually enough to do almost anything you want to do with an 8-bit embedded controller. 26 00:01:45,620 --> 00:01:47,460 Presumably you've built more software than hardware, 27 00:01:47,620 --> 00:01:49,860 which is hopefully why you're here to get something out of my talk. 28 00:01:50,200 --> 00:01:53,040 And you know you could do this stuff if you could just get started. 29 00:01:53,160 --> 00:01:54,760 And that's what I'm primarily hoping to do, 30 00:01:54,820 --> 00:01:56,640 is direct you to get yourself set up. 31 00:01:56,820 --> 00:01:58,420 You have a small development environment, a lab, 32 00:01:58,540 --> 00:02:00,080 so you can play with this stuff. 33 00:02:02,720 --> 00:02:04,820 Basically I'll cover what are microcontrollers, 34 00:02:04,920 --> 00:02:05,720 how to set up your lab, 35 00:02:06,000 --> 00:02:08,760 how to get some parts once you know what you want to be developing, 36 00:02:09,580 --> 00:02:12,840 some basic rules of thumb for building and debugging, 37 00:02:13,180 --> 00:02:16,700 an example project, which I will just give a cursory overview of, 38 00:02:16,880 --> 00:02:20,540 and the traditional inspirational message that has to go at every talk. 39 00:02:21,940 --> 00:02:23,240 Things I won't be covering. 40 00:02:23,460 --> 00:02:26,580 You will not see a lot of architectural specific details. 41 00:02:26,820 --> 00:02:28,920 Anything that comes off a datasheet, you can look up yourself, 42 00:02:29,080 --> 00:02:30,580 and you don't need me reciting. 43 00:02:30,680 --> 00:02:33,040 There are literally thousands of different variations of microcontrollers, 44 00:02:33,800 --> 00:02:36,500 and what you specifically need is going to depend on your application. 45 00:02:37,040 --> 00:02:38,880 I also will avoid religious arguments, 46 00:02:39,040 --> 00:02:40,820 which are usually tightly coupled to datasheet details. 47 00:02:41,980 --> 00:02:43,380 I'm not going to tell you how to write code. 48 00:02:43,700 --> 00:02:44,420 Presumably you know that. 49 00:02:44,680 --> 00:02:45,860 I'm not going to tell you how to solder. 50 00:02:46,060 --> 00:02:47,800 I'm not going to tell you how to tell an elm from an app. 51 00:02:48,080 --> 00:02:50,900 If you aren't familiar with the terminology, don't give up, 52 00:02:50,940 --> 00:02:53,700 but I would encourage you to get some basic electronics texts, 53 00:02:53,820 --> 00:02:55,020 and just find out, 54 00:02:55,020 --> 00:02:56,860 just learn the vocabulary. 55 00:02:57,460 --> 00:02:59,160 I won't tell you how to use NoScope, 56 00:02:59,240 --> 00:03:01,140 and I won't tell you how to hack cell phones. 57 00:03:02,420 --> 00:03:03,240 Oh, sorry. 58 00:03:04,960 --> 00:03:06,560 These are from a different talk. 59 00:03:09,400 --> 00:03:09,880 Okay. 60 00:03:10,740 --> 00:03:11,360 Thank you. 61 00:03:13,440 --> 00:03:14,300 Sorry about that. 62 00:03:19,480 --> 00:03:21,460 So what do you find in a microcontroller? 63 00:03:22,060 --> 00:03:24,860 The one thing that unifies them is, of course, 64 00:03:25,020 --> 00:03:25,700 the microprocessor core. 65 00:03:26,580 --> 00:03:29,380 The original 8-bit microprocessors that we're all familiar with, 66 00:03:29,480 --> 00:03:31,580 the Z80, the 6502, and so on, 67 00:03:31,720 --> 00:03:34,260 were self-contained devices that had an address and data bus, 68 00:03:34,420 --> 00:03:38,940 and basically were unified architecture processors 69 00:03:38,940 --> 00:03:40,520 that could do general purpose computing. 70 00:03:41,440 --> 00:03:43,120 Microcontrollers have taken those cores, 71 00:03:43,240 --> 00:03:44,800 or later variants of them, 72 00:03:44,880 --> 00:03:46,900 and embedded them on the same die with other resources. 73 00:03:47,180 --> 00:03:49,360 Specifically, what usually denotes a microcontroller 74 00:03:49,360 --> 00:03:51,220 is that you will have some onboard memory. 75 00:03:51,540 --> 00:03:54,540 And I know that it could be ROM, Flash, EEPROM, 76 00:03:55,080 --> 00:03:56,580 something that's interesting is that 77 00:03:56,580 --> 00:03:58,920 some of the devices that are one-time programmable, 78 00:03:59,080 --> 00:04:01,300 which is to say they can only be programmed once, 79 00:04:01,520 --> 00:04:02,700 are actually erasable devices. 80 00:04:02,800 --> 00:04:04,720 They just haven't been put in a package that you can erase. 81 00:04:05,840 --> 00:04:07,760 Another thing you will find on microcontrollers 82 00:04:07,760 --> 00:04:09,720 is they generally don't have an address and data bus. 83 00:04:09,820 --> 00:04:11,600 They have programmable I.O. ports 84 00:04:12,260 --> 00:04:14,200 where you set port directions, 85 00:04:14,400 --> 00:04:15,460 you can twiddle the I.O. pins, 86 00:04:15,680 --> 00:04:18,000 but all of the specific bus interactions 87 00:04:18,000 --> 00:04:19,480 are taking place inside the device. 88 00:04:19,780 --> 00:04:22,740 And then there's a library of peripherals 89 00:04:22,740 --> 00:04:24,520 that you'll find stuck on the most microcontrollers. 90 00:04:24,540 --> 00:04:27,380 The most common are UARTs, 91 00:04:27,380 --> 00:04:29,080 A to D, and D to A converters. 92 00:04:29,480 --> 00:04:30,860 So that you can do small, 93 00:04:31,640 --> 00:04:34,500 completely self-contained solutions. 94 00:04:35,040 --> 00:04:35,820 In fact, 95 00:04:35,920 --> 00:04:37,400 a lot of the smaller parts 96 00:04:37,400 --> 00:04:39,900 have an RC oscillator built into them 97 00:04:39,900 --> 00:04:41,620 so that you don't even need to clock them externally. 98 00:04:41,660 --> 00:04:43,120 You can actually set a bit 99 00:04:43,120 --> 00:04:44,400 when you're programming it to clock itself, 100 00:04:45,060 --> 00:04:47,740 usually at some nominal slower rate, 101 00:04:47,900 --> 00:04:49,760 but it becomes a self-contained device 102 00:04:49,760 --> 00:04:51,300 where you literally just add power 103 00:04:51,300 --> 00:04:54,000 and it twiddles the I.O.s to do your bidding. 104 00:04:54,100 --> 00:04:54,520 Thank you. 105 00:04:56,260 --> 00:04:58,280 And why is this useful? 106 00:04:58,860 --> 00:05:01,720 You can create really cool, tiny little systems. 107 00:05:01,900 --> 00:05:02,860 It's really compelling 108 00:05:02,860 --> 00:05:04,560 when you have an 8-bit DIP package 109 00:05:04,560 --> 00:05:06,380 that's doing something that you told it to do. 110 00:05:06,760 --> 00:05:08,780 It's nice to create cool software projects, 111 00:05:08,940 --> 00:05:10,580 but there's something particularly gratifying 112 00:05:10,580 --> 00:05:11,160 about hardware. 113 00:05:11,900 --> 00:05:12,420 Ubiquity. 114 00:05:12,700 --> 00:05:15,060 One of my favorite comments on this was 115 00:05:15,060 --> 00:05:18,840 in a 1976 small computing conference at MIT, 116 00:05:19,080 --> 00:05:20,460 they were talking about how computers 117 00:05:20,460 --> 00:05:21,860 were going to become ubiquitous, 118 00:05:21,940 --> 00:05:24,400 but of course there is a logical extension 119 00:05:24,540 --> 00:05:25,780 beyond which this will not go. 120 00:05:26,000 --> 00:05:28,020 For example, it's not like you need 121 00:05:28,020 --> 00:05:29,640 a microprocessor in every doorknob. 122 00:05:30,160 --> 00:05:32,140 If you've checked your door at the hotel here, 123 00:05:32,280 --> 00:05:34,100 there is in fact now a microprocessor 124 00:05:34,100 --> 00:05:35,040 in every doorknob. 125 00:05:35,760 --> 00:05:36,580 Low cost. 126 00:05:37,080 --> 00:05:38,880 Economies of scale are driving the cost 127 00:05:38,880 --> 00:05:40,640 of 8-bit microcontrollers into the floor, 128 00:05:40,760 --> 00:05:42,540 and it's great because you can buy individual parts 129 00:05:42,540 --> 00:05:43,440 for one to two bucks. 130 00:05:44,080 --> 00:05:46,980 Even the high-performance, high-end 131 00:05:46,980 --> 00:05:49,660 8-bit microcontrollers are seldom more than 10, 132 00:05:49,820 --> 00:05:52,160 and in large quantities you will find 133 00:05:52,160 --> 00:05:54,940 that they replace random logic efficiently, 134 00:05:55,100 --> 00:05:56,920 because some of the parts I've seen 135 00:05:56,920 --> 00:05:58,800 in super high production quantities 136 00:05:58,800 --> 00:06:00,060 are as low as 40 cents a piece. 137 00:06:01,060 --> 00:06:02,740 You get surprisingly high performance. 138 00:06:03,000 --> 00:06:05,160 CMOS can go really fast 139 00:06:05,160 --> 00:06:06,940 even if you're only shuffling 8-bits at a time. 140 00:06:07,060 --> 00:06:08,420 There's a company called Scenics, for example, 141 00:06:08,420 --> 00:06:10,620 that makes a 100 MHz 8-bit microcontroller. 142 00:06:12,640 --> 00:06:13,960 And then simply, scalability. 143 00:06:14,200 --> 00:06:16,400 There is a huge design space you get to play in. 144 00:06:17,380 --> 00:06:18,640 What do you not get? 145 00:06:19,320 --> 00:06:20,800 You don't get lots of memory. 146 00:06:20,960 --> 00:06:21,640 As I was saying, 147 00:06:21,640 --> 00:06:23,800 1K of code space is a usable 148 00:06:24,360 --> 00:06:25,740 and fairly typical amount. 149 00:06:26,000 --> 00:06:27,760 This isn't to say you can't get a lot of memory. 150 00:06:27,800 --> 00:06:29,280 You can buy microcontrollers that have 151 00:06:29,280 --> 00:06:31,200 128K of code space on them, 152 00:06:31,360 --> 00:06:33,620 but unless you're doing something 153 00:06:33,620 --> 00:06:34,880 that really needs to be moving, 154 00:06:35,080 --> 00:06:37,060 that really needs that large an image, 155 00:06:37,180 --> 00:06:39,040 you're probably missing part of the point. 156 00:06:39,640 --> 00:06:41,420 And so I encourage you to know your code. 157 00:06:41,540 --> 00:06:42,740 Beware of compiler assumptions, 158 00:06:43,020 --> 00:06:45,480 and then recursion versus the too-deep stack. 159 00:06:45,800 --> 00:06:47,400 One of the nice things about playing 160 00:06:47,400 --> 00:06:49,460 with the microcontrollers is you get to know 161 00:06:49,460 --> 00:06:51,320 about what's going on at the meta level. 162 00:06:52,920 --> 00:06:54,740 In the AVR microcontroller, 163 00:06:54,840 --> 00:06:56,060 which is one that I'm using right now, 164 00:06:56,360 --> 00:06:58,840 the lower end versions have a separate, 165 00:06:59,020 --> 00:07:00,780 it's called a Harvard architecture, 166 00:07:00,960 --> 00:07:03,420 so you have a separate code and data space, 167 00:07:03,700 --> 00:07:04,860 and the two don't meet. 168 00:07:05,060 --> 00:07:06,180 And they've actually implemented 169 00:07:07,380 --> 00:07:09,480 the stack as a third separate 170 00:07:09,480 --> 00:07:10,660 hardware data space. 171 00:07:10,860 --> 00:07:12,780 It's only three elements deep. 172 00:07:13,060 --> 00:07:14,500 If you try to recurse with only 173 00:07:14,500 --> 00:07:15,180 a three-deep stack, 174 00:07:15,320 --> 00:07:15,980 you're going to be in trouble. 175 00:07:16,960 --> 00:07:18,300 And then finally, like I said, 176 00:07:18,320 --> 00:07:20,380 you don't have typically a complex memory interface. 177 00:07:21,640 --> 00:07:23,620 Some microcontrollers have only a programmed IO port. 178 00:07:23,840 --> 00:07:25,300 If you want to get something in and out 179 00:07:25,300 --> 00:07:27,100 of an external memory, you actually twiddle 180 00:07:27,100 --> 00:07:28,440 the address and data lines manually. 181 00:07:28,980 --> 00:07:31,240 There are some microcontrollers that let you assign 182 00:07:31,240 --> 00:07:33,100 some of the ports to be a memory interface, 183 00:07:33,460 --> 00:07:35,380 but even in that case, they make assumptions. 184 00:07:35,580 --> 00:07:36,800 For example, they own the memory. 185 00:07:37,140 --> 00:07:39,380 In even the old 6502, 186 00:07:39,520 --> 00:07:41,980 you had a memory-ready indicator 187 00:07:41,980 --> 00:07:43,640 so that you could hold off memory accesses, 188 00:07:44,400 --> 00:07:46,080 which would allow you to have 189 00:07:46,080 --> 00:07:48,120 a DRAM subsystem or something that's slow. 190 00:07:48,240 --> 00:07:49,560 You could have a memory that you don't have 191 00:07:49,560 --> 00:07:50,460 complete control over. 192 00:07:51,640 --> 00:07:52,420 You could make the assumption that it's 193 00:07:52,420 --> 00:07:53,260 the center of the universe. 194 00:07:55,440 --> 00:07:57,200 Okay, so you want to set up your lab. 195 00:07:57,440 --> 00:07:58,180 What are you going to need? 196 00:07:58,220 --> 00:07:59,240 What are you going to want? 197 00:07:59,400 --> 00:08:01,420 You're going to want a 128-channel logic analyzer, 198 00:08:01,480 --> 00:08:03,840 a 4-channel 2GHz oscilloscope, 199 00:08:04,080 --> 00:08:06,280 a full system ice, and a universal device programmer. 200 00:08:07,380 --> 00:08:09,740 After you've laid out your $38,000, 201 00:08:11,100 --> 00:08:12,020 what do you really need? 202 00:08:12,780 --> 00:08:14,300 You need a digital multimeter. 203 00:08:16,220 --> 00:08:17,980 You can spend a lot of money 204 00:08:17,980 --> 00:08:18,760 on a digital multimeter. 205 00:08:18,940 --> 00:08:19,780 You don't have to. 206 00:08:19,880 --> 00:08:21,240 This is a RadioShack special. 207 00:08:21,640 --> 00:08:23,500 It does 90% of everything you will ever need. 208 00:08:23,740 --> 00:08:25,360 It's normally, I think, like $22. 209 00:08:25,580 --> 00:08:26,740 I got it on sale for $16. 210 00:08:28,060 --> 00:08:29,420 It's accurate to 5%. 211 00:08:29,420 --> 00:08:30,660 It tells you what voltages are. 212 00:08:30,860 --> 00:08:33,380 All it does is extend your senses 213 00:08:33,380 --> 00:08:34,780 to be able to tell, are two points 214 00:08:34,780 --> 00:08:36,000 electrically connected together? 215 00:08:36,820 --> 00:08:38,540 Is there a voltage across two points? 216 00:08:38,700 --> 00:08:40,660 It does most of what you need 217 00:08:40,660 --> 00:08:41,900 out of a $100 fluke scope. 218 00:08:42,560 --> 00:08:44,820 A logic probe. 219 00:08:45,100 --> 00:08:47,960 A logic probe is just an LED on a stick 220 00:08:47,960 --> 00:08:49,620 that tells you the state of a pin. 221 00:08:49,900 --> 00:08:51,040 The reason it's useful 222 00:08:51,640 --> 00:08:54,480 is that you can stick an LED on a signal, 223 00:08:54,540 --> 00:08:55,740 figure out what the state of it is, 224 00:08:55,880 --> 00:08:56,700 but you're loading it. 225 00:08:56,820 --> 00:08:58,800 You can stick a driver in an LED on a signal 226 00:08:58,800 --> 00:09:00,060 and find out what the state of it is, 227 00:09:00,120 --> 00:09:02,280 but you can only tell as fast as you can see. 228 00:09:02,560 --> 00:09:03,960 Logic probes will generally be able 229 00:09:03,960 --> 00:09:05,300 to detect transient events. 230 00:09:06,800 --> 00:09:08,860 For example, if something is turning on 231 00:09:08,860 --> 00:09:10,240 for one millisecond every second, 232 00:09:10,380 --> 00:09:11,160 you're not going to see that. 233 00:09:11,340 --> 00:09:12,340 A logic probe will. 234 00:09:13,060 --> 00:09:15,420 It's just a little chunk of logic hooked up to an LED. 235 00:09:15,600 --> 00:09:17,780 It's typically $15 for a cheap one. 236 00:09:17,780 --> 00:09:19,100 Again, you can spend a lot more, 237 00:09:19,200 --> 00:09:21,960 but I got a cheap $15 logic probe 238 00:09:21,960 --> 00:09:23,120 that does pretty much everything I need. 239 00:09:23,780 --> 00:09:25,120 A microcontroller starter kit 240 00:09:25,120 --> 00:09:27,460 is what you're going to use 241 00:09:27,460 --> 00:09:29,500 to develop and test your code. 242 00:09:29,640 --> 00:09:31,280 I've got an example of one here. 243 00:09:33,080 --> 00:09:35,940 Let me show you what the hardware looks like. 244 00:09:35,980 --> 00:09:38,380 Unfortunately, I did not take any pictures of this 245 00:09:38,380 --> 00:09:40,040 to get it set up on the slides. 246 00:09:40,480 --> 00:09:45,080 But it is a remarkably simple little board. 247 00:09:45,840 --> 00:09:47,600 You've got a couple of serial ports 248 00:09:47,780 --> 00:09:48,260 going into it. 249 00:09:48,340 --> 00:09:49,440 You've got some LEDs and buttons. 250 00:09:49,660 --> 00:09:51,100 You've got some headers so you can plug it 251 00:09:51,100 --> 00:09:52,480 into the outside world if you want to. 252 00:09:53,080 --> 00:09:56,180 And then all you do is you download your code 253 00:09:56,180 --> 00:09:57,100 from your development environment. 254 00:09:58,440 --> 00:10:00,000 Which brings me to the development environment. 255 00:10:00,320 --> 00:10:02,700 I say a PC probably running Windows 256 00:10:02,700 --> 00:10:04,640 even knowing that that will get me stoned 257 00:10:04,640 --> 00:10:05,260 with this audience. 258 00:10:06,120 --> 00:10:09,380 There are lots of good development tools 259 00:10:09,380 --> 00:10:10,480 that will run under Linux. 260 00:10:10,600 --> 00:10:11,640 And there's more coming every day. 261 00:10:11,700 --> 00:10:14,580 Or will run under all sorts of alternate operating systems. 262 00:10:15,100 --> 00:10:15,820 The good ones. 263 00:10:17,780 --> 00:10:18,720 One of them is though that the manufacturers 264 00:10:18,720 --> 00:10:20,820 are selling to the commercial market 265 00:10:20,820 --> 00:10:22,100 and the commercial market is still pushing 266 00:10:22,100 --> 00:10:23,560 the Windows development tools. 267 00:10:23,840 --> 00:10:26,960 So double boot your machine and bring up Windows 268 00:10:26,960 --> 00:10:28,880 every time you need to actually use their IDE 269 00:10:28,880 --> 00:10:30,120 and then throw it away when you're done. 270 00:10:31,340 --> 00:10:33,520 Other useful stuff you'll probably want to have around. 271 00:10:33,740 --> 00:10:34,200 A breadboard. 272 00:10:34,400 --> 00:10:35,880 You can spend 20 bucks and a breadboard 273 00:10:35,880 --> 00:10:38,260 is just a matrix of plug points 274 00:10:38,260 --> 00:10:39,500 that you can drop chips into 275 00:10:39,500 --> 00:10:41,920 and it gives you a way of wiring things together quickly. 276 00:10:42,460 --> 00:10:43,180 A power supply. 277 00:10:43,540 --> 00:10:46,160 The great thing about this particular development board 278 00:10:47,780 --> 00:10:48,120 is that it's really forgiving 279 00:10:48,120 --> 00:10:49,900 on what you can put into them as power. 280 00:10:50,200 --> 00:10:52,340 They've got a regulator on here 281 00:10:52,340 --> 00:10:54,720 so if you feed it anywhere from 6 to 15 volts 282 00:10:54,720 --> 00:10:57,340 AC or DC of any polarity 283 00:10:57,340 --> 00:10:57,940 it's happy. 284 00:10:59,380 --> 00:11:00,740 It fixes it for you. 285 00:11:03,520 --> 00:11:04,460 An oscilloscope. 286 00:11:04,640 --> 00:11:06,980 I jokingly mentioned the 2 gigahertz 287 00:11:06,980 --> 00:11:08,940 4 channel oscilloscope as something 288 00:11:08,940 --> 00:11:10,020 you want but don't need. 289 00:11:10,260 --> 00:11:11,680 An oscilloscope is a useful thing 290 00:11:11,680 --> 00:11:13,240 and you can get them fairly cheaply 291 00:11:13,240 --> 00:11:14,240 or you can build your own. 292 00:11:17,780 --> 00:11:19,500 A static analyzer just lets you look at multiple channels. 293 00:11:19,780 --> 00:11:21,300 The only reason that's particularly useful 294 00:11:21,300 --> 00:11:22,940 is if you've got multiple data signals 295 00:11:22,940 --> 00:11:24,880 and you want to see what they're doing relative to one another 296 00:11:24,880 --> 00:11:27,100 you need to be able to capture them all at the same time. 297 00:11:27,660 --> 00:11:29,920 There's a ton of debugging you can do by inferring. 298 00:11:30,020 --> 00:11:32,200 By just knowing what has to be going on 299 00:11:32,680 --> 00:11:34,120 because that's the way you built it 300 00:11:34,120 --> 00:11:35,440 but occasionally things don't work 301 00:11:35,440 --> 00:11:36,220 the way you built them. 302 00:11:46,200 --> 00:11:47,260 As an aside 303 00:11:47,780 --> 00:11:49,280 I am used to doing this talk 304 00:11:49,280 --> 00:11:50,980 to a group of about 15 people at a time 305 00:11:50,980 --> 00:11:52,600 and it's generally a much more interactive thing 306 00:11:52,600 --> 00:11:56,060 which is why I'm sort of going off in all directions at once 307 00:11:56,060 --> 00:11:58,080 and why I'm trying desperately to cling to my slides 308 00:11:58,080 --> 00:11:59,960 because they are my touchstone with reality. 309 00:12:00,980 --> 00:12:01,660 The data books 310 00:12:03,500 --> 00:12:05,160 Data books you can get from manufacturers 311 00:12:05,880 --> 00:12:07,580 can be useful but for the most part 312 00:12:07,580 --> 00:12:09,780 they are out of date the day they roll off the press. 313 00:12:10,160 --> 00:12:11,220 The web is your friend 314 00:12:11,220 --> 00:12:13,080 and application engineers are your friends. 315 00:12:13,240 --> 00:12:15,060 They will provide you the information you need to know 316 00:12:15,780 --> 00:12:17,560 and I would encourage you to go ahead 317 00:12:17,780 --> 00:12:18,680 and call up the manufacturers 318 00:12:18,680 --> 00:12:21,140 and order printed copies of things like the instruction set 319 00:12:21,140 --> 00:12:22,400 because you need to know this stuff 320 00:12:22,400 --> 00:12:24,320 but for specifics about parts 321 00:12:24,320 --> 00:12:25,760 pull down the datasheet 322 00:12:25,760 --> 00:12:27,780 because you'll find out that datasheets often refer to 323 00:12:27,780 --> 00:12:30,260 the D and F version of this part 324 00:12:30,260 --> 00:12:32,060 after they fixed all the preliminary bugs. 325 00:12:33,440 --> 00:12:34,880 And then share and enjoy 326 00:12:34,880 --> 00:12:37,740 you will find a vast amount of interesting cool stuff 327 00:12:37,740 --> 00:12:39,120 about what people are doing online. 328 00:12:42,100 --> 00:12:43,640 So when you're trying to get your parts 329 00:12:43,640 --> 00:12:45,140 first thing to keep in mind 330 00:12:45,140 --> 00:12:47,520 the manufacturer's job is to sell you parts. 331 00:12:47,780 --> 00:12:49,120 They can be very helpful 332 00:12:49,120 --> 00:12:51,580 but call your thing, whatever you're building, 333 00:12:51,740 --> 00:12:52,380 a product. 334 00:12:52,740 --> 00:12:54,140 They build products. 335 00:12:54,540 --> 00:12:57,360 If you call up and say, hi, I'm building this thing 336 00:12:57,360 --> 00:12:59,780 they will hand you off to a person 337 00:12:59,780 --> 00:13:01,560 who handles evolving accounts 338 00:13:01,560 --> 00:13:03,520 or developing accounts 339 00:13:03,520 --> 00:13:05,820 which means you get shunted off into a backwater 340 00:13:05,820 --> 00:13:07,480 and they don't really take you seriously. 341 00:13:07,720 --> 00:13:08,980 They won't take you seriously anyway 342 00:13:09,580 --> 00:13:11,380 but you can mitigate that damage. 343 00:13:12,920 --> 00:13:13,940 Project realistic volumes 344 00:13:14,480 --> 00:13:15,440 which is to say 345 00:13:15,960 --> 00:13:17,520 don't tell them you're going to be producing 346 00:13:17,780 --> 00:13:18,980 two and a half billion of your project 347 00:13:19,720 --> 00:13:21,820 but I'm going to be doing one to five thousand 348 00:13:21,820 --> 00:13:22,540 this year. 349 00:13:22,720 --> 00:13:24,660 That leaves open that of course the volumes 350 00:13:24,660 --> 00:13:25,380 will be ramping up. 351 00:13:26,220 --> 00:13:28,060 Engineering samples are a great thing. 352 00:13:29,520 --> 00:13:30,480 Generally if you can 353 00:13:30,480 --> 00:13:32,000 try not to talk to humans. 354 00:13:32,480 --> 00:13:34,840 My favorite example of this is the Maxim website 355 00:13:35,760 --> 00:13:37,900 allows you to get Maxim's integrated circuits 356 00:13:37,900 --> 00:13:39,160 I believe up to eight or ten devices 357 00:13:39,160 --> 00:13:40,860 completely off a form on their website 358 00:13:40,860 --> 00:13:42,000 you never have to talk to a person. 359 00:13:42,520 --> 00:13:44,200 You will talk to a lot of representatives. 360 00:13:44,460 --> 00:13:46,740 The manufacturers don't generally want to interact 361 00:13:47,780 --> 00:13:48,420 with the customers 362 00:13:48,420 --> 00:13:49,880 whether they're design engineers 363 00:13:49,880 --> 00:13:52,260 or just people calling for general information. 364 00:13:52,620 --> 00:13:54,600 So they keep the layer of the representatives 365 00:13:54,600 --> 00:13:55,640 the manufacturers' representatives 366 00:13:55,640 --> 00:13:56,660 between you and them. 367 00:13:56,760 --> 00:13:58,460 They usually have pointers to these on their website 368 00:13:58,460 --> 00:13:59,480 maintain a rolodex. 369 00:13:59,720 --> 00:14:02,000 These guys' only job is to know your name 370 00:14:02,000 --> 00:14:03,260 and to try to get you what you need 371 00:14:03,260 --> 00:14:05,260 as long as they believe that your product 372 00:14:05,260 --> 00:14:07,200 will be producing two and a half billion units 373 00:14:07,200 --> 00:14:08,080 sometime in a few years. 374 00:14:08,980 --> 00:14:11,200 And then finally know what you want. 375 00:14:11,480 --> 00:14:13,800 I point this out. It seemed obvious 376 00:14:17,780 --> 00:14:17,960 to me that there are a lot of 377 00:14:17,960 --> 00:14:18,400 different versions of every part. 378 00:14:18,500 --> 00:14:19,300 If you call up and say, 379 00:14:19,400 --> 00:14:21,800 Hi, I want an Atmel AVR microcontroller 380 00:14:21,800 --> 00:14:24,800 you've just narrowed it down to about 140 parts. 381 00:14:25,240 --> 00:14:29,560 If you say I want an Atmel AT901200 382 00:14:29,560 --> 00:14:31,760 you've narrowed it down to a family of about ten. 383 00:14:32,160 --> 00:14:33,900 But you have to specify everything. 384 00:14:34,180 --> 00:14:35,960 So if you don't specify something 385 00:14:35,960 --> 00:14:37,340 they will often provide you parts 386 00:14:37,340 --> 00:14:39,500 which they pick at random from whatever they have on hand. 387 00:14:39,840 --> 00:14:42,120 Just be aware of how the part numbering scheme works 388 00:14:42,120 --> 00:14:43,900 and try to present complete information. 389 00:14:44,640 --> 00:14:45,500 And then finally 390 00:14:45,500 --> 00:14:46,380 buy what you must. 391 00:14:47,780 --> 00:14:48,020 There are a lot of good sources 392 00:14:48,020 --> 00:14:49,640 for small quantity parts. 393 00:14:49,840 --> 00:14:52,160 Digikey and JDR microdevices are two of my favorites. 394 00:14:55,100 --> 00:14:56,560 So once you've got your parts together 395 00:14:56,560 --> 00:14:57,660 and you've put your lab together 396 00:14:57,660 --> 00:14:58,720 and you've got your development board 397 00:14:58,720 --> 00:14:59,380 and you're building, 398 00:14:59,900 --> 00:15:01,200 how are you actually going to wire 399 00:15:01,200 --> 00:15:03,060 whatever your prototype thing is? 400 00:15:03,720 --> 00:15:06,180 Breadboards are good, as I mentioned earlier, 401 00:15:06,300 --> 00:15:07,200 for wiring things up quickly 402 00:15:07,200 --> 00:15:08,820 for doing small projects. 403 00:15:09,860 --> 00:15:11,760 Breadboards, as I said, are a matrix of interconnect 404 00:15:11,760 --> 00:15:13,020 where you're just plugging boards 405 00:15:17,780 --> 00:15:17,980 and you're doing small things. 406 00:15:17,980 --> 00:15:20,440 If you are trying to do anything at 10 gigahertz 407 00:15:20,440 --> 00:15:22,920 I'm sorry, at even 10 megahertz 408 00:15:22,920 --> 00:15:25,620 you will find that you have signal integrity problems. 409 00:15:26,580 --> 00:15:27,760 Protoboard and wire wrap 410 00:15:27,760 --> 00:15:29,600 is where you take a piece of 411 00:15:29,600 --> 00:15:32,020 perfboard and you stick sockets in it 412 00:15:32,020 --> 00:15:33,000 and you wire wrap them together. 413 00:15:33,460 --> 00:15:35,120 It's surprisingly old 414 00:15:35,120 --> 00:15:36,420 and surprisingly good technology. 415 00:15:36,640 --> 00:15:38,660 A wire wrap board will be good for up to 416 00:15:38,660 --> 00:15:40,820 a 10 megahertz application typically. 417 00:15:41,380 --> 00:15:43,400 And then finally I mentioned 418 00:15:43,400 --> 00:15:45,000 the joy and agony of surface mount devices. 419 00:15:45,460 --> 00:15:47,560 As form factor has gotten smaller 420 00:15:47,780 --> 00:15:48,460 on virtually everything, 421 00:15:48,820 --> 00:15:51,240 surface mount is often the only form factor 422 00:15:51,240 --> 00:15:53,160 a lot of parts are available in. 423 00:15:53,440 --> 00:15:55,400 And the only way you can really use 424 00:15:55,400 --> 00:15:57,960 a surface mount device is to solder it down 425 00:15:57,960 --> 00:15:59,880 or at least solder wires onto it. 426 00:15:59,960 --> 00:16:00,960 It's a real pain in the butt 427 00:16:00,960 --> 00:16:03,300 and I would encourage you to look into 428 00:16:03,300 --> 00:16:04,620 surface mount breakout boards. 429 00:16:04,840 --> 00:16:06,640 They're just boards that have a surface mount 430 00:16:07,140 --> 00:16:09,080 set of pads that you can stick a part onto 431 00:16:09,080 --> 00:16:10,260 and then bring wires out from. 432 00:16:10,620 --> 00:16:13,040 It's useful because it means that you can 433 00:16:13,040 --> 00:16:14,640 then run things at much higher speeds 434 00:16:14,640 --> 00:16:17,000 and finally if you're actually building a system 435 00:16:17,780 --> 00:16:19,260 with a few parts, you might want to consider 436 00:16:19,260 --> 00:16:20,460 doing your own printed circuit board. 437 00:16:21,060 --> 00:16:23,620 That's sort of beyond the scope of this overview 438 00:16:23,620 --> 00:16:25,660 but there's a lot of good tools 439 00:16:25,660 --> 00:16:27,520 for doing simple board layout 440 00:16:27,520 --> 00:16:29,180 and you can actually fabricate them by hand. 441 00:16:32,500 --> 00:16:33,380 Debugging your hardware. 442 00:16:35,920 --> 00:16:37,540 The single greatest problem 443 00:16:37,540 --> 00:16:39,460 is trying to figure out what part 444 00:16:39,460 --> 00:16:41,020 of your system is broken. 445 00:16:41,500 --> 00:16:43,380 Since you're working in both hardware and software 446 00:16:43,380 --> 00:16:45,440 try to develop software modules that allow you 447 00:16:45,440 --> 00:16:47,520 to test the hardware first and keep everything 448 00:16:47,780 --> 00:16:47,840 modular. 449 00:16:48,200 --> 00:16:49,640 Avoid early feature creep. 450 00:16:49,760 --> 00:16:52,920 It's a standard obvious thing that everyone forgets 451 00:16:52,920 --> 00:16:55,280 but get it working then get it cool. 452 00:16:56,080 --> 00:16:57,320 Design for testability. 453 00:16:57,780 --> 00:17:00,280 Put some mechanisms in your hardware 454 00:17:00,280 --> 00:17:01,180 and in your firmware 455 00:17:01,180 --> 00:17:03,680 to allow you to probe different sections 456 00:17:03,680 --> 00:17:04,500 of the thing. 457 00:17:04,560 --> 00:17:07,020 And then the hierarchy of failure. 458 00:17:07,340 --> 00:17:09,480 This is what is most likely to break. 459 00:17:09,740 --> 00:17:10,280 You. 460 00:17:11,080 --> 00:17:12,420 You are uniformly 461 00:17:12,420 --> 00:17:16,080 the single largest cause of failure. 462 00:17:16,780 --> 00:17:17,380 Second. 463 00:17:17,780 --> 00:17:17,940 Tools. 464 00:17:18,000 --> 00:17:19,400 Yes, tools are sometimes broken. 465 00:17:19,540 --> 00:17:21,260 Sometimes the compiler doesn't produce real code. 466 00:17:21,380 --> 00:17:22,640 Sometimes the assembler is broken. 467 00:17:23,180 --> 00:17:24,380 But it was probably you. 468 00:17:26,700 --> 00:17:28,760 And finally, sometimes the hardware is broken. 469 00:17:29,380 --> 00:17:30,580 But it might have been the tools 470 00:17:30,580 --> 00:17:31,520 but it was probably you. 471 00:17:34,680 --> 00:17:36,920 And then I tried to come up with a list 472 00:17:36,920 --> 00:17:39,200 of the basic rules of thumb 473 00:17:39,200 --> 00:17:39,920 that come out of 474 00:17:41,280 --> 00:17:42,680 more years of doing this 475 00:17:42,680 --> 00:17:44,060 than I can actually admit. 476 00:17:44,840 --> 00:17:46,680 Pay attention to current drive capacity. 477 00:17:47,780 --> 00:17:48,740 If you run a two horsepower motor 478 00:17:48,740 --> 00:17:49,940 off a logic level signal 479 00:17:49,940 --> 00:17:51,980 you will discover that it doesn't work. 480 00:17:53,800 --> 00:17:54,480 Buttons bounce. 481 00:17:54,920 --> 00:17:55,960 When you press a button 482 00:17:55,960 --> 00:17:57,240 you as a human 483 00:17:57,240 --> 00:17:59,720 working in the millisecond time domain 484 00:17:59,720 --> 00:18:01,900 see a transition from off to on. 485 00:18:02,620 --> 00:18:04,300 In the megahertz domain 486 00:18:04,300 --> 00:18:06,480 that your microcontroller may be sampling this thing 487 00:18:06,480 --> 00:18:08,580 it sees off, on, off, on, off 488 00:18:08,580 --> 00:18:10,140 off, on, off, off, on, off, on. 489 00:18:11,460 --> 00:18:12,960 There are simple ways to fix this 490 00:18:12,960 --> 00:18:14,960 but just be aware that what you think is going on 491 00:18:14,960 --> 00:18:16,940 is not necessarily what's really going on. 492 00:18:17,780 --> 00:18:18,200 Let's talk about added capacitor. 493 00:18:18,560 --> 00:18:20,840 The truth is that higher speed parts 494 00:18:20,840 --> 00:18:21,940 draw more and more current. 495 00:18:23,040 --> 00:18:25,320 Every time you have a switching event 496 00:18:25,320 --> 00:18:27,840 you have a high current draw. 497 00:18:28,160 --> 00:18:29,720 And that means that all of the leads 498 00:18:29,720 --> 00:18:30,700 coming from your power supply 499 00:18:30,700 --> 00:18:32,920 are getting drained down. 500 00:18:33,980 --> 00:18:35,320 Basically you have to provide 501 00:18:35,320 --> 00:18:37,220 localized power for all of your parts. 502 00:18:37,460 --> 00:18:38,620 When in doubt, stick a capacitor 503 00:18:38,620 --> 00:18:39,840 between power and ground 504 00:18:40,920 --> 00:18:42,480 which brings me to the next one 505 00:18:42,480 --> 00:18:43,980 sometimes polarity does matter. 506 00:18:45,400 --> 00:18:45,880 Laughter 507 00:18:47,780 --> 00:18:48,800 If you stick a polarized capacitor 508 00:18:48,800 --> 00:18:50,020 between power and ground 509 00:18:50,020 --> 00:18:51,000 make sure you get it right 510 00:18:51,000 --> 00:18:52,860 because the smell of burning tantalum 511 00:18:52,860 --> 00:18:53,800 is really awful. 512 00:18:54,680 --> 00:18:56,680 And if you're holding it when you plug it in live 513 00:18:56,680 --> 00:18:58,400 it will explode in your fingers 514 00:18:59,200 --> 00:19:01,040 and it's not very pleasant. 515 00:19:01,900 --> 00:19:03,460 If it's hot, turn it off. 516 00:19:04,860 --> 00:19:06,260 There are exceptions to this. 517 00:19:06,340 --> 00:19:07,740 If you're building a system where you know 518 00:19:07,740 --> 00:19:09,460 you've got to have a heat sink on your regulator 519 00:19:09,460 --> 00:19:11,380 then you can expect it to get warm. 520 00:19:11,640 --> 00:19:12,720 If it is emitting light 521 00:19:12,720 --> 00:19:14,500 it is probably getting too hot. 522 00:19:15,460 --> 00:19:15,940 Laughter 523 00:19:17,700 --> 00:19:18,880 Try to understand 524 00:19:18,880 --> 00:19:21,000 the switching levels of the parts you're using. 525 00:19:21,240 --> 00:19:23,060 It used to be that logic was 526 00:19:23,060 --> 00:19:24,960 inherently 0 volts is low 527 00:19:24,960 --> 00:19:25,940 5 volts is high 528 00:19:25,940 --> 00:19:27,820 the switching threshold is 2 volts 529 00:19:27,820 --> 00:19:29,760 anything above 2 volts is high 530 00:19:29,760 --> 00:19:31,340 anything below 0.8 is low 531 00:19:31,340 --> 00:19:33,180 this is TTL 5 volt. 532 00:19:33,460 --> 00:19:35,060 Those assumptions no longer hold 533 00:19:35,060 --> 00:19:37,760 because CMOS switching levels may or may not be used. 534 00:19:37,860 --> 00:19:40,080 A lot of the CMOS parts use TTL switching levels 535 00:19:40,780 --> 00:19:42,340 but just be aware of it. 536 00:19:42,720 --> 00:19:44,000 5 volt vs. 3.3 537 00:19:44,000 --> 00:19:46,520 Logic has been slowly migrating to 3.3 volts 538 00:19:47,460 --> 00:19:50,540 It's very possible to build an entire 3.3 volt system now 539 00:19:50,540 --> 00:19:53,040 It's very possible to build lower voltage systems. 540 00:19:53,260 --> 00:19:55,920 All of this stuff works at 5 volts. 541 00:19:56,260 --> 00:19:58,400 One of the nice things about a lot of the microcontrollers 542 00:19:58,400 --> 00:19:59,800 is they'll work at any voltage you feed them. 543 00:20:00,060 --> 00:20:01,720 Some of the pick parts, for example 544 00:20:01,720 --> 00:20:07,100 will work at anything between I believe 7.5 and 2.5 545 00:20:07,100 --> 00:20:07,920 something like this 546 00:20:07,920 --> 00:20:08,900 and the great thing about that is 547 00:20:08,900 --> 00:20:11,120 you don't even have to hook it up to a power regulator 548 00:20:11,120 --> 00:20:12,440 you just run the battery into it 549 00:20:12,720 --> 00:20:13,320 and the battery will drop off 550 00:20:13,320 --> 00:20:15,300 and maybe it will slow down and eventually fail 551 00:20:16,000 --> 00:20:18,880 but you can get away with a wide voltage input. 552 00:20:19,300 --> 00:20:20,500 Pay attention to timing. 553 00:20:20,700 --> 00:20:22,700 I'm not even going to justify that with an explanation. 554 00:20:23,380 --> 00:20:24,960 And don't let inputs float. 555 00:20:26,180 --> 00:20:28,200 If you have an input to a system floating 556 00:20:28,720 --> 00:20:30,100 just tag it to a power supply 557 00:20:30,100 --> 00:20:32,800 or at least put a pull-up or pull-down resistor on it 558 00:20:32,800 --> 00:20:34,280 if you've got a signal that's just sitting there 559 00:20:34,280 --> 00:20:34,820 floating along 560 00:20:35,840 --> 00:20:39,280 it may resolve to a non-logical value 561 00:20:39,280 --> 00:20:41,640 or it may resolve to a case where 562 00:20:41,640 --> 00:20:42,700 some parts of the circuit 563 00:20:42,720 --> 00:20:43,480 some parts of the system think it's high 564 00:20:43,480 --> 00:20:44,760 some parts of the system think it's low 565 00:20:44,760 --> 00:20:46,860 and you end up with a really nice high current path 566 00:20:46,860 --> 00:20:49,440 between your voltage source and ground 567 00:20:50,040 --> 00:20:52,180 and that ties back into 568 00:20:52,180 --> 00:20:53,720 if it gets hot, turn it off. 569 00:20:56,740 --> 00:20:58,460 And then a corollary to 570 00:20:58,460 --> 00:20:59,380 don't leave inputs floating 571 00:20:59,380 --> 00:21:00,420 that a friend of mine pointed out 572 00:21:00,420 --> 00:21:02,540 just as I was going over my slides this morning 573 00:21:02,540 --> 00:21:05,700 is make sure that you are actually applying power 574 00:21:05,700 --> 00:21:07,760 because CMOS devices can actually 575 00:21:07,760 --> 00:21:10,100 occasionally sort of work by powering themselves 576 00:21:10,100 --> 00:21:10,980 through their own inputs. 577 00:21:13,100 --> 00:21:15,080 A particularly nasty bug to chase down 578 00:21:15,080 --> 00:21:17,440 because it's really bizarre behavior 579 00:21:17,440 --> 00:21:18,080 but basically 580 00:21:18,480 --> 00:21:20,260 make sure you actually apply power to the parts 581 00:21:20,260 --> 00:21:21,720 because it may still work and you won't know why 582 00:21:21,720 --> 00:21:22,460 if it acts flaky. 583 00:21:24,900 --> 00:21:26,300 An example project 584 00:21:26,300 --> 00:21:28,400 that I wanted to frame this in was 585 00:21:28,400 --> 00:21:30,200 I saw a thing on Slashdot 586 00:21:30,200 --> 00:21:32,300 about a really cool little logging keyboard 587 00:21:32,300 --> 00:21:35,160 and I thought, that is a great microcontroller project 588 00:21:35,160 --> 00:21:36,720 I believe they called it Ghostboard 589 00:21:36,720 --> 00:21:37,460 something like this 590 00:21:37,460 --> 00:21:40,020 but it's very few IOs 591 00:21:40,020 --> 00:21:42,180 you've got a serial keyboard stream 592 00:21:42,720 --> 00:21:43,200 going in and going out 593 00:21:44,340 --> 00:21:46,320 and then I wanted to be able to log 594 00:21:46,320 --> 00:21:47,380 whatever was going through there 595 00:21:47,380 --> 00:21:49,540 so you've got slow serial flash memory 596 00:21:49,540 --> 00:21:52,300 you can get some really large serial flash devices 597 00:21:52,300 --> 00:21:53,660 they're not terribly fast to program 598 00:21:53,660 --> 00:21:56,200 but the great thing is you can power this whole mess 599 00:21:56,200 --> 00:21:58,060 of just a few parts off the keyboard port 600 00:21:58,860 --> 00:22:00,520 you can sniff incoming keystrokes 601 00:22:00,520 --> 00:22:01,920 it can act as its own keyboard 602 00:22:01,920 --> 00:22:03,500 and it has some concept of time 603 00:22:03,500 --> 00:22:05,260 and the idea was that you would have this device 604 00:22:05,260 --> 00:22:07,020 that would be logging keystrokes as they come through 605 00:22:07,020 --> 00:22:09,780 and perhaps inserting keystrokes if I wanted it to 606 00:22:09,780 --> 00:22:11,940 and there's all sorts of great applications for this 607 00:22:12,720 --> 00:22:14,720 some of which are even ethical 608 00:22:14,720 --> 00:22:19,360 and finally the inspirational message 609 00:22:19,360 --> 00:22:20,760 like any project 610 00:22:20,760 --> 00:22:22,520 the hard part of this is getting started 611 00:22:23,380 --> 00:22:24,760 hopefully this is giving you 612 00:22:24,760 --> 00:22:26,520 some really broad overview idea 613 00:22:26,520 --> 00:22:27,840 of how to get started 614 00:22:27,840 --> 00:22:30,100 the design space you get to play in is huge 615 00:22:30,100 --> 00:22:32,320 there's an infinite number of things you can build 616 00:22:32,320 --> 00:22:35,080 and a blinking LED is an amazingly satisfying thing 617 00:22:38,320 --> 00:22:40,160 to recap, microcontrollers 618 00:22:40,160 --> 00:22:40,920 different development opportunity 619 00:22:42,720 --> 00:22:43,920 and it's a lot of fun 620 00:22:43,920 --> 00:22:45,500 to both learn and tinker with this stuff 621 00:22:45,500 --> 00:22:46,260 and 622 00:22:48,720 --> 00:22:50,920 if you want to get an AVR development kit 623 00:22:50,920 --> 00:22:53,180 and this is why I was a little aghast 624 00:22:53,180 --> 00:22:53,860 at the size of the audience 625 00:22:53,860 --> 00:22:55,000 I have five of these things 626 00:22:55,000 --> 00:22:57,080 and so I'm going to use this as a chance 627 00:22:57,080 --> 00:22:59,320 to extract feedback from anyone 628 00:22:59,320 --> 00:23:00,560 who wants a chance to get one of these 629 00:23:00,560 --> 00:23:02,220 if you could write down a name or handle 630 00:23:02,760 --> 00:23:04,460 what I should change about this talk 631 00:23:04,460 --> 00:23:06,740 because I'm hoping to do more presentations like this 632 00:23:07,900 --> 00:23:11,080 and if you liked anything about the talk 633 00:23:11,080 --> 00:23:11,760 tell me that 634 00:23:12,720 --> 00:23:14,240 and tell me a project you'd like to do with your kit 635 00:23:14,240 --> 00:23:15,300 and then in about an hour 636 00:23:16,000 --> 00:23:17,860 five people can pick them up at the bellhop desk 637 00:23:17,860 --> 00:23:19,920 and they'll have your name or handle written on them 638 00:23:19,920 --> 00:23:22,160 I hope that some of you are inspired 639 00:23:23,000 --> 00:23:24,080 this, like I said 640 00:23:24,080 --> 00:23:25,700 is a complete AVR development kit 641 00:23:25,700 --> 00:23:27,140 it's got all of the software 642 00:23:29,080 --> 00:23:30,700 it's got an integrated development environment 643 00:23:30,700 --> 00:23:32,200 that allows you to do assembly development 644 00:23:32,900 --> 00:23:34,440 and it includes 645 00:23:34,440 --> 00:23:35,800 one instance of the 646 00:23:37,460 --> 00:23:38,180 AT90S1200 part 647 00:23:38,180 --> 00:23:39,300 which is 1K of code space 648 00:23:39,300 --> 00:23:40,580 64 bytes of RAM 649 00:23:43,300 --> 00:23:43,700 and 650 00:23:46,860 --> 00:23:47,660 15 IOs 651 00:23:47,660 --> 00:23:50,440 and it can self-clock itself at 1MHz 652 00:23:50,440 --> 00:23:54,000 and then for Q&A 653 00:23:54,000 --> 00:23:55,040 question number zero 654 00:23:55,040 --> 00:23:56,120 what is with the jacket 655 00:23:56,120 --> 00:23:58,800 since I get a lot of questions about this 656 00:23:58,800 --> 00:24:00,620 I had to include this 657 00:24:00,620 --> 00:24:02,940 this is my artwork 658 00:24:02,940 --> 00:24:05,660 I made these up last year 659 00:24:05,660 --> 00:24:07,460 I'm actually selling them this year 660 00:24:07,460 --> 00:24:08,220 so I'm hawking them 661 00:24:08,220 --> 00:24:10,780 they're 50 bucks, this is how I pay for my trip and my amusement 662 00:24:12,720 --> 00:24:14,240 these things have generated in the last year 663 00:24:14,240 --> 00:24:17,700 and if you want to contact me 664 00:24:17,700 --> 00:24:18,440 you can reach me at 665 00:24:18,440 --> 00:24:20,260 pking at pkscientific.com 666 00:24:20,260 --> 00:24:21,320 questions? 667 00:24:22,440 --> 00:24:23,080 yes? 668 00:24:26,240 --> 00:24:26,880 ok 669 00:24:29,760 --> 00:24:31,680 a lot of my projects 670 00:24:32,440 --> 00:24:33,480 lately have been 671 00:24:34,360 --> 00:24:36,040 trying to build 672 00:24:36,680 --> 00:24:38,520 control goo between a PC 673 00:24:38,520 --> 00:24:39,660 with 674 00:24:39,660 --> 00:24:41,580 an arbitrary set of 675 00:24:42,720 --> 00:24:44,020 ports, for example a serial port 676 00:24:44,680 --> 00:24:46,340 and external devices 677 00:24:46,340 --> 00:24:48,540 and so mostly really low speed 678 00:24:48,540 --> 00:24:50,500 stuff where I'm just parsing simple commands 679 00:24:50,500 --> 00:24:51,440 on a serial port 680 00:24:51,440 --> 00:24:54,800 and then based on that 681 00:24:54,800 --> 00:24:56,700 controlling an external device like a small robotic 682 00:24:56,700 --> 00:24:58,000 arm and junk like that 683 00:24:59,320 --> 00:25:00,640 what else have I done 684 00:25:00,640 --> 00:25:00,940 recently 685 00:25:02,960 --> 00:25:04,520 there's an infinite amount of fun to be had 686 00:25:04,520 --> 00:25:05,620 with DTMF decoders 687 00:25:08,500 --> 00:25:10,560 and I won't elaborate on that 688 00:25:13,480 --> 00:25:14,380 and then of course 689 00:25:14,380 --> 00:25:16,780 most of my actual time lately 690 00:25:16,780 --> 00:25:17,900 has been sucked up with my job 691 00:25:17,900 --> 00:25:19,000 which is building 692 00:25:20,420 --> 00:25:21,900 a protocol control engine 693 00:25:21,900 --> 00:25:25,180 for an infrared wireless networking system 694 00:25:25,180 --> 00:25:26,620 which also uses an 8-bit microcontroller 695 00:25:26,620 --> 00:25:28,800 oh that's the other thing I wanted to point out 696 00:25:28,800 --> 00:25:30,840 I tend to emphasize the low end of the spectrum 697 00:25:30,840 --> 00:25:31,480 on these parts 698 00:25:32,560 --> 00:25:34,720 there's a lot of really cool 8-pin parts 699 00:25:34,720 --> 00:25:36,680 where you've got 6 IOs power and ground 700 00:25:36,680 --> 00:25:38,540 and you can do some cool stuff with that 701 00:25:38,540 --> 00:25:39,940 if you really want to 702 00:25:39,940 --> 00:25:42,360 you can get 64-pin 8-bit micros 703 00:25:42,720 --> 00:25:44,680 you can get microcontrollers 704 00:25:44,680 --> 00:25:47,360 that have much more IOs 705 00:25:47,360 --> 00:25:48,280 address data bus 706 00:25:48,280 --> 00:25:50,480 and also I've emphasized 707 00:25:50,480 --> 00:25:51,900 the low end of the microcontroller spectrum 708 00:25:51,900 --> 00:25:54,980 that you can get much higher performance processor cores 709 00:25:54,980 --> 00:25:55,480 there are 710 00:25:56,740 --> 00:25:58,580 64-bit microprocessor cores 711 00:25:58,580 --> 00:25:59,960 embedded in control systems 712 00:25:59,960 --> 00:26:01,600 obviously they pay more but you can do more with them 713 00:26:01,600 --> 00:26:02,300 yes 714 00:26:13,820 --> 00:26:15,220 I have seen them 715 00:26:15,220 --> 00:26:17,440 I cannot think of any specific 716 00:26:20,900 --> 00:26:22,580 yeah if you go to 717 00:26:22,580 --> 00:26:24,540 EDNmag.com which is EDN magazine 718 00:26:24,540 --> 00:26:26,220 they have a lot of 719 00:26:26,220 --> 00:26:28,040 I believe it's EDN or EE times 720 00:26:28,040 --> 00:26:29,980 that does an annual microcontroller roundup 721 00:26:29,980 --> 00:26:32,200 where they present a summary 722 00:26:32,200 --> 00:26:33,360 of all of the parts 723 00:26:36,400 --> 00:26:36,960 pardon 724 00:26:41,100 --> 00:26:41,660 okay 725 00:26:42,720 --> 00:26:43,400 Hattachi SH 726 00:26:44,880 --> 00:26:45,400 okay 727 00:26:46,340 --> 00:26:48,420 okay he suggests the Hattachi 728 00:26:48,420 --> 00:26:49,980 which also supports 729 00:26:49,980 --> 00:26:51,120 you said supports the 730 00:26:51,120 --> 00:26:54,000 okay the new toolset 731 00:26:55,200 --> 00:26:55,720 yes 732 00:26:58,460 --> 00:26:58,980 sure 733 00:27:01,960 --> 00:27:04,480 okay I've managed to talk much faster 734 00:27:04,480 --> 00:27:06,300 than I usually do as I often do 735 00:27:06,300 --> 00:27:07,460 when I'm nervous in front of a large group 736 00:27:09,280 --> 00:27:10,420 so let's use the laptop 737 00:27:10,420 --> 00:27:11,040 for something useful 738 00:27:16,240 --> 00:27:16,840 okay 739 00:27:18,440 --> 00:27:19,500 again I apologize 740 00:27:19,500 --> 00:27:20,760 one of the things that 741 00:27:20,760 --> 00:27:22,620 yeah nevermind 742 00:27:29,240 --> 00:27:30,500 there it is 743 00:27:31,120 --> 00:27:32,700 this is the latest version of the 744 00:27:32,700 --> 00:27:34,060 AVR development studio 745 00:27:34,060 --> 00:27:35,540 it's a fairly nice integrated 746 00:27:36,360 --> 00:27:37,320 development environment 747 00:27:43,320 --> 00:27:44,180 and uh 748 00:27:50,480 --> 00:27:52,760 and this is a remarkably 749 00:27:52,760 --> 00:27:54,760 trivial example but it shows 750 00:27:54,760 --> 00:27:55,640 you the whole design flow 751 00:27:55,640 --> 00:27:56,480 I created 752 00:27:57,820 --> 00:27:59,820 a 9 byte program 753 00:28:00,680 --> 00:28:01,400 which 754 00:28:02,820 --> 00:28:04,440 let me expand 755 00:28:04,440 --> 00:28:05,140 everything here 756 00:28:05,140 --> 00:28:06,320 ... 757 00:28:07,520 --> 00:28:08,240 ... 758 00:28:12,160 --> 00:28:12,640 Umm 759 00:28:13,360 --> 00:28:13,840 basically 760 00:28:14,540 --> 00:28:15,020 it's 761 00:28:15,020 --> 00:28:16,200 this is just a little 762 00:28:16,200 --> 00:28:17,580 load some data in 763 00:28:18,960 --> 00:28:20,520 read in the set of buttons 764 00:28:20,520 --> 00:28:23,540 on the AVR microcontroller board 765 00:28:23,540 --> 00:28:24,780 and output it to the LEDs 766 00:28:24,780 --> 00:28:27,020 so I use buttons to turn on LEDs 767 00:28:27,020 --> 00:28:28,260 by way of a microprocessor 768 00:28:28,740 --> 00:28:29,220 umm 769 00:28:31,060 --> 00:28:31,820 yeah yeah 770 00:28:31,820 --> 00:28:33,700 there's some unnecessary steps in there 771 00:28:36,260 --> 00:28:37,220 anyway um 772 00:28:38,740 --> 00:28:40,500 Do you have specific questions 773 00:28:40,500 --> 00:28:42,160 about the development environment, or...? 774 00:28:45,600 --> 00:28:48,360 Oh, okay, there's a whole good subtopic. 775 00:28:48,540 --> 00:28:49,160 C development environments. 776 00:28:50,940 --> 00:28:54,380 There are some good C cross-compilers, 777 00:28:54,380 --> 00:28:58,100 which will give you the ability to do fairly tight code. 778 00:28:58,400 --> 00:28:59,920 I tend to not use them, 779 00:28:59,960 --> 00:29:02,140 simply because I like to have really low-level control 780 00:29:02,140 --> 00:29:02,980 over my code, 781 00:29:03,200 --> 00:29:05,280 but I'm also fairly paranoid about that. 782 00:29:05,360 --> 00:29:07,380 The truth is, if you set up the tools correctly, 783 00:29:07,380 --> 00:29:09,840 you can do it without shooting yourself in the foot. 784 00:29:09,920 --> 00:29:14,060 The problem is that the C compiler's primary reason in life 785 00:29:14,060 --> 00:29:15,980 is to optimize the code 786 00:29:15,980 --> 00:29:17,760 in ways that you don't necessarily understand, 787 00:29:17,900 --> 00:29:19,100 otherwise you'd be doing it by hand, 788 00:29:20,020 --> 00:29:23,140 and to hide things in the background, 789 00:29:23,280 --> 00:29:26,140 so it's really easy to end up with code being fluffed up 790 00:29:26,140 --> 00:29:28,480 or shuffled around in such a way 791 00:29:28,480 --> 00:29:29,600 that you end up with a much larger image 792 00:29:29,600 --> 00:29:30,200 than you were intending. 793 00:29:30,520 --> 00:29:34,460 That said, there are a lot of good C development environments, 794 00:29:34,600 --> 00:29:36,160 and in fact, I believe there are a lot of... 795 00:29:36,160 --> 00:29:39,540 of the GNU modules for various microcontrollers. 796 00:29:42,960 --> 00:29:43,400 Yeah. 797 00:29:44,660 --> 00:29:46,060 Yeah, yeah, GCC. 798 00:29:46,380 --> 00:29:47,840 Is there a GCC for the AVR? 799 00:29:47,940 --> 00:29:49,360 Okay, great, I apologize. 800 00:29:53,120 --> 00:29:55,020 So, yeah, if you look around, 801 00:29:55,100 --> 00:29:56,000 you will find some of these tools. 802 00:29:56,100 --> 00:29:59,320 A lot of the third-party C development tools 803 00:29:59,320 --> 00:30:01,980 are also available in various demo forms for free. 804 00:30:04,440 --> 00:30:05,540 And one of the nice things 805 00:30:05,540 --> 00:30:06,580 about the AVR development kit 806 00:30:06,580 --> 00:30:08,340 is it also includes a simulator. 807 00:30:08,580 --> 00:30:09,600 Unfortunately, I haven't set up 808 00:30:09,600 --> 00:30:12,520 the simulation environment to demonstrate this, 809 00:30:12,640 --> 00:30:16,380 but it lets you do step-by-step simulation of your code. 810 00:30:17,580 --> 00:30:19,520 The caveat about that is you're, of course, 811 00:30:19,540 --> 00:30:21,560 working in a simulated environment 812 00:30:21,560 --> 00:30:22,540 where you don't have the benefit 813 00:30:22,540 --> 00:30:23,440 of your external hardware, 814 00:30:23,580 --> 00:30:25,060 so you have to assume that you now know 815 00:30:25,060 --> 00:30:26,740 what the stuff you've glommed onto the microcontroller 816 00:30:26,740 --> 00:30:27,180 is doing. 817 00:30:27,680 --> 00:30:28,080 Yes? 818 00:30:30,280 --> 00:30:30,680 Yes. 819 00:30:31,560 --> 00:30:31,940 Yes. 820 00:30:33,820 --> 00:30:34,220 Yes. 821 00:30:35,100 --> 00:30:35,500 Yes. 822 00:30:35,500 --> 00:30:35,520 Yes. 823 00:30:35,520 --> 00:30:45,460 The question was, 824 00:30:45,500 --> 00:30:46,760 what's a good place to find out information 825 00:30:46,760 --> 00:30:50,800 about the formats of the various binary files 826 00:30:50,800 --> 00:30:52,260 to strip out the headers and other information 827 00:30:52,260 --> 00:30:54,400 so you get just the code you need for your microcontroller? 828 00:30:55,920 --> 00:30:57,600 Unfortunately, I'll have to say, I don't know. 829 00:30:57,720 --> 00:31:00,080 It's fairly context-dependent. 830 00:31:01,040 --> 00:31:02,860 I mean, the specific file formats you mentioned, 831 00:31:02,920 --> 00:31:04,040 ELF, are... 832 00:31:05,520 --> 00:31:06,700 I'm assuming well-documented, 833 00:31:06,940 --> 00:31:10,040 but I do not know specifically where you would get 834 00:31:10,040 --> 00:31:11,920 the how-to-reduce-it-for-a-microcontroller version. 835 00:31:13,400 --> 00:31:15,600 You can use the option of not being able to strip it out. 836 00:31:16,560 --> 00:31:18,620 So one of the three main tools 837 00:31:18,620 --> 00:31:21,460 is how to be able to strip out the extra stuff 838 00:31:21,460 --> 00:31:23,460 and completely fix it in the binary. 839 00:31:28,360 --> 00:31:28,800 Yes? 840 00:31:29,380 --> 00:31:32,820 What is the cost of the ADR process, 841 00:31:33,460 --> 00:31:34,460 which is one point a year? 842 00:31:34,860 --> 00:31:35,300 Yes. 843 00:31:35,520 --> 00:31:38,580 Small quantities, I believe the specific part I'm using here, 844 00:31:38,660 --> 00:31:39,680 which is a 20-pin DIP, 845 00:31:41,020 --> 00:31:42,460 is about two and a half bucks. 846 00:31:43,460 --> 00:31:45,040 So good for small projects. 847 00:31:45,400 --> 00:31:45,740 Yes? 848 00:31:46,080 --> 00:31:47,560 Are you using the ADR commercially, 849 00:31:47,740 --> 00:31:49,840 and if so, are you able to get any of them right now? 850 00:31:50,040 --> 00:31:51,460 Am I using the ADR commercially, 851 00:31:51,680 --> 00:31:53,560 and if so, am I able to get any of them right now? 852 00:31:53,880 --> 00:31:55,580 This is another good question. 853 00:31:55,800 --> 00:31:57,240 Ironically, you can get engineering samples. 854 00:31:57,360 --> 00:31:59,280 You can't actually buy most of them right now. 855 00:32:00,460 --> 00:32:02,680 This leads into an aside about the electronics industry 856 00:32:03,700 --> 00:32:04,740 that's fairly hideous. 857 00:32:05,520 --> 00:32:09,800 Things that you would think are uniformly available 858 00:32:09,800 --> 00:32:12,460 and infinitely cheap are actually on allocation. 859 00:32:12,780 --> 00:32:14,660 Allocation is the process by which they tell you, 860 00:32:14,700 --> 00:32:16,780 sure, we can get you that part in 58 weeks. 861 00:32:18,360 --> 00:32:21,200 Right now, I have a project that is in development 862 00:32:21,200 --> 00:32:22,920 that may use an AVR, 863 00:32:23,060 --> 00:32:26,040 although I'm early enough that I'm seriously concerned 864 00:32:26,040 --> 00:32:27,660 about the fact that the lead times are huge. 865 00:32:30,300 --> 00:32:31,220 Any other questions? 866 00:32:31,460 --> 00:32:32,260 Oh, sorry. Yes? 867 00:32:32,700 --> 00:32:33,840 I have a quick question. 868 00:32:34,500 --> 00:32:34,980 First? 869 00:32:41,960 --> 00:32:43,620 First question, do you need a ROM burner 870 00:32:43,620 --> 00:32:44,660 to get the code into the processor? 871 00:32:44,800 --> 00:32:46,100 No, it actually comes with the starter kit. 872 00:32:46,160 --> 00:32:48,380 One of the nice things about this particular starter kit 873 00:32:48,380 --> 00:32:49,260 is you've got a serial port, 874 00:32:49,380 --> 00:32:52,920 and the development environment will generate a binary file 875 00:32:52,920 --> 00:32:54,680 or several different formats of binary file, 876 00:32:55,260 --> 00:32:59,460 and then there's program code in the development environment 877 00:32:59,460 --> 00:33:01,520 that allows you to just directly dump it into here. 878 00:33:02,160 --> 00:33:04,020 In this case, it's a flash microcontroller, 879 00:33:04,140 --> 00:33:04,860 so once it's programmed, 880 00:33:05,520 --> 00:33:09,380 and you can cycle the contents about 1,000 times 881 00:33:09,380 --> 00:33:10,980 before you start to stress the flash cells. 882 00:33:20,800 --> 00:33:24,660 Oh, buying microcontrollers from Motorola over the web? 883 00:33:25,580 --> 00:33:26,680 I'm not familiar with that. 884 00:33:26,780 --> 00:33:30,280 I have used some of the Motorola family in the past. 885 00:33:30,380 --> 00:33:31,160 They're very good parts. 886 00:33:31,620 --> 00:33:34,000 A lot of them are derived from architectures 887 00:33:34,000 --> 00:33:35,500 that you are probably already familiar with. 888 00:33:35,520 --> 00:33:37,520 The 6800 series and so on. 889 00:33:43,300 --> 00:33:44,580 Am I that nervous? 890 00:33:47,100 --> 00:33:47,640 Thank you. 891 00:33:50,000 --> 00:33:51,720 No, there's no reason to avoid them. 892 00:33:51,780 --> 00:33:53,960 I'm actually quite fond of the 68HC11 family, 893 00:33:54,160 --> 00:33:55,660 which is a great 8-bit part, 894 00:33:55,840 --> 00:33:58,300 and there's no reason not to buy them over the web. 895 00:34:00,300 --> 00:34:01,320 One of the... 896 00:34:03,320 --> 00:34:05,500 This starts to get into the datasheet details, 897 00:34:05,520 --> 00:34:08,080 but there are a lot of good features. 898 00:34:08,200 --> 00:34:10,100 The 68HC11 series in particular 899 00:34:10,100 --> 00:34:12,960 has a lot of different onboard peripherals 900 00:34:12,960 --> 00:34:13,720 available right now. 901 00:34:14,160 --> 00:34:16,940 And so if you're looking for a rich feature set, 902 00:34:17,000 --> 00:34:17,820 that is a good way to go. 903 00:34:19,820 --> 00:34:20,300 Yes? 904 00:34:30,800 --> 00:34:31,760 He asks, 905 00:34:31,840 --> 00:34:35,320 what are good books on interfacing to external peripherals 906 00:34:35,320 --> 00:34:38,640 such as stepper motors, IR systems, and so on? 907 00:34:39,260 --> 00:34:41,820 I used to have a few books that I recommended, 908 00:34:42,040 --> 00:34:43,220 although, as you pointed out, 909 00:34:43,340 --> 00:34:44,860 the things get out of date really quickly 910 00:34:46,660 --> 00:34:49,820 because especially state of the art in high performance, 911 00:34:50,100 --> 00:34:53,080 high current switching transistors, for example, 912 00:34:53,140 --> 00:34:55,280 has come a long ways in just the last few years. 913 00:34:55,540 --> 00:34:58,260 So where you used to have to go through gyrations 914 00:34:58,260 --> 00:35:00,320 and perhaps actually have several stages of drivers 915 00:35:00,320 --> 00:35:01,940 to drive even small motors, 916 00:35:02,160 --> 00:35:04,140 you can now do it with monolithic devices. 917 00:35:04,300 --> 00:35:05,300 What I actually encourage you to do is, 918 00:35:05,320 --> 00:35:08,880 I encourage people to do is just surf data sheets. 919 00:35:11,160 --> 00:35:13,560 Generally, find application notes 920 00:35:13,560 --> 00:35:14,960 that describe what you're trying to do 921 00:35:14,960 --> 00:35:16,380 and find data sheets to make sure 922 00:35:16,380 --> 00:35:18,500 that the specifications fit. 923 00:35:18,840 --> 00:35:19,320 Yes? 924 00:35:29,320 --> 00:35:31,120 What's a good way to surf for this information? 925 00:35:33,480 --> 00:35:34,440 I, unfortunately, 926 00:35:35,320 --> 00:35:37,020 don't have a good sort of unified solution. 927 00:35:37,180 --> 00:35:38,480 I'm a web minimalist. 928 00:35:39,100 --> 00:35:41,880 I just go to Google and give it a few search terms 929 00:35:41,880 --> 00:35:43,140 and see what pops up. 930 00:35:43,240 --> 00:35:45,980 Surprisingly, often you will hit manufacturer's pages 931 00:35:45,980 --> 00:35:48,840 or if you include a search term of application note, 932 00:35:48,940 --> 00:35:50,300 that filters out a lot of the crap. 933 00:35:52,820 --> 00:35:53,800 Any other questions? 934 00:35:54,640 --> 00:35:55,160 Yes? 935 00:35:55,660 --> 00:35:58,100 Are the microcontrollers 936 00:35:58,100 --> 00:35:59,540 provided with assemblers 937 00:35:59,540 --> 00:36:03,860 or do manufacturers tend to write a unified assembler 938 00:36:03,860 --> 00:36:05,080 that works for all of the... 939 00:36:05,320 --> 00:36:07,160 the microcontrollers in their family? 940 00:36:07,520 --> 00:36:08,800 The question is... 941 00:36:09,640 --> 00:36:10,080 That's strange. 942 00:36:10,860 --> 00:36:12,820 Are the microcontrollers provided, 943 00:36:13,160 --> 00:36:15,080 or are the assemblers provided with the microcontroller? 944 00:36:15,700 --> 00:36:18,320 Yeah, what do you mean by that initial assembler? 945 00:36:18,600 --> 00:36:21,600 That particular microcontroller? 946 00:36:21,780 --> 00:36:24,720 Generally, the assemblers are divided by family 947 00:36:24,720 --> 00:36:25,780 because what'll happen is 948 00:36:25,780 --> 00:36:27,260 within a particular microcontroller family, 949 00:36:27,520 --> 00:36:28,780 the instruction set architecture 950 00:36:28,780 --> 00:36:31,120 will be approximately the same. 951 00:36:31,200 --> 00:36:32,740 There'll be some instructions that aren't supported 952 00:36:32,740 --> 00:36:33,680 because, for example, 953 00:36:33,680 --> 00:36:35,020 that addressing mode doesn't exist 954 00:36:35,020 --> 00:36:35,540 in the hardware. 955 00:36:36,360 --> 00:36:37,460 But for the most part, 956 00:36:37,500 --> 00:36:39,020 the manufacturer will generally have 957 00:36:40,400 --> 00:36:42,380 a baseline assembler that they provide. 958 00:36:42,560 --> 00:36:44,140 For example, in this system, 959 00:36:44,980 --> 00:36:48,240 you have to specify which of the AVR family you're using 960 00:36:48,240 --> 00:36:50,820 so that it knows if you're trying to set up the stack pointer 961 00:36:50,820 --> 00:36:53,200 and it doesn't have a stack pointer, 962 00:36:53,380 --> 00:36:54,920 it will tell you you shouldn't be doing that. 963 00:36:59,200 --> 00:37:02,560 The cross-assembler and cross-compiler tools, 964 00:37:03,200 --> 00:37:04,760 such as the GNU tools, are... 965 00:37:05,020 --> 00:37:08,220 are available for a vast number of parts, 966 00:37:08,360 --> 00:37:09,940 and those are maintained independently. 967 00:37:10,220 --> 00:37:12,460 Some of the manufacturers are actually going over 968 00:37:12,460 --> 00:37:15,560 to things like the GNU toolset as their baseline toolset. 969 00:37:17,040 --> 00:37:20,200 For the most part, everyone still has some third-party 970 00:37:20,200 --> 00:37:22,080 or in-house developed assembler they like. 971 00:37:24,800 --> 00:37:25,760 Any other questions? 972 00:37:27,100 --> 00:37:27,620 Yes? 973 00:37:28,760 --> 00:37:30,900 How to pick out an oscilloscope on eBay. 974 00:37:32,000 --> 00:37:33,740 How to pick out an oscilloscope on eBay. 975 00:37:36,940 --> 00:37:39,620 It depends on exactly what you're trying to do with it. 976 00:37:39,680 --> 00:37:41,500 The most useful thing an oscilloscope lets you see 977 00:37:41,500 --> 00:37:42,520 is signal versus time. 978 00:37:42,820 --> 00:37:44,220 The second most useful thing, 979 00:37:44,320 --> 00:37:45,760 if you have a two-channel scope, 980 00:37:45,940 --> 00:37:47,800 is seeing two signals versus each other. 981 00:37:48,640 --> 00:37:52,240 If you're trying to pick out a good, cheap, used oscilloscope 982 00:37:52,720 --> 00:37:53,960 and you're doing microcontroller systems, 983 00:37:54,140 --> 00:37:55,840 you probably don't need a very fast one. 984 00:37:57,720 --> 00:38:00,280 A bandwidth of a few tens of megahertz 985 00:38:00,280 --> 00:38:04,280 is going to give you anything you would want to see 986 00:38:04,280 --> 00:38:05,500 in terms of intentional signals. 987 00:38:05,720 --> 00:38:07,660 I say intentional signals because the caveat is 988 00:38:07,660 --> 00:38:11,380 if you've got noise in a system that's, for example, 989 00:38:11,380 --> 00:38:12,460 glitching during a switch, 990 00:38:12,640 --> 00:38:14,440 you may have very short-duration spikes 991 00:38:15,340 --> 00:38:17,080 and you would want more bandwidth 992 00:38:17,080 --> 00:38:18,320 on your oscilloscope to find that. 993 00:38:19,140 --> 00:38:19,420 Yeah? 994 00:38:19,920 --> 00:38:21,700 Are there kits that you can use 995 00:38:21,700 --> 00:38:23,420 your computer as the oscilloscope? 996 00:38:23,620 --> 00:38:25,400 Are there kits to use your computer as the oscilloscope? 997 00:38:25,480 --> 00:38:25,780 Absolutely. 998 00:38:26,260 --> 00:38:28,440 A lot of the high-end oscilloscopes now 999 00:38:28,440 --> 00:38:30,140 are basically just a Windows box 1000 00:38:30,140 --> 00:38:32,540 stuck onto a chunk of hardware that's the oscilloscope. 1001 00:38:32,600 --> 00:38:33,560 You can go the other direction, 1002 00:38:34,280 --> 00:38:37,840 and get a sampling card that you stick into your PC. 1003 00:38:38,040 --> 00:38:39,240 At the very low end, 1004 00:38:39,360 --> 00:38:41,060 you can actually make an oscilloscope 1005 00:38:41,060 --> 00:38:41,840 out of a good sound card. 1006 00:38:42,100 --> 00:38:47,740 You can just feed that as an audio input and sample it, 1007 00:38:47,780 --> 00:38:49,540 and it will show you the waveform, 1008 00:38:50,340 --> 00:38:52,240 but again, you're fairly bandwidth limited there. 1009 00:38:54,000 --> 00:38:54,480 Yes? 1010 00:39:08,540 --> 00:39:10,600 I — could you repeat the name? 1011 00:39:10,680 --> 00:39:11,860 I know what you're talking about, 1012 00:39:11,920 --> 00:39:12,800 and I can't think of the name. 1013 00:39:17,980 --> 00:39:19,780 Fred Martin the Handyboard? 1014 00:39:20,640 --> 00:39:21,120 Okay. 1015 00:39:21,380 --> 00:39:24,080 Is that the 68HC11 based one? 1016 00:39:24,640 --> 00:39:25,460 Okay, yeah. 1017 00:39:25,560 --> 00:39:27,780 That is a great development board 1018 00:39:27,780 --> 00:39:30,160 because that provides the microcontroller. 1019 00:39:30,460 --> 00:39:34,000 It's very similar to this sort of thing in that it provides, 1020 00:39:34,000 --> 00:39:38,700 a breakout of the signals and a way to hook things up and I believe in circuit 1021 00:39:38,700 --> 00:39:43,800 programming although I'm not sure you would have to search unfortunately I 1022 00:39:43,800 --> 00:39:44,600 don't have a pointer to that 1023 00:39:49,320 --> 00:39:52,920 okay Fred Martin handy board web search any other questions 1024 00:39:56,540 --> 00:40:01,200 okay I'm gonna call it quits then I will be around for a few more minutes over 1025 00:40:01,200 --> 00:40:04,560 here if you want to drop by your commentary and and tell me if you want 1026 00:40:04,560 --> 00:40:07,940 an AVR development kit and thank you very much for