The Stack Overflow podcast is back! Listen to an interview with our new CEO.

New answers tagged

0

The specs ought to be clear in the datasheet. Vdd = 4.5V to 5.5V, V IO = 1.8V to 5.5V Use whatever you got in that range, or all 5V


1

As long as nothing else is hanging on the lines then it will be fine. When the chip unlocks for programming, all of the PPS selections are unselected. What it will interfere with is if you want to debug using the Pickit3.


2

Look at Table 1.1 on page 17: There are 3 programming ports available, just pick the ones that you want to use with the same number suffix. You can then map the pin back to the device you are using with this chart.


2

The microcontroller requires a steady DC supply. LED current is sourced from the microcontroller's Vdd pin. If no LED are lit, Vdd current is small. One LED lit draws about 10mA, which is sourced through Vdd. All eight LED will pull about 80mA from Vdd (a bit much). This current cannot be sourced from a DC supply having 670 ohms equivalent resistance that ...


1

I figured that I made a number of mistakes: I was supposed to expect a 500Hz waveform for a 1ms timer because the pin will toogle every edge (raising and falling); There is an obvious bug in the interrupt routine that clears the interrupt flag: the TMR0IF bit should be set to 0, not to 1 The calculations for the timer register are here for reference. This ...


0

Use Timer to generate periodic interrupt of 1 usec, then use counters for millisecond, seconds this will be more accurate and will not block codes, below is a code to generate millisecond timer with 8Mhz clock #define MILLISEC_MULTIPLIER 0.001 //1 milliseconds #define TIMER3_PRESCALER 4 #define MILLISEC_PERIOD (0xffff - (int)(MILLISEC_MULTIPLIER * OSC_FREQ/...


2

The delayus() function is flawed. It won't take one instruction to go round the loop, but multiple instructions. In disassembly a call to delayus() is two instructions. Delayus() itself is about 14 instructions with about nine of them being executed 48 times. That's about 450 instructions just for the delay us function - and that is with optimizations ...


2

1) "If I'm interpreting the datasheet correctly, this LED is happiest when it can draw 30mA" - It's not very clear in the datasheet, but you don't have to feed the LED the full 30mA. Less will do. It depends on how bright you would want the LED to be. You could start with 10-20mA or so. I'd expect even 5mA to be enough for the LED to light up. 2) "If my ...


1

A MOSFET gate takes very little current and can be driven directly from the output. Your 2-3V threshold voltage is perfect for a 5V circuit. If you want to reverse the logic, you could use a P-channel MOSFET on the high side of the LED, or invert the signal to the low side N-channel MOSFET. Luckily, based on the first answer, this will not be necessary.


Top 50 recent answers are included