Jump to content
43oh

zeke

Members
  • Content Count

    1,782
  • Joined

  • Last visited

  • Days Won

    102

Reputation Activity

  1. Like
    zeke 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
  2. Like
    zeke got a reaction from kenemon in Standalone Nightmare   
    Yeah, like BH says, it's a zero ohm resistor.
     
    When you're laying out a pcb and you're going to use surface mount parts, you might as well make the design as generic as possible. This will let you use that pcb for a new circuit later on down the road.
     
    Putting in a zero ohm resistor will allow you to disconnect the micro from the circuit and then you can solder in something new.
     
    Compare your circuit to the diagram.
    Do you have the reset line pulled up with a 47Kohm resistor?
    Do you have 3.3 volts connected to pin 1?
    Do you have ground connected to pin 16?
    Do you have your chip inserted with the correct orientation?
    Can you program your chip with the launchpad?
     
    If you are trying to program the target board with the launchpad then make sure that you remove the micro from the launchpad. If not then remove all the 0.100" jumpers from the launchpad's spy-bi-wire connector (J2) and then use the 0.050" connector (J4) and connect to your target.
     
    Simplify your setup and it will work for you.
  3. Like
    zeke got a reaction from MarkoeZ in Standalone Nightmare   
    This is what I do:
     
    Note: all the I/O's are unassigned in this diagram.
     

  4. Like
    zeke 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.
  5. Like
    zeke reacted to oPossum in Launchpad video oscilloscope   
    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 ; ; mov #0x0280, SP ; Stack pointer ; mov.b #0xF0, &P1DIR ; I/O assignment mov.b #0x50, &P1SEL ; Enable Timer A output, SMCLK output clr.b &P1REN ; clr.b &P1OUT ; ; mov #0x0002, &ADC10AE0 ; Analog in on P1.1 (A1) mov #0x1000, &ADC10CTL1 ; Select A1 ; Configure ADC mov #ADC10SHT_0 | ADC10SR | ADC10ON | ENC, &ADC10CTL0 ; call #video_init ; Begin video ; jmp $ ; ; video_init ; --- Initialize Video Generation --- clr &sync_state ; Init state machine mov #1, sync_lines ; clr &video_state ; mov #1016, &TACCR0 ; Setup Timer A period for 63.5 us mov #75, &TACCR1 ; Setup Timer A compare for video sync mov #0x0210, &TACTL ; Timer A config: SMCLK, count up mov #0x0060, &TACCTL1 ; Setup Timer A set/reset output mode bis #0x0010, &TACCTL0 ; Enable PWM interupt eint ; Enable interupts ret ; ; video_isr ; --- Video ISR --- dec &sync_lines ; Decrement sync lines jne vid_state ; Skip sync if not zero... add &sync_state, PC ; Jump to sync handler... ; - Field 1/3 jmp vid_eq ; Pre Equalizing jmp vid_vsync ; Vertical Sync jmp vid_eq ; Post Equalizing jmp vid_vbi ; VBI jmp vid_active ; Active Video jmp vid_half ; Video half line ; - Field 2/4 jmp vid_eq ; Pre Equalizing jmp vid_vsync ; Vertical Sync jmp vid_eq ; Post Equalizing jmp vid_half ; Video half line jmp vid_vbi ; VBI jmp vid_active ; Active Video clr &sync_state ; Reset sync state ;jmp vid_eq ; Same as first state ; vid_eq ; Equalizing pulses - 6 half lines mov #508, &TACCR0 ; Half line mov #38, &TACCR1 ; Equalizing pulse duration mov #6, &sync_lines ; 6 half lines clr &video_state ; No video generation during sync incd &sync_state ; Next state reti ; ; vid_vsync ; Vertical sync - 6 half lines mov #508 - 75, &TACCR1 ; Sync pulse duration mov #6, &sync_lines ; 6 half lines incd &sync_state ; Next state reti ; ; vid_half ; Video half line - 1 half line mov #508, &TACCR0 ; Half line mov #75, &TACCR1 ; Sync pulse duration mov #1, &sync_lines ; 1 half line incd &sync_state ; Next state clr &video_state ; No video generation during half line and sync reti ; ; vid_vbi ; Vertical blanking interval - 11 lines mov #1016, &TACCR0 ; Full line mov #75, &TACCR1 ; Sync pulse duration mov #11, &sync_lines ; 11 lines incd &sync_state ; Next state reti ; ; vid_active ; Active video - 242 lines mov #242, &sync_lines ; 242 lines incd &sync_state ; Next state mov #2, &video_state ; Generate video clr &vid_line ; Clear video line count jmp vid_field ; Generate video... ; vid_blank_9 ; 9 blank lines mov #9, &sync_lines ; incd &sync_state ; clr &video_state ; reti ; ; vid_state ; -- Active Video Generation add &video_state, PC ; reti ; No active video ;jmp vid_field ; Field ; vid_field ; push R12 ; ; mov &TAR, R12 ; cmp #160, R12 ; jlo $ - 8 ; and #7, R12 ; rla R12 ; add R12, PC ; nop ; nop ; nop ; nop ; nop ; nop ; nop ; ; mov &ADC10MEM, R12 ; Get ADC results bis #ADC10SC, &ADC10CTL0 ; Start new conversion ; cmp #750, R12 ; Limit upper ADC value jlo inrange ; mov #750 - 2, R12 ; ; inrange sub #4, R12 ; Subtract four w/ four cycles per iteration nop ; jc $ - 4 ; inv R12 ; Negate the remainder rla R12 ; Multiply by two add R12, PC ; One cycle granularity computed jump nop ; nop ; nop ; ; bis.b #0x80, &P1OUT ; bic.b #0x80, &P1OUT ; ; pop R12 ; ; reti ; ; ; Interrupt Vectors .sect ".reset" ; .short _main ; .sect ".int09" ; TACCR0 CCIFG .short video_isr ; ; .end ;
  6. Like
    zeke got a reaction from zborgerd in MSP430 WDT Application Problem?   
    That's an interesting structure that Davies uses. It must be the headers that he's using.
     
    I'm reading the msp430fg4618 datasheet and it says on page 15 that the bit you're trying to test for is the WDTIFG bit.
     
    It's also weird that there is no WDT sample program in the code examples.
     
    I looked at other processors to see what sample WDT examples are available. Here is an example that they show for quite a few processors:
     

    //****************************************************************************** // MSP430FG54x Demo - WDT, Toggle P1.0, Interval Overflow ISR, DCO SMCLK // // Description: Toggle P1.0 using software timed by the WDT ISR. Toggle rate // is approximately 30ms = {(default DCO 1.045MHz) / 32768} based on default // DCO/SMCLK clock source used in this example for the WDT. // ACLK = n/a, MCLK = SMCLK = default DCO ~1.045MHz // // MSP430F5438 // ----------------- // /|\| | // | | | // --|RST | // | | // | P1.0|-->LED // // M Smertneck / W. Goh // Texas Instruments Inc. // September 2008 // Built with CCE Version: 3.2.2 and IAR Embedded Workbench Version: 4.11B //****************************************************************************** #include "msp430x54x.h" void main(void) { WDTCTL = WDT_MDLY_32; // WDT 32ms, SMCLK, interval timer SFRIE1 |= WDTIE; // Enable WDT interrupt P1DIR |= 0x01; // Set P1.0 to output direction __bis_SR_register(LPM0_bits + GIE); // Enter LPM0, enable interrupts __no_operation(); // For debugger } // Watchdog Timer interrupt service routine #pragma vector=WDT_VECTOR __interrupt void WDT_ISR(void) { P1OUT ^= 0x01; // Toggle P1.0 (LED) }
     
    They create an ISR that is called when the watchdog interrupt occurs. Normally, you would clear the WDTIFG bit in the ISR but it seems that you don't have to clear it explicitly. I don't know why because that's inconsistent.
     
    Anyhow, try rewriting your code so that this section is called in the ISR:
    LED2 =
  7. Like
    zeke reacted to oPossum in Game of Life with G2211   
    // 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 output, SMCLK output video_init(); // Begin video generation // Initial GOL field pix[0] = pix[2] = pix[4] = pix[6] = pix[8] = pix[10] = pix[12] = 0x5555; pix[1] = pix[3] = pix[5] = pix[7] = pix[9] = pix[11] = pix[13] = 0xAAAA; pix[0] = 0x0000; pix[1] = 0x000E; pix[2] = 0x0000; pix[3] = 0; memcpy(nxt, pix, sizeof(nxt)); for(; { for(y = 0; y < 14; ++y) { for(x = 0; x < 16; ++x) { n = get_pix(x - 1, y - 1) + get_pix(x , y - 1) + get_pix(x + 1, y - 1) + get_pix(x - 1, y ) + /* me */ get_pix(x + 1, y ) + get_pix(x - 1, y + 1) + get_pix(x , y + 1) + get_pix(x + 1, y + 1); if(get_pix(x, y)) { if(n < 2 || n > 3) nxt[y] &= ~(1 << x); } else { if(n == 3) nxt[y] |= (1 << x); } } } __delay_cycles(5000000); memcpy(pix, nxt, sizeof(pix)); } }

    ; video.asm .cdecls C, LIST, "msp430g2211.h" .text .global video_init .global pix .bss sync_state, 2 .bss sync_lines, 2 .bss video_state, 2 .bss vid_line, 2 video_init ; --- Initialize Video Generation --- clr &sync_state ; Init state machine mov #1, sync_lines ; clr &video_state ; mov #1016, &TACCR0 ; Setup Timer A period for 63.5 us mov #75, &TACCR1 ; Setup Timer A compare for video sync mov #0x0210, &TACTL ; Timer A config: SMCLK, count up mov #0x0060, &TACCTL1 ; Setup Timer A set/reset output mode bis #0x0010, &TACCTL0 ; Enable PWM interupt eint ; Enable interupts ret ; ; video_isr ; --- Video ISR --- dec &sync_lines ; Decrement sync lines jne vid_state ; Skip sync if not zero... add &sync_state, PC ; Jump to sync handler... ; - Field 1/3 jmp vid_eq ; Pre Equalizing jmp vid_vsync ; Vertical Sync jmp vid_eq ; Post Equalizing jmp vid_vbi ; VBI jmp vid_blank_9 ; 9 blank lines jmp vid_active ; Active Video jmp vid_blank_9 ; 9 blank lines jmp vid_half ; Video half line ; - Field 2/4 jmp vid_eq ; Pre Equalizing jmp vid_vsync ; Vertical Sync jmp vid_eq ; Post Equalizing jmp vid_half ; Video half line jmp vid_vbi ; VBI jmp vid_blank_9 ; 9 blank lines jmp vid_active ; Active Video jmp vid_blank_9l ; 9 blank lines vid_state ; -- Active Video Generation add &video_state, PC ; reti ; No active video jmp vid_field ; Field ; vid_eq ; Equalizing pulses - 6 half lines mov #508, &TACCR0 ; Half line mov #38, &TACCR1 ; Equalizing pulse duration mov #6, &sync_lines ; 6 half lines clr &video_state ; No video generation during sync incd &sync_state ; Next state reti ; ; vid_vsync ; Vertical sync - 6 half lines mov #508 - 75, &TACCR1 ; Sync pulse duration mov #6, &sync_lines ; 6 half lines incd &sync_state ; Next state reti ; ; vid_half ; Video half line - 1 half line mov #508, &TACCR0 ; Half line mov #75, &TACCR1 ; Sync pulse duration mov #1, &sync_lines ; 1 half line incd &sync_state ; Next state clr &video_state ; No video generation during half line and sync reti ; ; vid_vbi ; Vertical blanking interval - 11 lines mov #1016, &TACCR0 ; Full line mov #75, &TACCR1 ; Sync pulse duration mov #11, &sync_lines ; 11 lines incd &sync_state ; Next state reti ; ; vid_active ; Active video - 224 lines mov #224, &sync_lines ; 224 lines incd &sync_state ; Next state mov #2, &video_state ; Genearte video clr &vid_line ; Clear video line count jmp vid_field ; Generate video... ; vid_blank_9 ; 9 blank lines mov #9, &sync_lines ; incd &sync_state ; clr &video_state ; reti ; ; vid_blank_9l ; 9 blank lines (last in field) mov #9, &sync_lines ; clr &sync_state ; clr &video_state ; reti ; ; vid_field ; push R10 ; push R12 ; push R14 ; ; mov &TAR, R10 ; cmp #176, R10 ; jlo $ - 8 ; and #7, R10 ; rla R10 ; add R10, PC ; nop ; nop ; nop ; nop ; nop ; nop ; nop ; ; mov &vid_line, R12 ; inc &vid_line ; rra R12 ; rra R12 ; rra R12 ; ;bic #1, R12 ; add #pix, R12 ; mov @R12, R12 ; mov #16, R14 ; pixloop rlc R12 ; jc pixon ; bic.b #0x80, &P1OUT ; jmp nexpix ; pixon bis.b #0x80, &P1OUT ; jmp nexpix ; nexpix mov #10, R10 ; dec R10 ; jne $ - 2 ; dec R14 ; jne pixloop ; nop ; nop ; nop ; bic.b #0x80, &P1OUT ; ; pop R14 ; pop R12 ; pop R10 ; ; reti ; ; ; Interrupt Vectors .sect ".int09" ; TACCR0 CCIFG .short video_isr ; ; .end ;

    I can explain the video code if anyone is interested. It is very flexible and does proper interlaced video and sync (equalization and serration).
  8. Like
    zeke reacted to MattTheGeek in Gearing up to release EasyMSP 0.8.3 Beta1   
    Commenting the code and documenting functions is taking longer than i expected, So please bare with me while i continue to prepare EasyMSP for release. :geek:
     
    It also doesn't help that i like to add new functions before fixing old ones
  9. Like
    zeke reacted to RobG in Using the Launchpad with a Breadboard   
    Alternatively, you could just solder 4 or 6 wires to J4.
     
    As you have already mentioned it, those dashed lines suggest something, they are saying "cut me, cut me."
    Though it's not that easy, it's possible. I wanted to do that for a long time, but your post really motivated me.
    So today, out of boredom, I decided to sacrifice one of my LPs and turn it into EmuPad.
     

     
    FYI, my suggestion is to use J4 to get those signals out to your proto board. EMuPad is just a proof that this can be done, but it is a really difficult task, some thin traces run under the header and there is de-soldering involved which can damage those delicate pads.
  10. Like
    zeke reacted to oPossum in MIDI implementation   
    Here is an extended version of the Fraunchpad synth MIDI parser. This handles all MIDI messages. It uses tables and a state machine for decode and dispatch. A channel bitmask is used to allow one or more channels to be handled.
     

    // MIDI message handler function typedef typedef void(*pfnMIDI)(unsigned cmd, unsigned d1, unsigned d2); // Dummy function for unhandled and undefined MIDI messages static void midiNone(unsigned cmd, unsigned d1, unsigned d2) {} static void midiNoteOff(unsigned cmd, unsigned d1, unsigned d2) { } static void midiNoteOn(unsigned cmd, unsigned d1, unsigned d2) { if(d2 == 0) { midiNoteOff(cmd, d1, 0); return; } } static const pfnMIDI mf[24] = { // --- Array of MIDI function pointers // - System Common midiNone, // F0 Sysex begin midiNone, // F1 Quarter frame midiNone, // F2 Song position midiNone, // F3 Song select midiNone, // F4 Undefined midiNone, // F5 Undefined midiNone, // F6 Tune request midiNone, // F7 Sysex end // - Voice midiNoteOff, // 8x Note off midiNoteOn, // 9x Note on midiNone, // Ax Aftertouch midiNone, // Bx Controller midiNone, // Cx Program change midiNone, // Dx Channel aftertouch midiNone, // Ex Pitch bend midiNone, // Sysex data (system common) // - System Real Time midiNone, // F8 Clock midiNone, // F9 Tick midiNone, // FA Start midiNone, // FB Continue midiNone, // FC Stop midiNone, // FD Undefined midiNone, // FE Active sense midiNone // FF Reset }; static void midi(unsigned c) // --- MIDI Parser --- { // // Initial state for message // F0 F1 F2 F3 F3 F5 F6 F7 8x 9x Ax Bx Cx Dx Ex static const unsigned mis[15] = { 4, 5, 6, 5, 0, 0, 0, 0, 2, 2, 2, 2, 1, 1, 2 }; static unsigned state = 0; // static unsigned rs = 0; // static unsigned d1 = 0; // static unsigned channel; // static unsigned channel_mask = 0x0001; // Channel(s) to respond to // if(c & 0x80) { // First octet of sequence channel = c & 0x0F; // Extract channel from first octet if(c <= 0xEF) { // --- Handle Voice messages 0x80 -> 0xEF --- if(channel_mask & (1 << channel)) { // Check if on our channel(s) rs = c; // Save first octet (running status) state = mis[rs >> 4]; // Set initial state for message type } else { // state = 0; // Not for us, discard } // } else if(c <= 0xF7) { // --- Handle System Common messages 0xF0 -> 0xF7 --- rs = c; // Save command octet state = mis[channel]; // Set inital state for message type if(state < 5) // Sysex (state 4) is handled immediately and has state change mf[channel](c, 0, 0); // Handle one octet messages immediately } else { // mf[channel + 8](c, 0, 0); // --- Handle System Real Time messages 0xF8 -> 0xFF (one octet) --- channel = rs & 0x0F; // Do not reset running status, or change state } // } else { // --- State machine for second and following octets --- switch(state) { // case 0: // - Discard break; // case 1: // - Second and final octet (voice messages) mf[rs >> 4](rs, c, 0); // break; // case 3: // - Third and final octet (voice messages) mf[rs >> 4](rs, d1, c); // state = 2; // break; // case 5: // - Second and final octet (system common message) mf[channel](rs, c, 0); // state = 0; // No running status for system messages break; // case 7: // - Third and final octet (system common message) mf[channel](rs, d1, c); // state = 0; // No running status for system messages break; // case 4: // - Sysex data mf[15](rs, c, 0); // break; // case 2: // - Second octet of three case 6: // d1 = c; // ++state; // break; // } // } // }
     
    Compact version of the parser without all those silly comments. (code is the same, just reformatted)

    void parse_midi(unsigned c) { static const unsigned mis[15] = { 4, 5, 6, 5, 0, 0, 0, 0, 2, 2, 2, 2, 1, 1, 2 }; static unsigned state = 0, rs, d1, channel; static unsigned channel_mask = 0x0001; if(c & 0x80) { channel = c & 0x0F; if(c <= 0xEF) { if(channel_mask & (1 << channel)) { rs = c; state = mis[rs >> 4]; } else state = 0; } else if(c <= 0xF7) { rs = c; state = mis[channel]; if(state < 5) mf[channel](c, 0, 0); } else { mf[channel + 8](c, 0, 0); channel = rs & 0x0F; } } else switch(state) { case 1: mf[rs >> 4](rs, c, 0); break; case 3: mf[rs >> 4](rs, d1, c); state = 2; break; case 5: mf[channel](rs, c, 0); state = 0; break; case 7: mf[channel](rs, d1, c); state = 0; break; case 4: mf[15](rs, c, 0); break; case 2: case 6: d1 = c; ++state; break; } }
  11. Like
    zeke reacted to RobG in MIDI implementation   
    After finishing some of my MIDI projects (Light Controller and Monitor,) I wasn't fully satisfied with the MIDI implementation I did. I wanted to rewrite it but I didn't have proper motivation.
     
    Then, oPossum posted his awesome FraunchPad Poly Synth, and that gave me some inspiration and couple of good ideas, great thanks.
     
    So here is my first version of (almost) full implementation of MIDI which can be used for any project, as is or simplified.
    Any comments? Is anything missing here?
     

    #include "msp430g2553.h" unsigned char status = 0; unsigned char channel = 0; unsigned char byteNumber = 1; unsigned char byteOne = 0; void handleMIDI(unsigned char rxByte); void handleNoteOn(unsigned char channel, unsigned char noteNumber, unsigned char velocity); void handleNoteOff(unsigned char channel, unsigned char noteNumber, unsigned char velocity); void handleControlChange(unsigned char channel, unsigned char controllerNumber, unsigned char value); void handleAfterTouch(unsigned char channel, unsigned char noteNumber, unsigned char amount); void handleProgramChange(unsigned char channel, unsigned char number); void handleChannelPressure(unsigned char channel, unsigned char amount); void handlePitchWheel(unsigned char channel, unsigned char fine, unsigned char coarse); void handleSystemRealTime(unsigned char status); void startSysEx(); void endSysEx(); void addToSysExBuffer(unsigned char data); void main(void) {} void handleMIDI(unsigned char rxByte) { if(rxByte & BIT7) { // is it status? if((rxByte & 0xF8) == 0xF8) { // System RealTime category? handleSystemRealTime(rxByte); // does not affect status or byteNumer } else if ((rxByte & 0xF0) == 0xF0) { // System Common category? status = rxByte; switch(status) { case 0xF0: startSysEx(); break; case 0xF7: endSysEx(); // no data bytes break; case 0xF6: // handleTuneRequest(); // no data bytes break; } byteNumber = 1; } else { // Voice category channel = rxByte & 0x0F; status = rxByte & 0xF0; byteNumber = 1; } } else { // it's data byte if(byteNumber == 1) { // is it first data byte? switch(status) { case 0xC0: handleProgramChange(channel, rxByte); break; case 0xD0: handleChannelPressure(channel, rxByte); break; case 0xF0: addToSysExBuffer(rxByte); break; case 0xF1: // handleMTCQuarterFrameMessage(rxByte); break; case 0xF3: // handleSongSelect(rxByte); break; default: byteNumber = 2; // second byte will follow byteOne = rxByte; } } else { byteNumber = 1; // next byte will be first byte switch(status) { case 0x90: if(byteOne) { handleNoteOn(channel, byteOne, rxByte); break; } case 0x80: handleNoteOff(channel, byteOne, rxByte); break; case 0xA0: handleAfterTouch(channel, byteOne, rxByte); break; case 0xB0: handleControlChange(channel, byteOne, rxByte); break; case 0xE0: handlePitchWheel(channel, byteOne, rxByte); break; case 0xF2: // handleSongPositionPointer(byteOne, rxByte); break; } } } } void handleNoteOn(unsigned char channel, unsigned char noteNumber, unsigned char velocity) { //if(channel == myChannel) soundOn(noteNumber, velocity); } void handleNoteOff(unsigned char channel, unsigned char noteNumber, unsigned char velocity) { //if(channel == myChannel) soundOff(noteNumber, velocity); } void handleControlChange(unsigned char channel, unsigned char controllerNumber, unsigned char value) { switch(controllerNumber) { case 123: //handleAllNotesOff(); break; // etc. } } void handleAfterTouch(unsigned char channel, unsigned char noteNumber, unsigned char amount) { // handle after touch } void handleProgramChange(unsigned char channel, unsigned char number) { // handle PC } void handleChannelPressure(unsigned char channel, unsigned char amount) { // handle pressure } void handlePitchWheel(unsigned char channel, unsigned char fine, unsigned char coarse) { unsigned int wheel; wheel = coarse; wheel <<= 7; wheel |= fine; //handlePitchWheel(wheel); } void handleSystemRealTime(unsigned char status) { switch(status) { case 0xF8: // handleMIDIClock(); break; case 0xFA: // handleMIDIStart(); break; case 0xFB: // handleMIDIContinue(); break; case 0xFC: // handleMIDIStop(); break; case 0xFE: // handleActiveSense(); break; case 0xFF: // handleReset(); break; } } void startSysEx() { // setup buffer } void endSysEx() { // process sysex buffer } void addToSysExBuffer(unsigned char data) { // addToBuffer(data); }
  12. Like
    zeke got a reaction from djlorenz in what kind of LCD display is this?   
    According to the slim datasheet, it's an HD44780 character LCD.
  13. Like
    zeke got a reaction from gordon in G2553 28pin Prototyping?   
    The other reason for using 45' angles on traces has to do with high speed signals. By high speed I mean really high speed.
     
    So high, we will never see them on a LaunchPad board.
     
    Still, it's good practice to use 45' angles on pcb traces.
     
    Dave Jones' PCB Design Tutorial has some high speed pcb layout guidance on page 19. The whole document is an awesome resource.
  14. Like
    zeke got a reaction from MattTheGeek in EasyMSP 0.8.2 Beta2 Released   
    Yup. You're in the big leagues now.
     
    How do you feel now that people want you to succeed at this?
  15. Like
    zeke reacted to NJC in Hot air pencil recommendation?   
    For a bit more expensive option, I just recently purchased one of these on a whim.
     
    http://cgi.ebay.com/2in1-SMD-Hot-Air-Re ... 3848wt_968
     
    I'm not sure I really got the best bang for my buck, but I needed it quickly and decided to impulse buy it. Turns out,it works really well and I am very impressed with it. I can't speak to the durability and longevity of it since I have had it for only 2 months now. But I really love the extra tips and nozzles and love only having one solder tool on my work bench.
  16. Like
  17. Like
    zeke reacted to bluehash in FRAM Experimenter's Board coupon code 50% off   
    Just got this email from our TI representative:
    (Thanks TI!)
     
  18. Like
    zeke 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.
     


  19. Like
    zeke got a reaction from jsolarski 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.
  20. Like
    zeke got a reaction from gordon 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.
  21. Like
    zeke got a reaction from bluehash in compiler error L_ASR_23???   
    I bet what happened is the first pass on the compiler made some unexpected code optimizations and now the second pass of the compiler has choked on them.
     
    My intuition says that L_ASR_23 is something like Long Arithmetic Shift Register error # 23. The #23 will be the key to search on if you have the compiler source code. Again, my intuition thinks its an overflow error on the LONGs in the statements.
     
    If you don't want to get into the source of the compiler then you do the code optimizations by breaking this down into several smaller statements.
     
    Where did you get that formula from? A datasheet?
    Oh, it's from the BMP085 sensor datasheet, right?
     
    I think we've seen this sensor math come up before. There's a thread on the board somewhere discussing the math. Here it is. Take a gander at that to see if your solution is in there.
     
    Can you compile that C code on Linux and see what GCC says about it?
    Does it choke on it too?
  22. Like
    zeke got a reaction from bluehash in Link to Stellaris 2006 Design Contest entries   
    I was checking out an DDS project article from QEX magazine and I noticed that it referenced a Stellaris design contest winner.
     
    One thing led to another and I found myself reading the project entries to the 2006 Circuit Cellar Stellaris Design contest.
     
    They have all the design files posted there still so I thought I'd post up a link just in case anyone else wants to check out the projects.
  23. Like
    zeke reacted to rockets4kids in Factory DCO calibration, how accurate?   
    It is really a shame that TI did not break out the 12 Mhz clock from the FET side over to the target chip, as this would allow for much better user-calibration of the target chip's DCO than than the 32.786 kHz crystal, assuming that you are even able to get it soldered in place properly.
  24. Like
    zeke got a reaction from gordon in What's the big idea with Linux?   
    Remember that there's a lot of emotion bound up in this topic.
     
    If someone insists that you do something a specific way then you might start resenting that person. If a company insists that you code on a specific platform then you might start resenting them.
     
    It's all about freedom of choice and whether you can retain yours while doing something you love.
     
    Some people like coding in a walled garden but no windows, some like coding in the great outdoors where things seem wild and crazy and some just like to code behind the safety of big windows.
     
    Don't let anyone decide for you. Pick whatever OS makes you feel free then run with it.
  25. Like
    zeke reacted to oldcyberdude in Launchpad to SparkFun Serial LCD   
    I trying to use the button count code with a Sparkfun backpack and 4x20 lcd. I use the gcc compiler and got a good compile (changed out the __delay_cycles() ) except for an "invalid use of void"
    Here is the code snip
    // Update the button press count, and toggle LEDs, when the button is pressed
    #ifdef __MSP430__
    interrupt (PORT1_VECTOR) PORT_1 (void) {
    #else
    #pragma vector=PORT1_VECTOR
    __interrupt void PORT1_ISR(void) {
    #endif
    buttonPresses++;
    P1OUT ^= BIT0;
    P1OUT ^= BIT6;
    P1IFG = 0; // clear interrupt
    __bic_SR_register_on_exit(LPM4_EXIT);
    }
     
    I don't see the problem?
    BTW, using the #ifdef in the code is really nice for portability.
     
    SOLVED - It seems msp430gcc doesn't like LPM4_EXIT some googling showed it should be LPM4_bits - interesting.
×
×
  • Create New...