Jump to content
43oh

jsolarski

Members
  • Content Count

    568
  • Joined

  • Last visited

  • Days Won

    8

Reputation Activity

  1. Like
    jsolarski reacted to oPossum in Game of Life with G2211   
    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 { // if(--sync_lines) { // Decrement the sync line count, if not zero yet then if(video_state) active_video(); // generate video if video_state is non-zero } else { // Sync line count is now zero, so update the sync timing switch(sync_state) { // default: // Restart state machine sync_state = 0; // case 0: case 2: case 8: case 10: // Equalizing pulses - 6 half lines TACCR1 = 50; TACCR0 = 508; sync_lines = 6; break; case 1: case 9: // Vertical sync - 6 half lines TACCR1 = 508 - 75; sync_lines = 6; break; case 3: case 12: // VBI - 11 lines TACCR1 = 75; TACCR0 = 1016; sync_lines = 11; break; case 4: case 6: case 13: case 15: // 9 blank lines sync_lines = 9; video_state = 0; break; case 5: case 14: // Active video - 224 lines sync_lines = 224; video_state = 1; vid_line = 0; active_video(); break; case 7: case 11: // Half line - 1 half line TACCR1 = 75; TACCR0 = 508; sync_lines = 1; break; } // ++sync_state; // Move to next state } // } //
     
    Complete code... (equivalent to video.asm)

    // video.c #include "msp430g2211.h" extern unsigned pix[14]; static unsigned sync_state; static unsigned sync_lines; static unsigned video_state; static unsigned vid_line; void video_init(void) { sync_state = 0; sync_lines = 1; video_state = 0; TACCR0 = 1016; TACCR1 = 75; TACTL = 0x0210; TACCTL1 = 0x0060; TACCTL0 |= 0x0010; _EINT(); } void active_video(void) { register unsigned b, n, d; #if 1 //__asm(" mov &TAR, R12"); __asm(" mov &0x0170, R12"); __asm(" cmp #144, R12"); __asm(" jlo $ - 8"); __asm(" and #7, R12"); __asm(" rla R12"); __asm(" add R12, PC"); __asm(" nop"); __asm(" nop"); __asm(" nop"); __asm(" nop"); __asm(" nop"); __asm(" nop"); __asm(" nop"); #else while(TAR < 160); #endif b = pix[vid_line++ >> 4]; n = 16; do { if(b & 0x8000) P1OUT |= 0x80; else { P1OUT &= ~0x80; __asm(" nop"); __asm(" nop"); } b <<= 1; d = 10; while(--d); --n; } while(n); P1OUT &= ~0x80; } #pragma vector = TIMERA0_VECTOR __interrupt void video_isr(void) // Video ISR { // if(--sync_lines) { // Decrement the sync line count, if not zero yet then if(video_state) active_video(); // generate video if video_state is non-zero } else { // Sync line count is now zero, so update the sync timing switch(sync_state) { // default: // Restart state machine sync_state = 0; // case 0: case 2: case 8: case 10: // Equalizing pulses - 6 half lines TACCR1 = 50; TACCR0 = 508; sync_lines = 6; break; case 1: case 9: // Vertical sync - 6 half lines TACCR1 = 508 - 75; sync_lines = 6; break; case 3: case 12: // VBI - 11 lines TACCR1 = 75; TACCR0 = 1016; sync_lines = 11; break; case 4: case 6: case 13: case 15: // 9 blank lines sync_lines = 9; video_state = 0; break; case 5: case 14: // Active video - 224 lines sync_lines = 224; video_state = 1; vid_line = 0; active_video(); break; case 7: case 11: // Half line - 1 half line TACCR1 = 75; TACCR0 = 508; sync_lines = 1; break; } // ++sync_state; // Move to next state } // } //
  2. Like
    jsolarski reacted to MattTheGeek in Gearing up to release EasyMSP 0.8.3 Beta1   
    Hello Everyone,
     
    I'm gearing up to release EasyMSP 0.8.3 Beta1 which should be a massive improvement to the documentation and code.
     
    Preliminary changelog:
     
    Fixed:
    flashWriteWord()
    enableTimer()
    clearWD()
    delayms()
    delaysec()
     
    Added:
     
    Flash:
    flashWriteByte()
    eraseMainMemory()
    eraseFlashSegment()
    eraseAllMemory()
     
    GPIO:
    enableResistor()
    disableResistor()
    pullDownPin()
    pullUpPin()
    enablePinInterrupt()
    disablePinInterrupt()
    interruptEdgeSelect()
     
    System:
    enableInterrupts()
    disableInterrupts()
    enterAM()
    enterLPM0()
    enterLPM1()
    enterLPM2()
    enterLPM3()
     
    Also, EasyMSP also now handles Reset and NMI interrupts.
  3. Like
    jsolarski got a reaction from gwdeveloper in Uniarch mspgcc ISR syntax   
    For coding interrupts on uniarch mspgcc --
     
    use the following format
     

    __attribute__((interrupt(ISR_VECTOR))) void Isr_Vector_Name(void) { //code goes here }
     
    no need to include signal.h, or leagacymsp430.h
    you will only need to include the device specific header or msp430.h
    http://sourceforge.net/mailarchive/foru ... pgcc-users
    or check out my post for all 4 variations ---http://justinstech.org/2011/07/msp430-different-interrupts-for-different-compilers/
     
    also one other thing i noticed is isr_compat.h in the current build for uniarch
    I will trying it out and seeing if it will make porting code from either IAR/CSS or mspgcc4 easier.
  4. Like
    jsolarski reacted to bluehash in [ SPAM ] - Spam Hammer Implemented! No More Zombies.   
    Hello 43oher's,
    We've implemented Dangerous Prototypes' Spam Hammer - a spam blocking mod. It had proved itself to be very powerful in the dp forums as well as the phpbb3 forums. The install went well and the databases look fine, so no problems there. This is on a test run - so there will be a report here in this thread in two weeks. Thanks to DP for developing the mod.
     
    FAQ:
    This forum is protected by phpBB3 spam hammer. Here's how our simple anti-spam measures work.
     
    These restrictions only apply to new users. They are removed automatically after your account meets certain criteria. Normal users will never be effected by these restrictions.
     
    Spam poured in after our recent move to a phpBB forum. Captchas, registration questions, and other measures only stopped the stupidest scripts and annoyed everyone. Instead, we stopped spammers from getting what they want - new members can't post links. This method that has stopped 100% of spam so far, and it is totally transparent to most people.
     
    How does it work?
    New user accounts are slightly restricted to deny spammers a place to put a link.
     
    These restrictions only apply to new users. They are removed automatically after your account meets certain criteria. Normal users will never be effected by these restrictions.
     
    1. New users receive an error if they use off-site links in posts or signatures. New users can still link to 43oh.com, and a select set of white-list sites like Google Code, distributors, etc.
    2. New users receive an error if they use certain forbidden words in posts or signatures. The error reports the trigger word to help you find and remove it.
    3. New users receive an error if they enter non-English characters (like Cyrillic).
    4. New users can't save a personal profile. Spammers like to put a URL in the personal profile.
    5. Accounts that don't post within 24 hours of registration are automatically disabled and then purged. We get 100s of zombie spam registrations every day, an automated process cleans them out.
     
    Who is a new user?
    The above restrictions only apply to new users. We are constantly tweaking the definition of a new user to stop spam while not annoying real people. These restrictions currently apply to users who:
    *Have less than 1 post
    *Registered in the last 24 hours
    The restrictions are automatically removed once an account meets these criteria.
     
    Warning!! Extreme honey-pot mode in use!!
    Users with 0 posts will be automatically deleted for certain common spam behaviors:
    *Entering a profile
    *Entering a signature with external links
    *Entering more than 20 links in the first post
     
    Need Help?
    Contact admin AT 43oh . com
  5. Like
    jsolarski reacted to Rickta59 in MSP-EXP430FR5739 demo code ported to msp430-gcc   
    The latest uniarch msp430-gcc does support the msp430fr5739. However, at this time, mspdebug
    doesn't support it. I have exchanged emails with Daniel Beer, primary developer on mspdebug,
    and he has indicated he is already working on this. I'm hoping this welcome addition will appear soon.
     
    There might be another option. I just noticed that TI offers a command line win32 only program flasher
    with source code on the their website:
     
    http://processors.wiki.ti.com/index.php/MSP430_Flasher_-_Command_Line_Programmer
     
    It might be possible to run this using WINE under linux. I haven't even tried this on Windows so I don't
    know if the program even supports the FRAM chip.
     
    BTW: msp430-gcc uniarch just got easier to install on ubuntu. You can now find the required binary
    install packages at https://launchpad.net/ubuntu/oneiric/+search?text=msp430. Previously, I was using
    a source build I hand cobbled, now I've switched to binary install with good success.
    Note: I'm running Ubuntu 11.04 natty.
     
    -rick
  6. Like
    jsolarski got a reaction from mtlevine0 in LED matrix display pixel ghosting   
    it looks like a similar problem i had with a 3 digit display that was multiplexed. My issue was switching two fast and the display would ghost with the digits next to it.
    I found 2 solutions which may help you.
     
    One is set a longer delay between character writes/column writes. Adding a few more ms to a delay may work. You will have to play around with it to find the spot that needs the delay, but my guess is after the shiftouts but before that for loop ends
     
    the other may not work for you since I dont know what your circuit looks like, but I also added some pulldown resistors on the data lines, but i was using transistors to multiplex my display. (8 character lines + 3 multiplex lines) after doing this i was able to run it much faster, but i lost some brightness on faster speeds.----- maybe use the built in pulldowns/pullups? remember to use the one for the correct initial state- (IE latch - low = pulldown )
  7. Like
    jsolarski got a reaction from gwdeveloper in Definitive guide to installing/using mspgcc4?   
    I usually use this site for reinstalling it
    http://mspgcc4.sourceforge.net/
     
     
    using

    git clone git://mspgcc4.git.sourceforge.net/gitroot/mspgcc4/mspgcc4 cd mspgcc4 && perl buildgcc.pl
     
    on a clean install, i needed libusb dev files, and a few others but nothing really major.
     
     
    if you rebuild it, I can help you with the errors that come up
  8. Like
    jsolarski got a reaction from pimmel in Makefile for MSPGCC   
    here are the 2 make files I use for mspgcc - for use or comparison
     

    OBJECTS = main.o CC = msp430-gcc CFLAGS =-Os -Wall -g -mmcu=msp430x2011 all : $(OBJECTS) $(CC) $(CFLAGS) $(OBJECTS) -o main.elf %.o : %.c $(CC) $(CFLAGS) -c $< clean: rm -fr $(OBJECTS) main.elf erase: mspdebug rf2500 "erase" upload: mspdebug rf2500 "prog main.elf" size: msp430-size main.elf
     

    CC=msp430-gcc CFLAGS=-Os -Wall -g -mmcu=msp430g2231 OBJS=main.c all: $(OBJS) $(CC) $(CFLAGS) -o main.elf $(OBJS) %.o: %.c $(CC) $(CFLAGS) -c $< clean: rm -fr main.elf $(OBJS)
     
     
    very simple and no extra flags
     
    as for all your flags, time to get out the gcc manual lol
  9. Like
    jsolarski got a reaction from gordon in Makefile for MSPGCC   
    here are the 2 make files I use for mspgcc - for use or comparison
     

    OBJECTS = main.o CC = msp430-gcc CFLAGS =-Os -Wall -g -mmcu=msp430x2011 all : $(OBJECTS) $(CC) $(CFLAGS) $(OBJECTS) -o main.elf %.o : %.c $(CC) $(CFLAGS) -c $< clean: rm -fr $(OBJECTS) main.elf erase: mspdebug rf2500 "erase" upload: mspdebug rf2500 "prog main.elf" size: msp430-size main.elf
     

    CC=msp430-gcc CFLAGS=-Os -Wall -g -mmcu=msp430g2231 OBJS=main.c all: $(OBJS) $(CC) $(CFLAGS) -o main.elf $(OBJS) %.o: %.c $(CC) $(CFLAGS) -c $< clean: rm -fr main.elf $(OBJS)
     
     
    very simple and no extra flags
     
    as for all your flags, time to get out the gcc manual lol
  10. Like
    jsolarski reacted to cde in Ti Launchpad Student Guide and Manual   
    Anyone see this?
     
    Ti Launchpad Student Guide and Manual
    http://www.csit-sun.pub.ro/courses/cn1C ... nchPad.pdf
     
    Also called the Getting Started with the MSP430 LaunchPad Workshop
    http://processors.wiki.ti.com/index.php ... d_Workshop
     
    Like a full out TI produced class curriculum. Student/hobbyist targeted instead of engineer targeted. Videos and Powerpoints too.
  11. Like
    jsolarski reacted to gordon in Makefile for MSPGCC   
    Rickta59 says this might be of interest to others, so here's the Makefile I've been using for MSPGCC.
     

    TARGETMCU ?= msp430g2211 CROSS := msp430- CC := $(CROSS)gcc CXX := $(CROSS)g++ OBJDUMP := $(CROSS)objdump SIZE := $(CROSS)size LD := $(CC) MSPDEBUG := mspdebug LDFLAGS := -mmcu=$(TARGETMCU) CFLAGS := -Os -Wall -W -Wextra -Werror -g -mmcu=$(TARGETMCU) ifneq ($(WITH_CXX),) CC := $(CXX) LD := $(CC) endif ifneq ($(DEBUG),) ifeq ($(WITH_CXX),) CFLAGS += -Wstrict-prototypes -Wmissing-prototypes -Wbad-function-cast CFLAGS += -Werror-implicit-function-declaration -Wdeclaration-after-statement CFLAGS += -Wnested-externs -Wold-style-definition CFLAGS += -finline-functions endif CFLAGS += -Wmissing-declarations -Winit-self -Winline -Wredundant-decls CFLAGS += -Wshadow -Wpointer-arith -Wcast-qual -Wsign-compare -Wformat=2 CFLAGS += -Wfloat-equal -Wmissing-field-initializers CFLAGS += -Wmissing-include-dirs -Wswitch-default -Wpacked CFLAGS += -Wpacked -Wlarger-than-65500 -Wunknown-pragmas CFLAGS += -Wmissing-format-attribute -Wmissing-noreturn CFLAGS += -Wstrict-aliasing=2 -Wswitch-enum -Wundef -Wunreachable-code CFLAGS += -Wunsafe-loop-optimizations -Wwrite-strings -Wcast-align CFLAGS += -Wformat-nonliteral -Wformat-security -Waggregate-return CFLAGS += -fno-common -Wp,-D_FORTIFY_SOURCE=2 endif SRCS := main.c PROG := $(firstword $(SRCS:.c=)) OBJS := $(SRCS:.c=.o) all: $(PROG).elf $(PROG).lst $(PROG).elf: $(OBJS) $(LD) $(LDFLAGS) -o $(PROG).elf $(OBJS) %.o: %.c $(CC) $(CFLAGS) -c $< %.lst: %.elf $(OBJDUMP) -DS $< > $@ $(SIZE) $< clean: -rm -f $(PROG).elf $(PROG).lst $(OBJS) install: $(PROG).elf $(MSPDEBUG) -n rf2500 "prog $(PROG).elf"
     
    I don't know what half of the CFLAGs mean anymore (some of them most likely don't even have any real meaning in the MSP430 context), I have collected them during the years, the result is considerably anal about code quality, though.
     
    roxfan notes,
     
    Well, I got used to objdump's output, that's about it.
     
    It's GNU make, don't even try with others, really. Also don't forget to expand spaces to tabs.
  12. Like
    jsolarski reacted to RobG in Using a servo with a Launchpad   
    The code is OK, the only trick is P1.0 controls P1.7, P1.1 -> P1.6, P1.2 -> P1.5, P1.3 -> P1.4
    If that still doesn't work, try powering your servo from 5V source.
     


  13. Like
    jsolarski reacted to bluehash in Dangerous Prototypes Thermal Printer Tweeter.   
    Send a Tweet to @dangerousproto and watch it print live on the USTREAM feed.
     

     
  14. Like
    jsolarski reacted to oPossum in Fraunchpad poly synth   
    16 voices of 16 bit x 257 interpolated wavetable - derived from this code for the Launchpad.
    PWM output, but could easily be adapted to use IIC DAC.
     
    This is preliminary and eXperimental. The CPU core seems to be running slower than it should and I don't yet know why. Right now it is limited to 9 voices. The 9600 bps UART on the dev board was used for this demo, but standard MIDI can also be used - just change the bit rate divisor and wire up the usual opto circuit for MIDI.
     
    This is part of a larger project I am working on.
     


     

    //main.c #include "msp430fr5739.h" void synth_init(void); void set_note(int, int, int); static int assign[16]; void note_on(int n, int v) { int i; for(i = 0; i < 16; ++i) { if(assign[i] == -1) { assign[i] = n; set_note(i, n, v); break; } } } void note_off(int n) { int i; for(i = 0; i < 16; ++i) { if(assign[i] == n) { assign[i] = -1; set_note(i, -1, 0); break; } } } void midi_ex(unsigned a, unsigned b, unsigned c) { ++PJOUT; switch(a & 0xF0) { case 0x90: // Note on if(c) { note_on(b, c); break; } // fall thru case 0x80: // Note off note_off(; break; /* case 0xA0: // Note aftertouch break; case 0xB0: // Controller break; case 0xC0: // Program change break; case 0xD0: // Channel aftertouch break; case 0xE0: // Pitch bend break; case 0xF0: // Sysex / Meta break; */ } } void midi(unsigned c) { static const unsigned ps[8] = { 2, 2, 2, 2, 1, 1, 2, 4 }; static unsigned state = 0; static unsigned rs = 0; static unsigned d1 = 0; if(c & 0x80) { // First octect of sequence rs = c; state = ps[(rs >> 4) & 7]; } else { switch(state) { case 0: // Discard break; case 1: // Second and final octet midi_ex(rs, c, 0); break; case 2: // Second octet of three d1 = c; ++state; break; case 3: // Third and final octet midi_ex(rs, d1, c); state = 2; break; //case 4: // Sysex data // break; } } } void main(void) { unsigned n; WDTCTL = WDTPW + WDTHOLD; CSCTL0 = 0xA500; // Unlock clock registers CSCTL1 = DCORSEL | DCOFSEL1 | DCOFSEL0; // 24 MHz CSCTL2 = 0x0333; // Use DCO clock for ACLK, SMCLK and MCLK CSCTL3 = 0x0000; // Set all clock dividers to 1 //CSCTL4 = //CSCTL5 = P1DIR = 0x01; // PWM audio out P1REN = 0x00; // P1OUT = 0x00; // P1SEL0 = 0x01; // Enable Timer A output P1SEL1 = 0x00; // P2DIR = 0x00; // P2REN = 0x00; // P2OUT = 0x00; // P2SEL0 = 0x00; // P2SEL1 = 0x03; // Enable UART UCA0 P3DIR = 0x10; // P3REN = 0x00; // P3OUT = 0x00; // P3SEL0 = 0x10; // SMCLK output P3SEL1 = 0x10; // SMCLK output P4DIR = 0x00; // P4REN = 0x00; // P4OUT = 0x00; // P4SEL0 = 0x00; // P4SEL1 = 0x00; // PJDIR = 0x0F; // 4 LEDs PJREN = 0x00; // PJOUT = 0x0F; // PJSEL0 = 0x00; // PJSEL1 = 0x00; // UCA0CTLW0 = 0x0080; // UCA0BRW = 24000000 / 9600; // Fraunchpad UART //UCA0BRW = 24000000 / 31250; // Standard MIDI bit rate synth_init(); //set_note(0, 69, 700); // 440 Hz test for(n = 0; n < 16; ++n) assign[n] = -1; for(; { if(UCA0IFG & 1) { UCA0IFG &= ~1; n = UCA0RXBUF; midi(n); } } }
     

    ;synth.asm .cdecls C, LIST, "msp430fr5739.h" smplrt .equ 32000 ; Sample rate .text .global set_tick .global get_tick .global synth_init .global set_note .bss tick, 2 .bss pwm_out, 2 .bss phase_inc, 6 * 16 ; Phase increment LSW/MSW (from note table) ; Level .bss phase_acc, 4 * 16 ; Phase accumulator LSW/MSW set_tick mov R12, &tick reta get_tick mov &tick, R12 reta synth_init mov #0x0210, &TA0CTL ; Timer A config: SMCLK, count up mov #750, &TA0CCR0 ; Setup Timer A period for 32000 sps mov #375, &TA0CCR1 ; Setup Timer A compare mov #0x00E0, &TA0CCTL1 ; Setup Timer A reset/set output mode ; mov #phase_inc, R12 ; Clear all phase inc and accum mov #5 * 16, R14 ; Word count clr 0(R12) ; Clear word incd R12 ; Next word dec R14 ; Dec word count jne $ - 8 ; Loop until all words done... ; eint ; Enable interupts bis #0x0010, &TA0CCTL0 ; Enable PWM interupt ; reta ; ; synth_isr ; mov &pwm_out, &TA0CCR1 ; Output sample ; push R4 ; Wavetable pointer push R5 ; Phase increment / level pointer push R6 ; Phase accumulator pointer push R7 ; Voice count push R8 ; Wave sample pointer / next sample push R9 ; Wave sample push R10 ; Voice mix accumulator MSW push R11 ; Voice mix accumulator LSW ; mov #sine, R4 ; Get wavetable pointer mov #phase_inc, R5 ; Setup phase increment pointer mov #phase_acc, R6 ; Setup phase accumulator pointer mov #16, R7 ; Setup voice count mov #9, R7 ; clr R10 ; Clear voice mix clr R11 ; voice_loop ; mov @R6+, &MPYS32L ; Get phase acc LSW (fraction) to multiplier clr &MPYS32H ; mov @R6+, R8 ; Get phase acc MSW (wave table index) mov.b R8, R8 ; Clear MSB (use mask for smaller / larger tables) add R4, R8 ; Add wavetable pointer mov @R8+, R9 ; Get wave sample mov @R8, R8 ; Get next wave sample sub R9, R8 ; Calc delta mov R8, &OP2L ; Multiply by delta subc R8, R8 ; Sign extend delta mov R8, &OP2H ; add @R5+, -4(R6) ; Update phase acc addc @R5+, -2(R6) ; add &RES1, R9 ; Add interpolation to sample mov R9, &MPYS ; Multiply by voice level mov @R5+, &OP2L ; add &RES0, R11 ; Update mix addc &RES1, R10 ; dec R7 ; Dec voice count jne voice_loop ; Next voice... ; add #375, R10 ; Bias to center of PWM range mov R10, &pwm_out ; ; dec &tick ; jc $ + 6 ; clr &tick ; ; pop R11 ; pop R10 ; pop R9 ; pop R8 ; pop R7 ; pop R6 ; pop R5 ; pop R4 ; reti ; ; set_note ; push R14 ; Save level mov R12, R14 ; Voice * 6 add R14, R12 ; (+1 = *2) add R14, R12 ; (+1 = *3) rla R12 ; (*2 = *6) add #phase_inc, R12 ; Add phase inc pointer cmp #128, R13 ; Out of range note values are note off jhs note_off ; clr R14 ; Clear octave count tst_note ; cmp #116, R13 ; Within note table? jge get_pi ; Yes... inc R14 ; Inc octave count add #12, R13 ; Add octave to note jmp tst_note ; Check again... get_pi ; Get phase increment sub #116, R13 ; Adjust for first note in table rla R13 ; MIDI note * 4 rla R13 ; add #notes, R13 ; Add note table pointer mov @R13+, R15 ; Get LSW mov @R13, R13 ; Get MSW tst R14 ; Shifting required? jeq set_phase ; No... shift_phase ; rra R13 ; Shift phase inc rrc R15 ; dec R14 ; Dec octave count jne shift_phase ; Repeat until zero... set_phase ; mov R15, 0(R12) ; Set phase inc mov R13, 2(R12) ; pop 4(R12) ; Set voice level reta ; Return ; note_off ; incd SP ; Discard level clr 0(R12) ; Clear phase inc clr 2(R12) ; .if 0 ; Note: Abrupt return to zero causes poping clr 4(R12) ; Clear level add #phase_acc - phase_inc, R12 ; Phase accum pointer clr 0(R12) ; Clear phase accum clr 2(R12) ; .endif ; reta ; Return ; ; notes ; MIDI Note Frequency .if smplrt == 32000 ; 32000 sps .long 3483828 ; 116 G#8 6644.87457275391 .long 3690988 ; 117 A8 7040.00091552734 .long 3910465 ; 118 A#8 7458.62007141113 .long 4142993 ; 119 B8 7902.13203430176 .long 4389349 ; 120 C9 8372.01881408691 .long 4650353 ; 121 C#9 8869.84443664551 .long 4926877 ; 122 D9 9397.27210998535 .long 5219845 ; 123 D#9 9956.06422424316 .long 5530233 ; 124 E9 10548.0823516846 .long 5859077 ; 125 F9 11175.3025054932 .long 6207476 ; 126 F#9 11839.8208618164 .long 6576592 ; 127 G9 12543.8537597656 .endif ; ; .if smplrt == 48000 ; 48000 sps .long 2322552 ; 116 G#8 6644.87457275391 .long 2460658 ; 117 A8 7039.99900817871 .long 2606977 ; 118 A#8 7458.62102508545 .long 2761996 ; 119 B8 7902.13394165039 .long 2926232 ; 120 C9 8372.01690673828 .long 3100235 ; 121 C#9 8869.84348297119 .long 3284585 ; 122 D9 9397.27306365967 .long 3479896 ; 123 D#9 9956.06231689453 .long 3686822 ; 124 E9 10548.0823516846 .long 3906052 ; 125 F9 11175.3044128418 .long 4138318 ; 126 F#9 11839.8227691650 .long 4384395 ; 127 G9 12543.8547134399 .endif ; sine .int 0 .int 804 .int 1608 .int 2410 .int 3212 .int 4011 .int 4808 .int 5602 .int 6393 .int 7179 .int 7962 .int 8739 .int 9512 .int 10278 .int 11039 .int 11793 .int 12539 .int 13279 .int 14010 .int 14732 .int 15446 .int 16151 .int 16846 .int 17530 .int 18204 .int 18868 .int 19519 .int 20159 .int 20787 .int 21403 .int 22005 .int 22594 .int 23170 .int 23731 .int 24279 .int 24811 .int 25329 .int 25832 .int 26319 .int 26790 .int 27245 .int 27683 .int 28105 .int 28510 .int 28898 .int 29268 .int 29621 .int 29956 .int 30273 .int 30571 .int 30852 .int 31113 .int 31356 .int 31580 .int 31785 .int 31971 .int 32137 .int 32285 .int 32412 .int 32521 .int 32609 .int 32678 .int 32728 .int 32757 .int 32767 .int 32757 .int 32728 .int 32678 .int 32609 .int 32521 .int 32412 .int 32285 .int 32137 .int 31971 .int 31785 .int 31580 .int 31356 .int 31113 .int 30852 .int 30571 .int 30273 .int 29956 .int 29621 .int 29268 .int 28898 .int 28510 .int 28105 .int 27683 .int 27245 .int 26790 .int 26319 .int 25832 .int 25329 .int 24811 .int 24279 .int 23731 .int 23170 .int 22594 .int 22005 .int 21403 .int 20787 .int 20159 .int 19519 .int 18868 .int 18204 .int 17530 .int 16846 .int 16151 .int 15446 .int 14732 .int 14010 .int 13279 .int 12539 .int 11793 .int 11039 .int 10278 .int 9512 .int 8739 .int 7962 .int 7179 .int 6393 .int 5602 .int 4808 .int 4011 .int 3212 .int 2410 .int 1608 .int 804 .int 0 .int -804 .int -1608 .int -2410 .int -3212 .int -4011 .int -4808 .int -5602 .int -6393 .int -7179 .int -7962 .int -8739 .int -9512 .int -10278 .int -11039 .int -11793 .int -12539 .int -13279 .int -14010 .int -14732 .int -15446 .int -16151 .int -16846 .int -17530 .int -18204 .int -18868 .int -19519 .int -20159 .int -20787 .int -21403 .int -22005 .int -22594 .int -23170 .int -23731 .int -24279 .int -24811 .int -25329 .int -25832 .int -26319 .int -26790 .int -27245 .int -27683 .int -28105 .int -28510 .int -28898 .int -29268 .int -29621 .int -29956 .int -30273 .int -30571 .int -30852 .int -31113 .int -31356 .int -31580 .int -31785 .int -31971 .int -32137 .int -32285 .int -32412 .int -32521 .int -32609 .int -32678 .int -32728 .int -32757 .int -32767 .int -32757 .int -32728 .int -32678 .int -32609 .int -32521 .int -32412 .int -32285 .int -32137 .int -31971 .int -31785 .int -31580 .int -31356 .int -31113 .int -30852 .int -30571 .int -30273 .int -29956 .int -29621 .int -29268 .int -28898 .int -28510 .int -28105 .int -27683 .int -27245 .int -26790 .int -26319 .int -25832 .int -25329 .int -24811 .int -24279 .int -23731 .int -23170 .int -22594 .int -22005 .int -21403 .int -20787 .int -20159 .int -19519 .int -18868 .int -18204 .int -17530 .int -16846 .int -16151 .int -15446 .int -14732 .int -14010 .int -13279 .int -12539 .int -11793 .int -11039 .int -10278 .int -9512 .int -8739 .int -7962 .int -7179 .int -6393 .int -5602 .int -4808 .int -4011 .int -3212 .int -2410 .int -1608 .int -804 .int 0 ; Interrupt Vectors .sect ".int53" ; TA0CCR0 CCIFG0 .short synth_isr ; ; .end ;
  15. Like
    jsolarski reacted to RobG in Using a servo with a Launchpad   
    Timer's clock is 1MHz/8 = 8us, so 180 * 8us = 1.44ms

    CCR0 = 180; // ~1.5ms
     
    Remove DEMO movement section and set the servoPosition to whatever you need
    1ms = 125, 2ms = 250

    servoPosition[2] = 80;
     
    In ADC portion, after conversion is done, take values[], convert them, put them in servoPosition[].
    Conversion should be something like serverPosition[x] = (values[x] >> 3) + 128, so the range will be 128-256
  16. Like
    jsolarski reacted to gordon in openMSP430   
    Probably only marginally interesting, but interesting nevertheless, look what my partner in crime just dug up: openMSP430.
  17. Like
    jsolarski reacted to nyordanov in Using mspdebug for 2452 - could not write to memory   
    So... This error is thrown when you compile your code with a wrong mmcu flag I was still using mspgcc4 which doesn't support 2452. When I switched to uniarch everything came back to normal.
     
    Many thanks to Gordon and Daniel Beer, the author of mspdebug.
  18. Like
    jsolarski reacted to SouLSLayeR in Detecting interrupt edge   
    #include unsigned int counter=0; int main(void) { WDTCTL = WDTPW + WDTHOLD;// Stop watchdog timer P1DIR |= BIT0+BIT6; // Set P1.0 to output direction P1OUT &= ~(BIT0+BIT6); // set P1.0 to 0 (LEDs OFF) while (1) // Infinite Loop { //pressing the button you add +1 to the counter every 10 msec. //If counter < 20 (200msecs = 0.2sec), normal press, green led lights on. //If counter > 200 (2000msecs = 2sec), extended press, red led lights on. if ((BIT3 & P1IN) == 0) // active low switch {counter++; __delay_cycles(10000);} //10000 delay cycles / ~1MHz = ~10 msec else if (0 < counter && counter < 20) //gotta love google {P1OUT ^= BIT6; counter = 0;} else if (counter >= 200) {P1OUT ^= BIT0; counter = 0;} else if (counter >200) //some help if things get stuck (and they probably will) {counter = 0;} } }
     
    Well, it works, though the long press is longer than what I had calculated it should be for some reason.
  19. Like
    jsolarski reacted to rockets4kids in Using the Launchpad with a Breadboard   
    This has been mentioned a few times before but as not too many people know about it I thought I would bring it up again with my particular spin on things.
     
    It is a little known fact that the Launchpad can easily program external chips. In fact, I only programmed a chip in the Launchpad socket itself just a few times before connecting it to an external breadboard.
     
    A picture is worth a thousand words, so here are some of my Launchpad-breadboard setup:
     
    http://imgur.com/a/UA46s#Qmjp7
     

    Very high resolution versions of the image are available through the "Image Options" menu.
     
    Physically, the breadboard is taped (double-sided foam tape) to a piece of scrap plastic. The Launchpad is held in place with a rubber band -- the ones that hold broccoli are perfect.
     
    I didn't have any "proper" connectors, so I simply trimmed (cut and sanded) one of the 10-pin female connectors that comes with the Launchpad. I also didn't have any heat-shrink small enough, so I just "potted" the solder connections with epoxy. It's not pretty, but it works just fine.
     
    To understand what is going on here, it is best to look at the schematic and PCB layout that is included in the Launchpad User's Guide:
     
    http://focus.ti.com/lit/ug/slau318/slau318.pdf
     
    It is important to note that the "Emulation" side is completely separate from the "EXP-MSP430G2" or "target" side. You can actually (physically) cut the board along the dashed line if you want. Aside from power and ground, all of the signals cross the dashed line via the jumper pins. If you remove the jumper pins, you have access to all of the signals required to program an external chip.
     
    It may not be clear in the picture, but the jumpers are hanging off one pin on the target side -- that is the easiest way to keep from losing them when the external programming header is connected.
     
    Many people also seem to be confused about the minimal support circuitry required for the MSP430, so that is definitely worth going over. The schematic in slau318 is nicely split on multiple pages to show G2/target side of things on a single page. This is essentially what you will be building on the breadboard.
     
    Obviously the chip requires power and ground, and these are provided via the Launchpad. The power supply must be properly decoupled for proper operation. This involves a 10 uF cap (electrolytic or tantalum) somewhere on the breadboard and a 0.1 uF (a cheap ceramic is just fine) as close to the MSP430 as possible.
     
    The RST line must be held high with a 47 k resistor. If you wish to reset the chip, just apply a jumper from RST to ground. You could use a switch, but a simple wire works just fine when needed.
     
    I have a watch crystal on XIN-XOUT, but this is not necessary. My xtal requires two 22 pF caps for proper loading, but I have not used these, instead enabling the internal 14 pF caps on the MSP430. The xtal seems to oscillate just fine with the improper loading, but I am certain that it effects the frequency. I don't have a frequency counter, so I don't know how far off it really is. The important thing is that oscillator does not seem to fault even when I touch it with the case ungrounded.
     
    If you don't want to use an xtal, you can use the pins as GPIOs.
     
    It is important to note that the chip is programmed over the TEST/RST lines, *not* the TX/RX serial lines. If you do not need serial communication, TX/RX do not need to be connected to the launchpad, and the pins can be used as GPIOs. Even more important to note is that the TX/RX lines used by the chips with a hardware UART (The 2xx3 chips) are *reversed* from the pins used for software serial! The breadboard in the photograph is populated with a 2553, so TX from the 2553 goes to RX on the jumper block and vice-versa.
     
    The only real "application circuit" here is the LED/resistor on P1.0 -- which happens to match LED1 on the Launchpad.
     
    As you can see, this leaves quite a fair bit of board space to experiment with, even with a small 400 pin breadboard.
     
    These little breadboards can be had for just a little more than two bucks when you get 10 of them, and it's really nice to be able to leave multiple small circuits all wired up at the same time. It's also useful to wire up each board as a discrete function, just like a "shield" on an Arduino. For example, you can wire a 2x16 LCD display for 2-pin serial display, and then easily connect that among multiple other boards.
     
    Hopefully this will be helpful to others just getting started!
  20. Like
    jsolarski reacted to NatureTM in FPGA Larson Scanner   
    Well, this isn't exactly a microcontroller, but close enough. I had the day off of work today due to rain, so I decided to make my first FPGA project, a Larson Scanner/Cylon Eye/Kitt Light. I was surprised I actually got this working in only a morning worth of work. (Decrement FPGA scariness.)
     
    Code and stuff on http://naturetm.com/?p=197.
     


  21. Like
    jsolarski reacted to gordon in DTMF-Controlled Garage Door Opener [GDO]   
    By some miracle, my project started showing signs of working, so time to show it the light of day .
     
    It is a remotely-controlled garage door opener of sorts. Hook it up to a phone (that is set to auto-answer), call phone, identify and authenticate yourself, and it will (in its current configuration) pulse an output. The outputs may (via a bit of further circuitry) be used to open your garage door, solve the "damn cable modem froze again" situation, you name it. Features include "user accounts" with permissions assigned, protection against your pocket having long chats with your garage door, audible feedback (with plenty of noise), and generous amounts of comments with hopes that it'll be educational to someone (I heard POM was about code sharing, so what the heck ).
     

    It is my second ever MCU project (the first one was Blinky, of course), and it indeed has been a hell of a ride spanning about a month. In case anyone cares, here are a couple of things highlighting what I have learnt during these past couple of weeks:
     
    - Timers are the bread and butter of everything
    - No situation is hopeless enough for a friendly, helpful green LED
    - State machines can get tricky. I thought I was pretty OK with them, but it turns out state machines and ISRs can get quite different from state machines and Unix signal handlers
    - Data sheets good. Use data sheets. Just keep staring at them, they will make sense, eventually.
    - Did I mention timers are the bread and butter of everything?
    - ... and I still don't know jack about them.
     
    Attached to this post is the GDO source and the schematic (there's more to the right, but the forum theme knows better; just view the image in a separate window). I've also attached the HT9170 data sheet for reference.
     

    Credit bits: I re-used gatesphere's '595 handling stuff to a great extent; also Rob's and oPossum's advices have been most influential. I should in fact be making roll calls. Thanks to the whole 43oh lot .
    HT9170.pdf
    gdo_src.c
  22. Like
    jsolarski reacted to rockets4kids in Need Cooking Help !   
    Assuming this is not a troll....
     
    The best source for "American" cooking is "The Joy of Cooking." There are a number of versions (1931, 1964, 1975, 1997, 2006) that reflect popular American cooking at the time of publication. You are *probably* going to want the 1964 edition which embodies 1950s palette.
  23. Like
    jsolarski reacted to zeke in Hot air pencil recommendation?   
    Uhm... I like a good hack but why bother with this one when you can get a hot air rework station for <$100?
     
    Dave Jones reviewed it on his EEVBlog: Atten 858D Hot Air Rework Review.
     
    Surely this would do the job for you.
  24. Like
    jsolarski got a reaction from gordon in Hot air pencil recommendation?   
    maybe try this
    http://www.instructables.com/id/DIY-Hot-Air-Soldering-Iron-1/
  25. Like
    jsolarski reacted to juani_c in Fuzzy Logic controller for an Iverted pendulum   
    My project is an inverted pendulum. The pendulum is a kind of excuse; I wanted to make something to show a library I
×
×
  • Create New...