Jump to content

jsolarski-backup

Members
  • Content Count

    91
  • Joined

  • Last visited


Reputation Activity

  1. Like
    jsolarski-backup got a reaction from james2 in Hall effect sensor sensitivity   
    are you using 3v or 5v to power it?
  2. Like
    jsolarski-backup got a reaction from rebeltaz in absolute beginner begging for direction!   
    the family guide is great if you know what module you are working with.
    for example, the basic clock system gives you other options for the clocks that the examples do not show, or I/O gives you options on how to set up the secondary pin functions as well as what conditions for the pull up or pull down resistor.
     
    Use the family guide to try and understand why they chose those register options for that example.
    Think of it as a dictionary or a glossary for your code.
  3. Like
    jsolarski-backup reacted to pabigot in USB dev (CCS code to GCC) issues   
    You're welcome.
    All 5xx/6xx/FR5xx MCUs are CPUX architecture, meaning they support the 20-bit aware instructions. However, the 5510 has only 32kiB of flash, so there is no far memory for which 20-bit pointers would be useful. The 5529, on the other hand, has 81kiB of flash above the 64 kiB boundary (48 kiB below it).
    No. The 4.7 development series, currently 20120911, is the only one that supports 20-bit code and data. 20120406 will, however, use CPUX instructions for other things (such as multi-register push/pop, enhanced bit rotate, etc.) If you're targeting the 5510, there's no particular value in updating.
  4. Like
    jsolarski-backup reacted to SirPatrick in MSP430G2553 motor speed control with a potentiometer   
    This code just controls the speed of a small 3V DC motor on P1.2. The speed is controlled by a potentiometer on P1.1. Feel free to suggest improvements as I am new to the MSP430.
     

    #include #define motorPin BIT2 #define analogInPin INCH_1 void initADC(); void stopWDT(); void initTimerA(); long map(long x, long in_min, long in_max, long out_min, long out_max); int analogRead(unsigned int pin); void main(void) { volatile unsigned int potentiometerValue; stopWDT(); initTimerA(); initADC(); for (; { potentiometerValue = map(analogRead(analogInPin),0,1023,0,1000); CCR1 = potentiometerValue; // CCR1 PWM duty cycle set by potentiometer } } long map(long x, long in_min, long in_max, long out_min, long out_max) { return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; } int analogRead(unsigned int pin) { ADC10CTL1 = ADC10SSEL_2 + pin; ADC10CTL0 |= ENC + ADC10SC; for(; { if ((ADC10CTL1 ^ ADC10BUSY) & ((ADC10CTL0 & ADC10IFG)==ADC10IFG)) { ADC10CTL0 &= ~(ADC10IFG +ENC); break; } } return ADC10MEM; } void initADC() { ADC10CTL0 = ADC10ON + ADC10SHT_0 + SREF_0; } void stopWDT() { WDTCTL = WDTPW + WDTHOLD; } void initTimerA() { P1DIR |= motorPin; // PWM out on P1.2 P1SEL |= motorPin; CCR0 = 1000-1; // Setting PWM period CCTL1 = OUTMOD_7; // CCR1 reset/set TACTL = TASSEL_2 + MC_1; // SMCLK configured for up mode }
  5. Like
    jsolarski-backup reacted to JWoodrell in first PCB back from fab and semi-populated :)   
    well I am proud of this so I wanted to show it off, even though I don't have all the bits to make it functional yet (and the Army is kicking me to a month long training thing on Thursday so it will have to wait till I get back...
     
    but anyway, I had my little USB prototype V1.2 sent to a fab place (Osh Park) and they had them done and to me yesterday, even though I ordered them a week and a half later than the seeed ones (still waiting on them)... I ordered these on the 4th, and got them on the 22nd, oh and it only cost me $5.00 per square inch of board (you get 3 copies of the board) mine are smaller than a square inch so I only paid $3.10 to have these made
     
    anyway, so this is my first PCB, and my first attempt at re-flow soldering, the YZP, and YZV parts are ridiculously tiny, but i got them placed and they stuck properly. (4 point ball grid array, and 6 point BGA, .5mm pitch, the overall chip is only 1mm square, or 1 x 1.5mm for the YZP...
     
    anyway here is what it looks like, I know there is a bridge on the 6 legged chip, I am not sure if I used too much solder paste, or not enough to generate the tension to pull that down?... but I can fix that by hand pretty easy



     
    code wise I am pretty close to being able to receive properly. I have it syncing correctly, and am working on the NRZI and bit destuffing code (in a month when I get back from training)
  6. Like
    jsolarski-backup got a reaction from SirPatrick in USB dev (CCS code to GCC) issues   
    From IRC -- Rickta
     
    __SFR_FARPTR is not jsut a function pointer. It' sprimary purpose is to represent a monolithic 20 bit value, as opposed to a long int value that is represented as 2*16 bit on assembly level. When stored to 'normal' memory, both are 4 byte size. But a normal long int will be put into 2*16 bit registers while an __SFR_FARPTR will be stored in a single register in a special 20 bit mode. Only this way, a 20 bit address can be properly
  7. Like
    jsolarski-backup reacted to simpleavr in webbotlib speech synthesizer on launchpad   
    not sure this is considered a project. the package i am providing allows one to play w/ TTS on a launchpad w/ g2553 chip.
    i did not create the TTS s/w, credit belongs to webbot at http://webbot.org.uk
    instead of publishing derived code, i am publishing a perl script to convert his code for msp430 use.
    this allows me to avoid licensing issues and i think anyone want to implement this should look at the original source.
     
    the speech system is not high quality but fun to use in projects. i.e. talking clocks, alert / alarm modules, robot voices, etc.
     
     
    . s/w only speech synthesizer technique from webbot
    . one pin pwm.
    . text-to-speech and synthesizer code under 10k.
    . fits in a g2553 mcu.
     
    source
     
    https://github.com/simpleavr/webbot_talk430
    . hosted in github, search for "webbot_talk430" project
    . there are 4 files.
    . zconv.pl converts the webbotlib speech source codes to a msp430 compatible source.
    . talk.c TTS exercising firmware, talks to PC at 9600bps turns what u type into speech.
    . uart.h uart code
    . common.h some macros i used.
    . pwm hardware hook-up is in talk.c, just one resistor and one capacitor, can be improved by using better filters.
     


     
    instructions (as in README and help from conversion script)
     
    this is a perl script to convert the webbotlib speech sythesizer code from avr
    to msp430 usage. this script is use at your own risk giftware. webbotlib has
    it's own license terms.
     
    . locate "webbotlib" and download version 1.x, i tried w/ webbotavrclib-1.35
    . inside the package locate and extract the Audio/Text2Speech directory
    . u will see the following files
     
    Text2Speech.h
    phoneme2sound.c
    phonemeWriter.c
    sound2noise.c
    speech2phoneme.c
    speechWriter.c
    vocab_en.c
     
    . place these files in a same directory as this (zconv.pl) script
    . run it again and this script will
    . extract what's needed, ignore others
    . combine into a tighter package name "../webbot_speech.h"
    . replace avr controls w/ msp430 controls
    . to use it in your firmware, do
    . include "webbot_speech.h"
    . say("Hello World");
    . enjoy and thanks webbot
     
    <<< IMPORTANT >>>
    please observe the fact that webbotlib is GPL licensed and use / share accordingly
     
     
     
    will be glad to answer questions anyone may have in this thread. happy hacking.
  8. Like
    jsolarski-backup reacted to oPossum in 15 channel PWM with async serial control   
    This is derived from 16 channel PWM with a single timer.
     
    The ISR has be extended to handle PWM and async serial reception. The first timer capture/compare is used for timing the serial bits and the second is used for PWM.
     
    This is the ISR...

    __interrupt void Timer0_A1(void) { static unsigned bit_mask = 0; // Serial rx data bitmask static unsigned rx_data; // Serial rx data // const unsigned x = TAIV; // Clear interrupt flag, get vector // if(x == 4) { // --- CCR2 - PWM P1OUT &= ~pa->port_off; // Port pins off P2OUT &= ~pa->port_off >> 8; // P1OUT |= pa->port_on; // Port pins on P2OUT |= pa->port_on >> 8; // pa = pa->next; // Next node in list TACCR2 = pa->time; // Update timer compare time // } else if(x == 2) { // --- CCR1 - Serial rx if(TACCTL1 & CAP) { // Start bit (capture mode) rx_data = 0; // Clear rx data bit_mask = 1; // Begin with bit 0 TACCTL1 &= ~CAP; // Switch from capture to compare mode TACCR1 += 2500; // Set timer for middle of first data bit } else { // Data/stop (compare mode) if(bit_mask & 0x0100) { // Stop bit? *head++ = rx_data; // Add rx data to ring buffer if(head >= &rx_buf[sizeof(rx_buf)/sizeof(rx_buf[0])]) head = rx_buf; TACCTL1 |= CAP; // Switch from compare to capture mode } else { // Data bit if(TACCTL1 & SCCI) rx_data |= bit_mask; // Update rx data bit_mask <<= 1; // Next data bit TACCR1 += 1667; // Set timer for middle of next bit } } } }
     
    The PWM code is unchanged, but now is only executed when the interrupt vector indicates capture/compare 2 match.
    The serial code begins in capture mode. When a falling edge is detected the mode is changed to compare to sample in the middle of each data bit and the stop bit. A ring buffer is used to prevent loss of received data.
     
    Two test cases are provided. The first allows the brightness of the Lauchpads LED to be set using 0 to 9 and a to j.
    The second test case implements a simple serial protocol to set the PWM value of all 15 outputs. The packet format is...
    0x55 0xAA PWM0 PWM1 ...... PWM13 PWM14 Checksum
    Addressing could easily be added to allow multiple MSP430 on the same serial line.
     
    Since this code uses only a single TimerA module, it can run on any MSP430 with a TimerA.
     

    #include "msp430g2553.h" #include "string.h" typedef struct { // PWM ISR linked list node struct unsigned time; // Time for on/off action to occur unsigned port_off; // Port pins to turn off unsigned port_on; // Port pins to turn on void *next; // Next node in linked list } TPWM; // TPWM pw[16], *pi; // Array and inactive list head volatile TPWM *pa; // Active node unsigned char rx_buf[32]; unsigned char *head, *tail; void pwm_set(const unsigned pin, const unsigned time) { const unsigned mask = 1 << pin; // const unsigned tm = time & 0xFF00; // Limit closeness of entries TPWM *b, *p, *n; // // // -- Try to find existing active node for this pin for(b = &pw[0], p = b->next; p != &pw[0]; b = p, p = b->next) { if(p->port_off & mask) { // Found it if(p->time == tm) return; // - Time is the same, nothing to do, return... while(pa != p); // Wait for this node to be active while(pa == p); // Wait for this node to become inactive // Safe to remove now if(p->port_off == mask) { // - Node is only used for this pin, remove it b->next = p->next; // Remove link p->next = pi; // Add to inactive list pi = p; // } else { // - Node is used for multiple pins p->port_off &= ~mask; // Remove this pin from the node } // break; // Found the pin, so stop searching } // } // // - Update first node in list if(tm == 0) { // If time is 0, turn off and return pw[0].port_on &= ~mask; // pw[0].port_off |= mask; // return; // } else { // If time is non-zero, turn on pw[0].port_on |= mask; // pw[0].port_off &= ~mask; // if(time == 0xFFFF) return; // If max, no need to turn off, so return } // // // Find where the new turn off node will go for(b = &pw[0], p = b->next; p != &pw[0]; b = p, p = b->next) if(p->time >= tm) break; // Stop when an entry of >= time is found // if(p->time == tm) { // If same time, use existing node p->port_off |= mask; // Add this pin return; // All done... } // // n = pi; // Get a node from the inactive list pi = n->next; // // n->port_off = mask; // Setup new node n->port_on = 0; // n->time = tm; // // n->next = p; // Insert node in to active list b->next = n; // } void pwm_init(void) { unsigned n; memset(pw, 0, sizeof(pw)); // Clear entire array pa = &pw[0]; // Active list always begins with first array element pa->next = &pw[0]; // Begin with only 1 node in list pi = &pw[1]; // First inactive node is second array element for(n = 1; n < sizeof(pw)/sizeof(TPWM) - 1; ++n) // Link the inactive nodes pw[n].next = &pw[n + 1]; // // TACTL = TASSEL_2 + MC_2 + ID_0; // Setup timer, continuous mode, SMCLK/1 TACCTL2 = CCIE; // Enable timer interrupt _EINT(); // Enable interrupts } #pragma vector = TIMER0_A1_VECTOR __interrupt void Timer0_A1(void) { static unsigned bit_mask = 0; // Serial rx data bitmask static unsigned rx_data; // Serial rx data // const unsigned x = TAIV; // Clear interrupt flag, get vector // if(x == 4) { // --- CCR2 - PWM P1OUT &= ~pa->port_off; // Port pins off P2OUT &= ~pa->port_off >> 8; // P1OUT |= pa->port_on; // Port pins on P2OUT |= pa->port_on >> 8; // pa = pa->next; // Next node in list TACCR2 = pa->time; // Update timer compare time // } else if(x == 2) { // --- CCR1 - Serial rx if(TACCTL1 & CAP) { // Start bit (capture mode) rx_data = 0; // Clear rx data bit_mask = 1; // Begin with bit 0 TACCTL1 &= ~CAP; // Switch from capture to compare mode TACCR1 += 2500; // Set timer for middle of first data bit } else { // Data/stop (compare mode) if(bit_mask & 0x0100) { // Stop bit? *head++ = rx_data; // Add rx data to ring buffer if(head >= &rx_buf[sizeof(rx_buf)/sizeof(rx_buf[0])]) head = rx_buf; TACCTL1 |= CAP; // Switch from compare to capture mode } else { // Data bit if(TACCTL1 & SCCI) rx_data |= bit_mask; // Update rx data bit_mask <<= 1; // Next data bit TACCR1 += 1667; // Set timer for middle of next bit } } } } unsigned char get_rx(void) { const unsigned char c = *tail++; if(tail >= &rx_buf[sizeof(rx_buf)/sizeof(rx_buf[0])]) tail = rx_buf; return c; } void protocol(void) { static unsigned state = 0; unsigned n; unsigned char pwm[15]; unsigned char checksum; unsigned char c; for(; { c = get_rx(); switch(state) { case 0: // First byte of packet must be 0x55 if(c == 0x55) ++state; break; case 1: // Second byte of packet must be 0xAA if(c == 0xAA) { n = 0; checksum = 0; ++state; } else { state = 0; } break; case 2: // Get 15 PWM bytes pwm[n++] = c; checksum += c; if(n >= 15) ++state; break; case 3: // Get checksum if(c == checksum) { // Update PWM if checksum is valid for(n = 0; n < 15; ++n) { pwm_set((n < 2) ? n : n + 1, (unsigned)pwm[n] << 8); } } state = 0; // Next packet break; } } } void main(void) { unsigned char c; WDTCTL = WDTPW | WDTHOLD; // Disable watchdog DCOCTL = 0; // Run at 16 MHz BCSCTL1 = CALBC1_16MHZ; // DCOCTL = CALDCO_16MHZ; // P1OUT = P2OUT = 0; // P1DIR = 0xFF ^ BIT2; // P1.2 is serial in, all other output P1SEL = BIT2; // Enable capture interrupt P2SEL = 0; // Allow P2.6 and P2.7 to be used as GPIO P2DIR = 0xFF; // Enable all P2 pins as output pwm_init(); // Initialize software PWM TACCTL1 = CM_2 | CAP | CCIE; // Enable capture on falling edge head = tail = rx_buf; // Init rx ring buffer pointers #if 0 protocol(); // Serial control of all 15 PWM outputs #else for(; { // Control LP LEDs with 0-9 and a-j if(head != tail) { c = get_rx(); if(c >= '0' && c <= '9') { pwm_set(0, (c - '0') * 7000); } else if(c >= 'a' && c <= 'j') { pwm_set(6, (c - 'a') * 7000); } } } #endif }
  9. Like
    jsolarski-backup got a reaction from mbeals in Syncing a servo to audio   
    I like this Idea, but My take on it would be one msp to do the audio, and the other to move the mouth.....
    I would base the movement on volume, the louder the sound the bigger the mouth would open, so breaks in speech would close the mouth. But I think it could be done with one chip.
  10. Like
    jsolarski-backup reacted to energia in Simple one-button combination lock   
    You could look into interrupt driven logic. This could be applied to the unlocking as well as the learning.
    I haven't given this much bought but for the unlocking you could use combination of attachInterrupt() and mills(). The msp430 unfortunately does not have state change interrupt so you will have to flip RISING/FALLING interrupt inside the ISR by detaching and then attaching on the opposite edge. The counter for how long the button was pressed can be updated using mills() inside the ISR...
    You could use the same logic for recording while in learning mode.
  11. Like
    jsolarski-backup reacted to bobnova in Simple one-button combination lock   
    One of my first MSP430 projects here, this is a (very) simple one-button combination lock. At the moment it's just using the launchpad's single button and the two LEDs for lock status. You'd need to figure out what you were locking or unlocking and add code for that obviously.
    It's all delay based, so it assumes you aren't doing anything overly crucial other than minding the button, or at least that the other tasks (if any) can be put on hold while the button is being used.
    I'm sure there are "better" ways to do it, but this seems to work so far!
     

    int counter; byte wiggleRoom = 25; //the amount + or - of the exact correct push length to pass a lock level, measured in 10ms steps. byte lockLevel = 1; //Stores what button press the lock is on boolean open = false; boolean buttonState; int test1 = 100; //Number of 10ms steps the button should be held down for the first time int test2 = 50; //Same, for press two. int test3 = 100; //And press 3. So for this setup, we press for 1s, let up, press for 0.5s, let up, press for 1s void setup(){ pinMode(P1_0, OUTPUT); pinMode(P1_6, OUTPUT); pinMode(P1_3, INPUT_PULLUP); } void loop(){ if (!open){ // normal state, red LED on, green LED off. digitalWrite(P1_0, HIGH); //In this section you would shut the lock, whatever it was. digitalWrite(P1_6, LOW); } else{ digitalWrite(P1_6, HIGH); //Open the lock digitalWrite(P1_0, LOW); delay(3000); //Wait a bit. lockLevel = 1; open = false; //Set the lock to close next pass through the code. //Might not be a bad idea to close the lock here too, really. //That would prevent the button being held down keeping the lock open. } buttonState = digitalRead(P1_3); if (!buttonState){ //Button is pushed counter = 0; //reset the counter, this is crucial. while (!buttonState){ //As long as the button is held down, this cycles. counter++; delay(10); //10ms per cycle, record the number of cycles. buttonState = digitalRead(P1_3); //We do need to get out eventually, when the button opens } switch (lockLevel){ //Now that we have a press duration, we need to find what level the lock is on case 1: //If it's the first press, we start here. if (counter >= test1 - wiggleRoom && counter <=test1 + wiggleRoom){ lockLevel = 2; //Adjust wiggleRoom to be the number of 10ms steps you want for wiggle room. counter = 0; //Right now we get +/- 250ms. digitalWrite(P1_6, HIGH); //Flash the green LED if the push was successful. Mostly for debugging. delay(50); digitalWrite(P1_6, LOW); } else{ lockLevel = 1; //If the push is the wrong length, start over. counter = 0; } break; case 2: if (counter >= test2 - wiggleRoom && counter <=test2 + wiggleRoom){ //Second push, same deal. lockLevel = 3; counter = 0; digitalWrite(P1_6, HIGH); delay(50); digitalWrite(P1_6, LOW); } else{ lockLevel = 1; //If the push is the wrong length, start over from push 1. counter = 0; } break; case 3: if (counter >= test3 - wiggleRoom && counter <=test3 + wiggleRoom){ open = true; //Third correct push opens the lock. counter = 0; } else{ lockLevel = 1; counter = 0; } break; } } }
    The next thing I'm inclined to work on is some learning, so that it remembers how long you hold the buttons down and adjusts the official "correct" number to match over time. The other thought is to time the delay between presses and use that as part of the combination, it would complicate the code fairly significantly but also increase security for a given time spent with the button.
    I got the idea while contemplating vehicle security, my thought was to re-use a dash button as the input button and control the fuel pump relay (that wouldn't turn off after three seconds!). That would give you totally invisible anti-theft in theory.
    I can't recommend it exactly, depending on how it's wired a dead MSP430 may render the vehicle suddenly stopped, not ideal!
     
    Thoughts?
  12. Like
    jsolarski-backup reacted to Nytblade in Help on wireless robotics project.   
    I have used the Sparkfun Bluesmirf and it is 3.3v. I had it working with the launchpad and the stability is because it does frequency hopping and other complex stuff. For control via bluetooth from the PC, I used a Bluetooth USB dongle, since my desktop doesn't have built-in Bluetooth. Don't be scared by my phrase "complex stuff" -- you don't have to configure the Bluesmirf. It works as standard UART serial. The only value I changed was the baud rate.
     
    For control I wrote a C++ application with wxWidgets. To communicate with the BlueSmirf you use the Serial Port Profile. Essentially what happens is that you pair the Sparkfun with your PC using the normal MS Windows methods (tray icon). After that it will show up in your device manager as a serial port. You then select the serial port in your custom program and communicate with it via MS Windows C/C++ functions.
     
    If you do get that far, you can PM me and I'll email you my C++ program I wrote to communicate with the "MetaWatch" which is a MSP430 Bluetooth wristwatch using the Serial Port Profile. The Windows API is nightmarish so the example might help you...
  13. Like
    jsolarski-backup reacted to adrianF in Power profiling with MSPDEBUG   
    Have you guys seen this? http://mspdebug.sourceforge.net/power.html
     
    Olimex just released some hardware that enables power profiling with MSPDEBUG. I haven't given it a try yet, but figured I'd share the link for someone who's interested in jumping on this
     
    Adrian
  14. Like
    jsolarski-backup reacted to Cw1X in Rectyfing and sensing small AC signal   
    Here are some pictures of waveform when engine is at idle and you can clearly see frequency rises on the other picture with RPM's but I don't see a big voltage difference. But then again this is from a sound card oscilloscope so dont know how trusty is it
     
    Idle:
     
    Throttle:
  15. Like
    jsolarski-backup got a reaction from Dimiric in absolute beginner begging for direction!   
    Try energia for linux, It will probably be the easiest to learn, and comes with lots of examples.
    you can find support on this site for it as well.
     
    the teach yourself C for linux is a good place to learn C but not for the msp430 launchpad, after you get familiar with energia the sams book will be a good supplement to learn the rest of C
  16. Like
    jsolarski-backup reacted to gordon in Hello guys   
    viewtopic.php?f=8&t=449
  17. Like
    jsolarski-backup got a reaction from GeekDoc in Rectyfing and sensing small AC signal   
    Maybe use an adc that has differential inputs? like the F2013/sda16,
    the other thing I would suggest would be a lowpass filter, and block out anything higher then what you expect the frequency should be, and you should only need to rectify only half the wave(use one diode(something with a low forward voltage)) and then you should be able to read it fine......I did this with audio level outputs -2v to +2v, It worked for testing but stopped once I learned how to use the sda16
     
    @geekdoc,
    It will be an AC signal, when the field collapses it will produce a voltage of the opposite sign with less amplitude, and it will ring for a moment or two.
  18. Like
    jsolarski-backup reacted to Jack Caster in A simple shell, step by step [eZ430 - RF5000]   
    Hi guys,
     
    I have started to work on my little project, a simple shell to control the MSP430; as I am a beginner I would like to share my little progresses and at the same time seek for an help to solve the problems on my path.
     

    #include "io430.h" #include #include //__________MACRO__________ //RED led on P1.0 #define LED_RED BIT0 #define LED_RED_ON (P1OUT |= BIT0) #define LED_RED_OFF (P1OUT &=!BIT0) #define LED_RED_TOGGLE (P1OUT ^= BIT0) //GREEN led su P1.1 #define LED_GREEN BIT1 #define LED_GREEN_ON (P1OUT |= BIT1) #define LED_GREEN_OFF (P1OUT &= !BIT1) #define LED_GREEN_TOGGLE (P1OUT ^= BIT1) //__________HEADER of FUNCTIONS__________ void init_UART(void); void writeChar(char ch); void writeString(char * str); //__________GLOBAL VARIABLES__________ char buffer[200] = {0}; char * welcome = "Welcome"; char * prompt = "msp430>> "; int main( void ) { // Stop watchdog timer to prevent time out reset WDTCTL = WDTPW + WDTHOLD; LED_RED_OFF; LED_GREEN_OFF; P1DIR = LED_RED + LED_GREEN; init_UART(); writeString(welcome); writeString(prompt); __low_power_mode_0(); // Interrupts enabled } void init_UART(void) { // Basic Clock System Control 1 BCSCTL1 = CALBC1_1MHZ; // BCSCTL1 Calibration Data for 1MHz // DCO Clock Frequency Control DCOCTL = CALDCO_1MHZ; // DCOCTL Calibration Data for 1MHz // UART Mode P3SEL = BIT4 + BIT5; // USCI_A0 TXD/RXD on P3.4 & P3.5 // USCI A0 Control Register 1 UCA0CTL1 |= UCSSEL_2; // USCI 0 Clock Source 2: SMCLK // USCI A0 Baud Rate 0 & 1 UCA0BR0 = 104; // 1MHz 9600 UCA0BR1 = 0; // 1MHz 9600 // USCI A0 Modulation Control UCA0MCTL = UCBRS0; // USCI Second Stage Modulation Select 0 UCA0CTL1 &= ~UCSWRST; // USCI Software Reset: Initialize state machine // Interrupt Enable 2 IE2 |= UCA0RXIE; // Enable USCI_A0 RX interrupt } #pragma vector=USCIAB0RX_VECTOR __interrupt void USCI0RX_ISR(void) { char character; LED_RED_TOGGLE; character = UCA0RXBUF; // Echo back character if (character != 0x0D) { writeChar(character); // CR = 0x0D } else { writeChar('\n'); writeChar('\r'); //CReturn writeString(prompt); } } void writeChar(char ch) { while (!(IFG2 & UCA0TXIFG)); // USART1 TX buffer ready? UCA0TXBUF = ch; } void writeString(char * str) { int i; for (i = 0; i < strlen(str); i++) { writeChar(str[i]); } }
     
    My first problem is to find a way to make my welcome message to stay put up to when a new character is received.
    Up to now that is what is happening: these two lines...
     

    writeString(welcome); writeString(prompt);
     
    ...seem not to work, but instead in the very moment in which I type a character the functions work.
     

     
    My second question is how can I write a function which prints a blinking cursor. It seems not easy!
     
    Thank you!
  19. Like
    jsolarski-backup reacted to gordon in Efficient micro mathematics   
    Tripped over this by accident while watching one of Travis Goodspeed's talks:
     
    Efficient Micro Mathematics
  20. Like
    jsolarski-backup got a reaction from dnial in Code For 3 Daisy Chained Shift Registers   
    In theory It should work.
    Are you using 74xx595 shift registers? or another another kind?
    have you tried stepping through your code to see what it is and isn't sending?
    what results are you getting? and what were you expecting?
  21. Like
    jsolarski-backup reacted to Automate in MSP430F5529 LaunchPad   
    I noticed some "Draft" info on a MSP430F5529 LaunchPad with 40 pin headers on this page
    http://processors.wiki.ti.com/index.php ... sign_Guide
     
    Anybody know anything more about this?
  22. Like
    jsolarski-backup got a reaction from chopc in Linux problem   
    do you have libmpc.so.2 and does it have the right permisions?
    I have seen this kind of error when moving shared libraries or if they have the wrong permissions
  23. Like
    jsolarski-backup reacted to ike in 3.6V LCD 16x2 HD44780 for $2.31   
    It came to my attention that the price of LCD modules have dropped by 1$ last time I checked. So I ordered one. When it arrives I checked to see if it works and I noticed that it have more contrast with 1.8 kOhm resistor to ground, that I use with those kind cheap blue LCD's. So I tried to run it with LaunchPad's 3.6 Volts, contrast was poor and brightness was weak(only 8mA at LED diode @3.5V). So I changed resistor with simple wire to ground and I added extra resistor with value 68 Ohm in parallel to the internal 100 Ohm SMD resistor(15mA at LED @3.6V). Result was pretty good. Yes I know that 3.3V LCD differs form 5.0V ones with charge pump IC and different resistor that control internal oscillator, but you can see the result. I know that cameras don't always tell the true and I'm not very pretentious man, but I like the end result.
    I order it form this seller http://myworld.ebay.com/chip_partner for $2.31 .
    I'm warning you that he can change his LCD modules for other type from different factory, so it may not work at 3.6V.
    I'm warning you that at 3.3V maybe contrast will not be as good as it's on 3.6V.
    I'm warning you that there are now sellers on ebay that sells cheaper LCD modules, just search for "LCD module" and sort by "price+shipping".



  24. Like
    jsolarski-backup reacted to energia in Comparator Use   
    This should help you to get going.
     

    void setup() { pinMode(RED_LED, OUTPUT); /* Internal reference (comp-)0.25 * VCC and turn on */ CACTL1 = CARSEL + CAREF0 + CAON; /* Select P1.3/CA3/S2 as the compare input (comp+). * This selection is not obvious from register bit definitions. * The Comparator_A+ Block Diagram in sectotion Comparator_A+ Introduction * is a better reference. */ CACTL2 = P2CA2 | P2CA1; } void loop() { /* Pressing S2 will turn on the LED1 */ if ((CACTL2 & CAOUT)) digitalWrite(RED_LED, HIGH); else digitalWrite(RED_LED, LOW); }
  25. Like
    jsolarski-backup reacted to bluehash in Tapatalk updated to 3.4.3   
    Updated for mobile users.
×
×
  • Create New...