# Tag Info

85

You kids, get off my lawn! 384b is plenty of space to create something quite complex in assembler. If you dig back through history to when computers were the size of a room, you'll find some truly amazing feats of artistry executed in <1k. The classic "Story of Mel - a real programmer" is your starter for 10: ...

42

Microcontrollers are sufficiently cheap that they are often used to do really simple things that in years past would more likely have been done with discrete logic. Really simple things. For example, one might want a device to turn on an output for one second every five seconds, more precisely than a 555 timer would be able to do. movwf OSCCON mainLp: ...

25

An actual SPI controller peripheral in the MCU can often run much faster than bit-banging the interface. Of course, it depends on the MCU, but it would not surprise me to see a SPI controller running at 30+ MHz, while bit banging might be limited to around 1 MHz (if you're lucky). But there is more to it than that. When bit-banging, the MCU is busy ...

14

When doing down-hole stuff for oil and gas - my guess is the cost of a chip is not going to make any difference on the economics of your whole project. You may be spending more money on time wasted looking to save even $100 in parts. Say you cost$100 per hour (salaries + overhead). Not unreasonable if you are a good engineer. Say you save \$100 by spending ...

13

You can use this for very small applications (e.g. delayed PSU start, 555 timer replacement, triac-based control, LED blinking etc...) with smaller footprint than you'd need with logic gates or a 555 timer.

13

When working with a digital circuitry that senses analog voltage, for example a microcontroller, or let's say Arduino, you are measuring voltages. However, without current, voltage cannot be present. For a voltage to be created on a component, there need to be a current flowing on it. According to Ohm's law; $V=I*R$, when $I=0$, the equation becomes; ...

11

I'll give a general answer since the question lacks information: Suppose you have an uint8_t as input and a uint8_t as output and you want to create a full lookup table (i.e. every input has an output). You'd need 256 values, as the input can have 256 different values. You can now create a table with: const uint8_t the_table[256] = { ... } The const ...

10

There is no difference in terms that you can achieve the same result using both methods but there are a few reasons why you would choose one over the other. Using a SPI peripheral will free the processor from having to care about generating the timing for bit banging the I/O pins, allowing it to perform other computational tasks and simplifying your ...

9

I designed a humidity sensor for plants that tracks the amount of water the plant has and blinks an LED if the plant needs water. You can make the sensor learn the type of plant and thus change its settings while running. It detects low voltage on the battery. I ran out of flash and ram but was able to write everything in C code to make this product work ...

9

While the 4004 and Z80 were available, they were both unlikely to be used in handhelds where low part count, cost and battery life were important. There were families of 4-bit and 8-bit microcontrollers from the 1970s that have been mostly forgotten - these usually had on-chip ROMs so after developing your program on a relatively expensive emulation system ...

8

Well, years ago I wrote a temperature controller with serial I/O (bit-banging the serial I/O because the MCU didn't have a UART) and a simple command interpreter to talk to the controller. MCU was a Motorola (now Freescale) MC68HC705K1 which had a whopping 504 bytes of program memory (OTPROM) and about 32 bytes of RAM. Not as little as the PIC you reference, ...

8

Many pins of your microcontroller have different functions. The 'normal' function would refer to GPIO, General Purpose Input/Output. In that case, you can use these pins directly by writing to and reading from the relevant registers. 'Alternate' functions would refer to other functions, that may include I2C, SPI, USART, CCP, PWM, Clock, ADC, etc... How you ...

7

PORT is the OUTPUT buffer, PIN is the INPUT buffer. When you want to set the pin to a "high" or "low" voltage, write to the PORT register. When you want to know what voltage is currently presented to a pin, read the PIN register. The bits of these registers represent the corresponding pins of the general-purpose input/output port. Here is a simplified ...

7

The ground side of the incoming analog signals needs to be connected to the ground of the microcontroller. Multiple ground pins on a microcontroller very conveniently allow greater current load to reach ground with reduced pin impedance (by paralleling): For instance, if a microcontroller can sink 40 mA per GPIO pin, and has a total current limit of say 200 ...

7

The reality is that you most likely did fry it. We can think about it this way: you supplied much more voltage to it than it was designed to handle, and now it doesn't respond to your computer. What other possibility is there? The question now is: what exactly did you fry? One thing that could very well be toasted is the ATmega328 chip. Whether you are in ...

7

"ONLY" 384 bytes? Way back in the day, I had the job of writing an entire operating system (by myself) for a specialized computer that served the ship, pipeline, and refinery management industry. The company's first such product was 6800 based and was being upgraded to 6809, and they wanted a new OS to go along with the 6809 so they could eliminate the ...

7

When I was in high school, I had a teacher that insisted that light dimming was too difficult a task for a student such as I to tackle. Thus challenged I spent quite a bit of time learning and understanding phase based light dimming using triacs, and programming the 16C84 from microchip to perform this feat. I ended up with this assembly code: 'Timing ...

7

You don't "call" an IO port, you manipulate the registers that control it. You should have the LPC13xx.h file from NXP, which defines C data structures that you can use to access the ports. After including this file you can control the port pins in C with something like: LPC_GPIO3->DIR |= (1 << 4); // make P3.4 an output pin LPC_GPIO3->DATA |= ...

6

The nearest I can find is this device: - With a 0.5V input it will produce 5V but only with probably 50mA output (Green graph for TPS61202): - Hopefully it'll work for your application

6

You don't need an external EEPROM for this. Get a microcontroller with EEPROM instead, that's smaller and easier to use, because you don't need an SPI or I2C module anymore. Also, you can easily program the EEPROM from the computer. So, basically, you want a PIC or other microcontroller with: (E)U(S)ART connection EEPROM 3 GPIO pins for the LEDs Most ...

5

I'll assume that the total length of each of your buses is under 1 meter, which is typical for plain I2C and SPI. Also, the bus capacitance is within the spec. There should be only one (1) set of pull-up resistors. As a result, the best place for them is on the main controller board. Don't put the pull-ups on the modules. If you want to have pull-up in ...

5

At 500 rpm the shaft rotates 8.3333 times per second therefore, in 1 second you count: - 12 x 8.33333 pulses = 100 pulses At 505 rpm the shaft rotates 8.416667 times per second therefore, in 1 second you count: - 12 x 8.41667 pulses = 101 pulses You want greater resolution so you can add more bolts BUT to get a resolution of 1 rpm you'll need 5 x 12 ...

5

You could try and use the entire doorknob as a single-node capacitive sensor: The electrode for such uses need not be ferrous or cuprous, as long as it is conductive. The mechanism involves sensing capacitance changes between the electrode (doorknob) and any earthed conductive body (the human). No second electrode is required; Instead the other pole of ...

5

SPI is a synchronous interface, with the master controlling the clock. That means if you are the master, you get to pick the clock speed and timing. Slave devices will have some upper limit on the clock frequency they can handle, but typically don't care how slow the clock is below that. More specifically, there is usually a minimimum time each slave ...

4

You can write a blink a LED with 384 bytes program memory, and even more. As far as I know, it is not possible to extend the program memory with an external chip (unless you're building a full ASM interpreter in the 384 bytes, which would be slow). It is possible to extend data memory with an external chip (EEPROM, SRAM) though.

4

Sounds like the back-EMF from the solenoid is disrupting the micro. There are a few potential issues / solutions here; 1st, read up on snubber diodes/protection used with relays/solenoids, it's been covered many times here on all the hundreds of variations on "how do I switch a relay from my *duino?" questions. 2nd, look at the smoothing and grounding of ...

4

FPGAs have concurrent execution not by threads, but by real parallel execution paths. There may be some gates on one part of the die performing an addition while other gates on another part of the die are performing another addition. Threads are one of many programming abstractions that make it seem as if a CPU can execute multiple tasks when really it ...

4

First you need to look in the data sheet to determine how much power is consumed inside the processor itself. This will almost certainly be a function of the clock frequency but it may also depend on which peripheral devices you are using inside the processor. There may be tables or graphs in addition to some kind of worst-case specification. Second, add ...

3

One option is to use SIL or DIL resistor packs, and fit them in sockets on each module. When building a system with multiple modules, pull them out of every module except the last. This saves a little board space over jumpers. Variations on this theme can include FET switches to connect or disconnect the resistors, controlled by a single jumper, or a spare ...

3

I agree with DrFriedParts answer completely, however, I do want to add that, you can indeed read PORT to find out whether the port/pin is configured as OUTPUT high or low (when DDR = 1, port/pin configured as output) or whether the internal pullup resistor is activated (when DDR = 0, port/pin configured as input). In this way a port port can be used (in a ...

Only top voted, non community-wiki answers of a minimum length are eligible