Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by oPossum

  1. The Fraunchpad supports ADC DMA using trigger #24.
  2. A frame buffer for 256x192 pixels requires 6k. That is more than will fit in RAM, so the frame buffer is in the FRAM memory. NTSC video generated using TimerA0 for sync, and SPI with DMA for video. Graphics library functions: [*:hf56qo2f]Pixel [*:hf56qo2f]Line [*:hf56qo2f]Box [*:hf56qo2f]Circle [*:hf56qo2f]Ellipse [*:hf56qo2f]Quadratic and cubic bezier curve [*:hf56qo2f]BitBlt up to 24 pixels wide [*:hf56qo2f]OR, AND, and XOR drawing modes [*:hf56qo2f]Text with 8 x 12 font
  3. oPossum

    Bezier Curves

    Does anyone know of a pixel-by-pixel method using integer math to draw Bezier curves? I used the Google and found this interesting idea, but don't have time to study the math and try to implement it. Most of the info I found was just the math. Since I couldn't find the ideal algorithm, I just did a piecewise Bernstein polynomial with fixed point 16.16 integer math. It seems to work properly and is reasonably efficient. Any suggestions about how to improve this, or do it another way are most welcome. This is part of a MSP430 graphics library I am working on. Drawing code void be
  4. Unfortunately the Windows software uses MFC, so it can't be build with the Express version of Visual C. I am working on new software that uses Qt, and will be testing on Windows and Mac. Interesting that the LED of unknown type did not work. I have used a variety of IR LEDs from various mfg and they all worked. Large photodiodes have substantial capacitance, so no surprise it didn't work. An external pullup resistor may help compensate for the capacitance. I have developed a novel and very simple method to send IR, but haven't had time to do a write up. I have it working on PIC12F
  5. itoa() is not part of the standard C library and is absent from CCS. Here are three functions to convert signed and unsigned integers to ASCII. They are written for speed, not compactness. void itoa(int, char *); // Convert signed integer to ASCII void utoa(unsigned, char *); // Convert unsigned integer to ASCII void btoa(unsigned, char *); // Convert unsigned char to ASCII (leading spaces) itoa() and utoa() utoa ; --- Unsigned to ASCII --- ; - Range 0 to 65535 ; -
  6. Several of the MSP430 FRAM parts already have 128 kb (16 kB).
  7. The spec says 50 kHz max for xtal or external clock, but I have been able to use external clock at 6, 12, and 16 MHz without problems. I don't think higher frequency xtals will work due to the different drive requirements.
  8. I don't get any leading spaces using Chrome or IE 9 on Windows 7.
  9. New version with program and note display only. No scrolling. Left column is channel #, next is program #, and the remaining 6 columns are the notes. I like this format much better. StarWars music as required by forum rules. http://www.youtube.com/watch?v=0gG_kGgjmf8
  10. PuTTY is a free open source terminal program HyperTerminal PE 6.3 also works fine on Windows 7 & Vista.
  11. You need a high side current measurement circuit like one of these: Figure 1 is the obvious solution, but can have rather high error. Figure 2 has reduced error. The reasons are discussed here There are many chips that implement the circuit in Figure 2, but they are all tiny SMD parts. You could also measure the voltage on both sides of the current sense resistor using two ADC channels, but the resolution would be quite poor - not recommended.
  12. 14.31818 MHz oscillators (and crystals) are very common and would give you 3.58 MHz using a SMCLK divider of 4. You could also use TimerA to do divide by 4 if you don't want to run SMCLK slower.
  13. MIDI data is decoded and displayed. Video output of Fraunchpad is lower right (picture-in-picture), lower left is MIDI data being sent to serial port, top is MIDI player. Still have work to do on the code, so not posting it yet. The MIDI decode is in hex because I haven't written the itoa() functions yet. http://www.youtube.com/watch?v=M3jINBajWqI
  14. The Tx vector is used for IIC tx and rx. The Rx vector is used for IIC status.
  15. Test case and commented code for binary to packed BCD and binary to unpacked BCD This could be tweaked for 3 or 4 digits if you really need maximum speed and compactness. #include "msp430g2211.h" unsigned long bin2pbcd(unsigned bin); // Binary to packed BCD void bin2bcd(unsigned bin, char * bcd); // Binary to unpacked BCD int main(void) { unsigned long pbcd; char bcd[5]; WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer pbcd = bin2pbcd(0); // 43 cycles pbcd = bin2pbcd(1); // 43 cycles pbcd = bin2pbcd(9);
  16. ; ; Convert 16 bit binary to 24 bit packed BCD ; C prototype: unsigned long bin2bcd(unsigned x) ; clr R13 clr R14 swpb R12 tst.b R12 jz lsb swpb R12 rla R12 dadd R14, R14 rla R12 dadd R14, R14 rla R12 dadd R14, R14 rla R12 dadd R14, R14 rla R12 dadd R14, R14 rla R12 dadd R14, R14 rla R12 dadd R14, R14 rla R12 dadd R14, R14 lsb rla R12 dadd R14, R
  17. Here is the video code written in C for those who don't understand assembly. The ISR uses a state machine to change the sync timing as the frame progresses. The Timer A compare registers are updated as needed to produce proper NTSC sync timing. A few states will also do setup for the actual video generation. This method is very simple and flexible. The C code was a bit too slow to get the equalization pulse timing exact, so the sync pulse is a litter wider than it should be (50 clocks vs. 38 clocks). The ISR... __interrupt void video_isr(void) // Video ISR {
  18. It is good practice to have a 100 nF (0.1 uF) capacitor across the power pins. That may not be your problem, but it would be good to add one just to rule that out.
  19. Good project for you VGA is easier than NTSC. The sync is very simple. Set Timer A for ~31.5 kHz for hsync, and do vsync at ~60 Hz in the ISR.
  20. I am using CCS. Higher clock allows use of sprites, fonts, overlays, and such. At lower frequencies everything has to be in a frame buffer or be very simple dynamic content. The small flash and RAM is much more limiting than the speed.
  21. LaunchPad hardware revision? We need your opinions - the future of LaunchPad is in your hands!
  22. 15.7 ksps WOW! 16.6 ms sweep Amazing! Special limited time offer - only $4.30! Order now. Operators are standing by. .cdecls C, LIST, "msp430g2231.h" .text .global _main .bss sync_state, 2 .bss sync_lines, 2 .bss video_state, 2 .bss vid_line, 2 _main ; mov #WDTPW | WDTHOLD, &WDTCTL ; No watchdog ; mov #XT2OFF + 15, &BCSCTL1 ; DCO 16 Mhz mov #0x86, &DCOCTL ;
  23. I think video overlay is best done by dedicated chips. Creating a MCU clock that is phase locked to the video sync and/or colorburst is non-trivial. The video will shake (jitter) without phase lock. I have used the Zilog Z86229 chip and it works well. Thanks for the DVM code. I have modified it to write directly to the video buffer and not use division or mod (they are slow and use a lot of code). The font has been packed in to fewer words. #include "msp430g2231.h" #include "string.h" void video_init(void); unsigned pix[14]; static const unsigned digits[5][3] = { // 0123 4
  24. // main.c #include "msp430g2211.h" #include "string.h" void video_init(void); unsigned pix[14], nxt[14]; unsigned get_pix(int x, int y) { if(x < 0 || x > 15 || y < 0 || y > 13) return 0; return (pix[y] >> x) & 1; } void main(void) { int x, y, n; WDTCTL = WDTPW + WDTHOLD; // No watchdog BCSCTL1 = XT2OFF + 15; // DCO 16 Mhz DCOCTL = 0x86; // // P1DIR = 0xF2; // I/O assignment P1REN = 0x0D; // Pull up resistor P1OUT = 0x0F; // P1SEL = 0x50; // Enable Timer A out
  • Create New...