Jump to content
43oh

oPossum

Members
  • Content Count

    925
  • Joined

  • Last visited

  • Days Won

    103

Everything posted by oPossum

  1. The ISR must always read UCA0RXBUF. It looks like your code may read it conditionally - that is likely to cause problems.
  2. Why are we talking about ARM here?
  3. There must be some delay between the displaySingle() calls. Best way to do that is to use an interrupt just fast enough to prevent flicker. Probably about 200 Hz for a 4 digit display. Quick fix is to use _delay_cycles();
  4. SLAS735A, Page 21, Figure 2 4.5 mA @ 16 MHz
  5. To use the high speed protocol just change write_ws2811() to write_ws2811_hs(). That will give you the most precise timing possible and allow use of any pin on port 1. SPI/IIC remains free for other uses. Here is some code for RTC: http://forum.43oh.com/topic/1957-software-real-time-clock-rtc-two-methods/ The 32 kHz crystal is used just for the RTC - the MSP430 can still run at 16 MHz.
  6. #pragma vector = TIMER0_A0_VECTOR __interrupt void Timer0_A0 (void) // Timer0 A0 interrupt service routine { static const uint8_t steps[8] = { #if 0 // Full step BIT0 | BIT1, BIT0 | BIT1, BIT1 | BIT2, BIT1 | BIT2, BIT2 | BIT4, BIT2 | BIT4 BIT0 | BIT4, BIT0 | BIT4 #else // Half step BIT0 | BIT1, BIT1, BIT1 | BIT2, BIT2,
  7. The 3k3 + 6k8 resistors with 5V are equivalent to 2k22 with 3.33V (th
  8. There are 3k3 pullup resistor to 5V. So there will be about 300 microamps current flow thru each of two of the ESD protection diodes in the MSP430. This will usually not cause problems as long as there is something on the MCU's supply rail to sink this current. If the MSP430 is running at 1MHz or more and not sleeping, then it will use that current. Adding 6k8 pulldown resistors to SDA and SCL would reduce the voltage to about 3.3V and prevent current flow thru the ESD diodes.
  9. If you have a module like this... and it is unreliable or not working at all, here is a possible fix. - Remove battery - Remove D1, R6 and R4 - Solder jumper wire in place of R6 - Inspect crystal soldering - fix if necessary - Replace battery The module should now work properly. It requires 5V power, but will work with 3.3V logic. The DS1307 can be replaced with the newer pin compatible DS1338 for operation from 1.8V to 5V, or the TI BQ32000 for 3.3V (only) operation. --- The battery backup circuit on these modules is of poor design. D1 and R5 provide a chargin
  10. A pair of 74HC244. Tie the outputs together, only enable one at a time.
  11. Using timer overflow interrupt instead of timer CCR0 interrupt #include <msp430.h> #pragma vector = TIMER0_A1_VECTOR // Timer A overflow (TAIFG) interrupt __interrupt void timer0_a1_isr(void) // { switch(TA0IV) { // TA0IV must be read to reset interrupt case 0x0A: // 0x0A == TAIFG (see SLAU144 12.3.5) P1OUT ^= BIT5; break; } } void main(void) { WDTCTL = WDTPW | WDTHOLD; // Disable watchdog reset DCOCTL = 0;
  12. #include <msp430.h> #pragma vector = TIMER0_A0_VECTOR // Timer A CCR0 interrupt __interrupt void timer0_a0_isr(void) // { P1OUT ^= BIT5; } void main(void) { WDTCTL = WDTPW | WDTHOLD; // Disable watchdog reset DCOCTL = 0; // Run at 8 MHz BCSCTL1 = CALBC1_8MHZ; // DCOCTL = CALDCO_8MHZ; // P1OUT = 0; // Setup GPIO P1DIR = BIT5;
  13. Energia uses the timer/counter units for PWM and millisecond/microsecond timing so they are not readily available for other uses. Here is some simple C code that uses a timer/counter unit with external clock to measure frequency: Frequency Counter using Launchpad & Nokia 5110 LCDhttp://forum.43oh.com/topic/1913-frequency-counter-using-launchpad-nokia-5110-lcd/
  14. It is a very reasonable design. Be aware the that voltage being switched must be about one volt higher than the microcontrollers's supply voltage. So if you are running a MSP430 at 3.3V, you could switch a 5V or higher rail, but not the 3.3V. Also be aware that if the higher voltage supply is absent then the microcontoller's output may be overloaded. R1 can be calculated with this formula: R1 = (Vcc - 0.7) * 10 / I So for a microcontroller running at 3.6V and a 100 mA load... R1 = (3.6V - 0.7) * 10 / 0.1 = 290 ohms (use 270 or 330) There will be some small leakage current thru
  15. It can detect pulses a few 10s of nanoseconds wide. Ultrasonic modules will typically disable the received pulse detection while transmitting and for a short time after. This prevents false triggering from the outbound chirp. So the close range limitation is probably due to an intentional feature of the ultrasonic module. Easy to check with a dual channel DSO.
  16. 16 channel software PWM: http://forum.43oh.com/topic/1723-16-channel-software-pwm-using-a-single-timer/ 8 channel software PWM: http://forum.43oh.com/topic/1770-8-channel-pwm-with-a-single-timer-low-ram-usage/
  17. Tiny printf: http://forum.43oh.com/topic/1289-tiny-printf-c-version/
  18. Pin 16 is grounded so the MSP430 is held in reset (not running) and the outputs float.
  19. That is usually not true due to I2R losses in the power source. Running at the lowest practical clock gives the highest capacity utilization and thus the longest battery life.
  20. in main() remove this line: IE2 |= (UCA0RXIE | UCA0TXIE); // Enable RX and TX interrupts #pragma vector=USCIAB0TX_VECTOR __interrupt void usciab0tx_isr (void) { if(serial_bp && *serial_bp) { UCA0TXBUF = *serial_bp++; } else { IE2 &= ~UCA0TXIE; } } void serial_out (char *p) { while(IE2 & UCA0TXIE); serial_bp = p; // set global pointer IE2 |= UCA0TXIE; // start things going! }
  21. The UART tx interrupt flag will be set whenever the tx buffer can accept a char. So if you are not feeding chars to the UART, then it may get stuck in the ISR. Turn on the tx interrupt enable when you have char(s) to send, turn it back off when there are no more to send.
  22. VU meters have a log response. Much of this is in the scale, but the movement may also be somewhat non-linear.
  23. It may be stuck in serial_nextchar() because you are not disabling the uart interrupt when there are no more chars left to send.
×
×
  • Create New...