# Tag Info

0

TIP120: Collector−Emitter Saturation Voltage 4 V ? your supply is 3 V :). Put mosfet instead. Your schematic is wrong.

0

you should check h21e of the transistor, you should use darlington pair or mosfet, since motor load translates to load on pic pin. when load small pic can drive transistor, when load bigger bipolar transistor will require current = 300mA/h21e to be open.

3

There are about 4 ways of connecting a voltage divider to an A/D and dealing with max input impedance requirement. Use small enough resistor. This is what the O.P. is already doing. Put an OpAmp buffer between the divider and A/D input. OpAmp should have high input impedance and low output impedance. [As already mentioned by Alex.] Use a larger resistor ...

4

The reason the ADC needs a low source impedance is because it has a switched capacitor input. Basically, whenever the ADC 'samples' the voltage on the pin, a small capacitor is connected, charged up, and then disconnected. If the impedance is too large, charging the capacitor up will draw enough current to create a voltage drop large enough to affect the ...

1

You might consider a comparator for VCC, and when it goes low use an interrupt to bring the program to a quick stop before the power goes totally out, instead of taking your chances with a cold power off. Edit: Might be a bit easier said than done, as Vcc for your comparator would also change. You'd need to use a voltage regulator to generate Vcc from a ...

0

Lot of details are missing from your requirements, but seems that you need some way to actively reset the controller when the power supply is switched off. Here is a concept. simulate this circuit – Schematic created using CircuitLab R1, R2 and C1 must be sized in such a way that during voltage zero crossings the base current is sufficient to ...

0

You can make an alternative way for the current to passa when you turn it off. As already said, probably you have some capacitors in your board (maybe in the power supply) that holds some charge and whenever you turn the power off, it still supplies some current to the circuit. You could create some mechanism to open an alternative path for your capacitor to ...

0

I had the same problem, working with a Pic16F883, and PicKitt3. And Now is fix it, I power the target card with a external source (5Vcd) and in the Project options --> Programmer, I uncheck box the option "POWER TARGET CIRCUIT FROM PICKKIT3", I hope this info help you.

2

Try adding: while(1){} to the end to keep your program from resetting. Unlike running a PC application, microcontrollers have nowhere to exit to from main(). Generally you need to have an infinite loop or the processor or code will reset and get executed over and over. For more complete explainations, see: Who receives the value returned by main()? or: ...

-1

Youpiiiiiii. I find answer to my question. It's throw this code line if (I2C4STATbits.S && !I2C4STATbits.R_W && !I2C4STATbits.D_A && I2C4STATbits.RBF) { // State1 // Master write, last byte was address. i2cAddressByte = I2C4RCV; } According to the value of i2cAddressByte I can say if the data is comming from ...

6

You can solve this problem with just a couple of parts. TI makes logic parts in their 74AC logic family that operate correctly down to 1.5V. Use a 4 bit counter as shown below to repeatedly count from 8 to 15. Use the RCO output, which is a one clock wide pulse to reload the counter and to also drive an R/C circuit to produce the narrow pulse that you ...

1

A CPLD like an XC2C32 from Xilinx would be perfect. Like an FPGA but much less complicated and powerful Can run at up to 300MHz 1.8V operation Cheap (less than \$2)

2

If I understand you correctly, then what you want could be achieved using a simple counter IC and a couple of logic gates. You could use a similar strategy to the linked project. For example, something like this 4-bit, 200MHz binary counter (or a similar chip) could be used with a couple of gates to check for every x111 state (i.e. 0111 and 1111) which ...

3

To save more data than 2 bytes accross a deep sleep: Redesign the application to require only two bytes (16 bits) accross deep sleep. Use a external battery-backed CMOS RAM. These take very little power when in standby, but still retaining their contents. A small coin cell can keep the contents alive for years. Use a external EEPROM. It can be ...

0

In section 3.6.1 of the 18F46J50 datasheet the following is written: Because VDDCORE could fall below the SRAM retention voltage while in Deep Sleep mode, SRAM data could be lost in Deep Sleep. Exiting Deep Sleep mode causes a POR; as a result, most Special Function Registers will reset to their default POR values Therefore you will need to save ...

3

You're missing something. Page 3 of your first link sums it up quite succinctly: Only SPI2 is remappable. What that means is: for a device with two SPI ports, SPI1 will be hard-wired to certain GPIO lines and you won't be able to change which ones they are.

0

Check out the product selector tool to help narrow down your search: http://www.microchip.com/ParamChartSearch/chart.aspx?branchID=1005. Like those before have already said, many options will work, but this tool helps you think about other constraints (like cost, package, speed, size, etc).

2

The inverting input(pin 6) to the comparator is a voltage reference of 3V. This is what you are comparing the non-inverting input(pin 5) to. When the non-inverting input is greater than the inverting input, the output(pin 7) will be high. Notice that there is a feedback resistor from the non-inverting input to the output. This is for hysteresis. It will ...

0

Have a look at the PIC32 family data sheet chapter 24. There the process of address detection is explained. It also shows (even though its not explictely mentioned in the text) that the address is in the I2C receive register after a valid address has been detected. The code above looks like you are using the PIC32 peripheral library that comes with xc32. ...

1

Proteus VSM (Virtual System Modeling) does not operate in real-time, at least not on even very high end desktop computers. The simulation is very processor-intensive, as you would notice if you brought up Windows Task Manager while the simulation is running. Depending on your computer's capabilities and the number of active simulation elements in your ...

0

Depending on the actual PIC you are using, you can route the clock (directly or divided) to an output. In the data sheet you linked above, see chapter 9 (Oscillator configuration) and look for 'REFCLKO'. You can route either the primary oscillator directly to the REFCLKO pin, or Fosc (which would be the frequency after the PLL in your case). According to ...

1

You can send any data type you like. The trick is to send the type along with the value so that it can be decoded on the other side. Send a byte value containing the type first (e.g. 0x00 is unsigned char, 0x01 is signed char, 0x02 is unsigned short, etc.) and then follow it with the actual value data. 0x00 0x12 0x1c 0x1f 0x85 0xeb 0x51 0xb8 0x1e 0x09 0x40 ...

1

Validated it with timer1! I toggle a GPIO in the timer1 interrupt. This all rests on my assumption that the time between timer1 interrupt fires is given by: = (1 / (f_osc / 2) * prescaler) * timer_period = (1 / (120MHz / 2) * 8) * 7500 = 1ms where the prescaler is chosen through T1CONbits.TCKPS and the timer_period is chosen through PR1. Note that f_osc ...

-1

This is the tested transfer function that will tell you how long until the interrupt fires: = (1 / (f_osc / 2) * prescaler) * timer_period = (1 / (120MHz / 2) * 8) * 7500 = 1ms where the prescaler is chosen through T1CONbits.TCKPS and the timer_period is chosen through PR1. Note that f_osc is the output of the PLL if you have one configured.

4

Congrats on making the effort to make sure your clock is set up correctly. Its super important on dspics, which will search for alternative clocks if it doesn't see the clock it expects. You're very close. Instead of trying to validate you clock by using a compiled loop where you think you know how many ticks you use, just toggle a bit in a timer ...

3

You certainly don't need IESO set if you're not going to switch the physical clock source. Here are the config bits I use for a dsPIC33FJ16GS504 project: // DSPIC33FJ16GS504 Configuration Bit Settings // FBS #pragma config BWRP = WRPROTECT_OFF // Boot Segment Write Protect (Boot Segment may be written) #pragma config BSS = NO_FLASH // Boot ...

-2

Test this: unsigned char I2C_RECV[1] void main(void) { unsigned int temp=0,temp2=0, i; for(i=0; i<1; i++) I2C_RECV[i]=0; TRISA = 0b0000000000000000; PORTA = 0b0000000000000001; /* INITIALISE I2C MODULE */ CloseI2C1(); // close i2c if it was operating earlier while(1){ config1 = (I2C_ON | I2C_7BIT_ADD | I2C_CLK_REL | ...

1

I've solved it with a macro: #define showpx asm(" MOV [W8], W9"); \ asm(" BTSC W9,#3"); \ asm(" BSET PORTC, #3"); \ asm(" MOV W9, PORTB"); \ asm(" INC2 W8, W8"); and repeated it like this: #define show8px showpx; showpx; showpx; showpx; showpx; showpx; showpx; showpx; show8px show8px show8px show8px ...

1

The short answer is, a PIC24F just isn't fast enough to be a useful display driver on its own. You would have more chance with a PIC24E due to its faster clock and DMA, but even then I doubt it would be practical because (as you have already discovered) the PIC would be so busy writing the video signal that it would never have time to receive or load new ...

4

In I2C, the clock only toggles as necessary to transmit or receive data. There's no need for a continuous clock signal so variation in the observed frequency should be expected. The 100kHz specification is the maximum clock rate rather than the average or continuous clock rate. Non-volatile memories like Flash and EEPROM need a relatively long period of ...

0

Wow, new tool was not configured correctly. I love these guys http://www.saleae.com/logic/, but didn't realize my settings should have been "Data is valid on clock trailing edge" and not clock leading edge. Settings saved now.

2

You appear to have your $F_{SYS}$ and $F_{OSC}$ formulae mixed up, per the datasheet you cited. $F_{SYS} = F_{IN} \cdot \dfrac{(PLLDIV + 2)}{(PLLPRE + 2)}$ $F_{OSC} = F_{IN} \cdot \dfrac{(PLLDIV + 2)}{((PLLPRE + 2) \cdot 2 (PLLPOST + 1))}$ By my math, with a 20MHz crystal and the following settings, you should get 240MHz at $F_{SYS}$ and 120MHz ...

1

You should look at COTS telephone line interface modules (TLI). They take all of the headache out of connecting an MCU to a phone line. Typical services include on/off hook signalling, ring detection, AC-coupled line in/out, sometimes a DC output derived from the DC present on the phone line (the 42.7Vdc you measured), and decent isolation (1-2000V) to ...

1

Your secondary is 14 ga, which has a cross-sectional area of $2\ \mathrm{mm}^2$. You spec 16 turns, for a total secondary area of $32\ \mathrm{mm^2}$. The area in the center of the toroid is $\pi({2.91\over{2}})^2\ \mathrm{mm^2}$, or $6.7\ \mathrm{mm^2}$. That's going to be a tight squeeze!

1

Clock stretching is allowed with I2C. This could be the reason for the behaviour. What happens when you transfer data at say 20kHz - do you see such lengthened pulses as well or do they disappear?

0

You do not specify what is meant by "not working", so I'll just point out a few things. The interrupt service routine posted does not seem to address the program function described. This routine toggles a port, waits a second, then goes back to whatever was running before the interrupt was triggered. Instead you say you want the program to wait for a ...

1

Now the race condition has been fixed something else that could be improved with your code is the jitter if that's of any concern for your application. The reason that's likely to occur is that the hardware timer will be locked to the main oscillator frequency whereas functions such as Delay_us are normally implemented as a loop of instructions so the timer ...

5

Looks like you have a race condition where the interrupt to increment the counter is occuring while the value is being read out. The solution is to declare the counter variable voltatile and then disable the timer interrupt while you copy the counter value into a temporary register.

4

The problem with your approach is that the EEPROM data is permanent, whereas the variable is volatile. Once the device is power cycled, how will you check the data in the future? The variable is gone, and all you have is the EEPROM copy. What you have so far is not a data integrity strategy, but only a write verification step (which is wortwhile; don't ...

1

CRC and Checksum routines also need to read back the data. The idea is that they can condense a large section of data down into just a couple of bytes that need to be checked. If you just wrote a block of data from a buffer in memory out onto the EEPROM chip, then just reading it back off the chip and comparing would be the simplest solution. However, if ...

2

MCLR is simply the !RESET line on the PIC processors - that is, any time MCLR becomes low, the processor will reset (it is possible to disable this functionality in the processor configuration). Even though it's tempting to avoid the (unlabeled pullup) resistor altogether and just tie MCLR to VDD, it will cause problems if you try to connect to the ...

2

Those functions are not called by you... they're provided by you. You implement those functions in your application to handle a MODBUS master's request for data from your slave. Look at examples provided online (search for those function names... what Tut provided) You'll need to call the MODBUS library's port setup functions and periodic polling functions ...

2

First, you have to decide power consumption in which state matters for you. There are several cases: sleep-mode, possibly with some peripherals left running (an RTC, a timer, a PWM output, etc.) very low-speed clock mode used instead of sleep-mode, with some peripherals left running normal (high) clock mode, with the desired peripherals Checking the ...

1

you might want to consider fixed-point numbers in many ways depending on the data you expect to deal with in your application just 8-bit fraction x its value would be x/255 8-bit integer x with 8-bit fraction y and its value x+y/255 8-bit fraction x times 2 to the power of 8-bit integer y, (x/255)*2^y 8-bit fraction x times 10 to the power of 8-bit integer ...

0

You can send any type of data through the serial line. On receiving the data will all be a bunch of bits packed into packets (depending on the protocol). The task of the software on the receiving side is to correctly interpret the received data. Obviously, other than the data you need to send information about the type of data. Eg: If is byte A is received ...

0

There is no such thins as "conversion" because "byte" is not a number representation. Hex, int, float are representations. Thus 4 bytes can be represented as : a unsigned integer from 0 to 4294967295 a signed interger from - −2147483648 to +2147483647 a float Thus if you have a 4 byte float, and you send those four bytes. Then you put them back ...

2

How the value types are represented in memory depends on the architecture (little/big endian for example) and on the standards it complies to. Example: The IEEE Standard for Floating-Point Arithmetic (IEEE 754) is a technical standard for floating-point computation established in 1985. From a micro controller perspective, the easiest way to send this kind ...

5

In section 27.0, "ELECTRICAL CHARACTERISTICS", under "Absolute Maximum Ratings", the third entry states that the voltage on any pin (with a few exceptions) may not be higher than VDD+0.3V. This means that the inputs on a 3V3 device are not 5V-tolerant. You will need to use a level shifter of some sort if you want to connect the GPS to the device.

1

You need to understand the format and size of the data types that are being sent. The easier example would be the integer. For your system, integers are represented with 2 bytes, or 16-bits (check your compiler documentation for the right size). You would analyze this on a scope the same way you would analyze sending a single byte, but instead watch for 4 ...

0

For this programmer, I believe you have to use RS232 serial. If you don't have a serial port on your computer, then you would have to get a USB to serial cable and use that. Or you can emulate a USB to serial cable with a USB to serial chip and an RS232 transceiver chip. Generally, these sorts of components can be purchased from electronics vendors like ...

Top 50 recent answers are included