Tag Info

New answers tagged

1

You don't initialize the point register. That means it can hold any value when you start looping the nextdigit loop! Try adding a clrf point under the start label. For debugging: in MPLAB -> View -> File Registers, you can see the value of point during runtime.


0

I checked out if there are any loosed connections like suggested by @pjc50 - found none. I even ordered new header and on my surprise the issue was still not gone. After many trial and error I figured out that it works if I set Voltage Level to 4,875 (instead of 5V):


1

I have a similar issue with firmware 01.28.72. When I went back to 1.12.01 it worked again.


0

The fastest way to do this is with an Arduino based board. Get a board, a clock module like this one https://www.sparkfun.com/products/99 and connect them together. You will probably need a Mega to have enough IO pins to driver the displays. Ask any coding questions on StackOverflow (the programming Q&A) site. Or - here is a project with an Arduino type ...


0

I highly recommend you to use a LCD instead of bunch of 7-segments. You can configure the digits easily. PCB will be much easier to build. Much more less soldering and easier to control in software. LCD can be used with direct wiring of 8 pins. I recommend you 2x16 LCD with a HD44780 chip in it. You can find in net for HD44780 examples a lot. As for ...


4

In order to expand the display to displaying DDD MM HH, you need five more I/O lines for the DDD and SS. The PIC16F84A microntroller shown in the linked circuit has only 13 I/O lines and there are all used. (If you don't need the buzzer and relay outputs then potentially you have two spare outputs, but as I mentioned above, you need five.) So If you want ...


1

One option would be a lower power microcontroller. This board can be used to develop for one (TI MSP430) capable of about 0.8 ua in low power mode; on a button press it can be active in 1 us.


2

If you need a solution that doesn't require a voltage regulator i.e. operates directly on the Vcc lines to the PIC then I've modified it slightly (and for a good reason): - The reason it's modified is that the BJT pass transistor might drop a little too much voltage under load if you are just switching an already regulated Vcc to the PIC. I've replaced ...


2

I searched around a bit of course and found this: Source: http://www.circuitsonline.net/schakelingen/145/computer-en-microcontroller/one-button-onoff.html (Dutch) According to the site, this circuit draws less than 1uA when off. I didn't test it myself. I don't know how much it draws when the device is on. When SW1 is pressed, Q1 starts to conduct and ...


4

The purpose of the 100 nF capacitors placed physically close to the microcontroller, is to decouple the varying load any microcontroller represents, from the power supply rails. Thus, those capacitors do need to exist, as close as possible to the supply pins of the device. Similarly, typical voltage regulators sense their output and use a feedback loop to ...


8

Smoothing caps need to be as close to the power pins as possible of the target ICs. Trace parasitics add a whole bunch of invisible components in series with the power and return nets. It's a difficult concept to visualize from a schematic standpoint, since a schematic shows logical relationships (nets) but not physical relationships (how far apart parts ...


1

RECEIVING The normal approach for implementing a software asynchronous receiver is to have a timer tick that runs continuously at 3x or 5x the baud rate (note: odd numbers are better than even numbers). Watch the input to be low on two consecutive ticks. Once that is observed, start sampling the input on every third tick, until you have sampled it nine ...


2

Consecutive direct accesses to variables in the same bank will be faster than direct accesses to variables in different banks. Consequently, the compiler is probably trying to consolidate variables which are accessed near each other so they'll be placed in the same bank. Unfortunately, it may be attempting to consolidate more variables than will actually ...


2

No promises, but I have personally experienced that exact same behavior more than one hundred times. Every single one of them was fixed by throwing away my connecting cable, and wiring a new one. This means The plug on the PICkit3 The physical connector on the PIC side itself The physical wires between those two plugs Your current observations might be ...


0

When I use XC16 (I dont think XC8 is much different), I generally create a project with the project wizard because it adds a bunch of useful c and h files. One of them being an interrupts.c. /******************************************************************************/ /* Interrupt Vector Options */ ...


0

I'm not sure how XC8 handles interrupt functions, but in C18 you must use a #pragma compiler directive to specify for the compiler that a particular function is an interrupt handler. This places a jump instruction to the interrupt handler at the proper interrupt vector location on the part. You should check the assembly listing to see if the interrupt vector ...


1

If I'm interpreting your question correctly it sounds like you want to sense the presence of AC voltage at 2 points. One point is the main supply, the second point is after a switch. You could use a resistor voltage divider to reduce the voltage to a level you could measure with a PIC, then a series diode to remove the negative half wave. The computer I'm ...


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 ...


2

A specific type of servo motor, a latching servo, is required for holding position after the control signal is removed. Depending on the specific servo in use (see caveats below), an alternative "poor man's latching servo" can be implemented thus: Control the power supply line for the servo with a high side switch, either a P-MOSFET or for high power ...


1

Here's an example of how I would create a lookup table for some precomputed values. I will use an example of swapping bits front-to-back within a byte. This is sometimes useful for FFT algorithms or SPI peripherals that want the wrong order. First I create a program that creates the table. Maintaining the table by hand is drudgery and error-prone, so ...


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 ...


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 ...


11

One thing that I haven't seen mentioned: The microcontroller you mentioned is only $0.34 each in quantities of 100. So for cheap, mass-produced products, it can make sense to go to the extra coding trouble imposed by such a limited unit. The same might apply to size or power consumption.


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 ...


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, ...


81

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: ...


1

Page 208 shows the block diagram of a typical I/O port. The PWM peripheral communicates with the output drivers via the output multiplexers. Therefore the sink/source capabilities in PWM mode are the same as when they're in GPIO mode, which for this device is either 15mA or 20mA. You may need to use an external driver fed from the PWM signal if you need ...


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: ...


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.


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.


0

AVDD and AVSS must be connected.


2

Some possibilities: Present the input signal with different scales to different A/D inputs. Range switching is then done in software. Roughly you want to use the signal with the highest reading that isn't clipped. In reality it is good to blend over at least part of the range with the next lower signal so that you have smooth overlap between the ranges. ...


0

So I had to re-read through the ADC document and ask for some help, but I think I've found the way. My previous iteration used a method of defining certain parameters, but I ended up just doing direct assignment to the registers eventually. For anyone else with the same problem, the following is my code: Configuration for analog: DDPCONbits.JTAGEN = 0; ...


2

As with all these kinds of low level issues, you have to read the datasheet. It's OK to call library routines, but on these small resource-limited systems where you're always close to the hardware, you have to know what's going on at the low level whether that is done in a library routine or your own code. Read the SPI part of the chapter for the MSSP ...


1

If you really want to learn the UART, take a look at my canned UART code for PIC and dsPIC. This should be included in the PIC Development Tools release at http://www.embedinc.com/pic/dload.htm. Look for files with "uart" in their names in the SOURCE > PIC and SOURCE > DSPIC directories within the software installation directory. For example, ...


2

You have unfortunately not learned much from your previous UART experience if that is all the code you have. Here it seems like you have used a couple of libraries (i.e header files) which has implemented all the "tricky" stuff for you. I would suggest that you take a look in your code and open up the UART1_Init() function. This is most likely included as ...


1

I suggest looking at the Microchip XC16 documentation that comes in the \docs folder of the installation, specifically 16-Bit_Language_Tools_Libraries_51456.pdf (for XC16 version 1.11). This has lots of UART examples and explains how to use the XC16 library functions to control the UART. I also suggest Microchip's Embedded Code Source site, as there are ...


1

If you attempt to erase a device and then perform a blank check on it and the blank check fails there’s a chance that the flash memory on the IC is bad. Flash memory based devices only have so many erase / write cycles that can be performed on them before they burn out.


-1

I think generating a known frequency on IR permits the designer to eliminate the effects of background IR (from Sun and CFL's etc.) So, suppose we use 40 kHz for a '1' and 25 kHz for a '0', the IR receiver needs to figure out the received frequency. We need pauses between frequencies to separate the received bits. How fast would the interrupts come frokm IR, ...


4

Just get a programmable LED display much like this one, and an audio amplifier and speaker. Hook these up to a PC, and do it all in software. You can play samples through the PC's audio line out to the amplifier to make whatever sound you want, and talk to the display over RS-232 to make it display numbers. Forget Arduino, custom electronics and so on. This ...


3

I find that a convenient way of getting a lot of LEDs for a little money is flexible LED strips. You can put soft diffusing plastic on top of the strips to make the light more even. You only need the Arduino for driving the score display. Build the LEDs into common-anode assemblies, one per digit, and switch the anode with a P-channel MOSFET and the ...


1

You don't "initialize" IIC protocol. The bus simply starts out idle, which is each line passively pulled up. Individual message do have a special start and end sequence. A start is the data line going low with the clock high (normally the data line is not allowed to change when the clock is high), and a stop is the data line going high with the clock ...


0

Yet another possible feature the MAC instruction can have is auto-incrementing the registers that point to multiplicands. I programmed a Zilog DSP that used the (16-bit fixed-point) Clarkspur core. It was a variation on Harvard architecture with three busses, letting it access three areas of memory simultaneously: Instruction memory, data ram bank 1, and ...


1

For Vr, the formula is based on the information in the datasheet. In the datasheet, it says the differential range will be from -0.5 * Vref to 0.5 * Vref. Vref in your schematic is 2.5V, and both channels - pin is at 2.5V, so the range is from 1.25V to 3.75V, which will be interpreted as -1.25V to +1.25V in the readings (it outputs a signed 16-bit integer ...


1

For the \$V_r\$ calculation: \$V_{ref}=\frac{V_{cc}}{2}\$, therefore \$V_{ref}=2.5V\$ the differential input range is from \$-0.5*Vref\$ up to \$0.5*Vref\$, therefore from -1.25...1.25V the result is in two's complement, with bit 15 as MSB, so the input ranges from -32768 to 32767 (bit 16 acts as additional sign bit, and together with bit 15 acts as ...



Top 50 recent answers are included