Jump to content
43oh

mbeals

Members
  • Content Count

    347
  • Joined

  • Last visited

Reputation Activity

  1. Like
    mbeals got a reaction from tingo in Multidrop UART   
    Rs422: Max13448e
    Rs485: Max13487e
    Rs232: max232e
     
     
  2. Like
    mbeals reacted to roadrunner84 in Timer design question   
    There are two timers, their type is timer_a3: timer0_a3 and timer1_a3.
    Each of these has three capture-and-compare units: TA0.0, TA0.1, TA0.2, TA1.0, TA1.1 and TA1.2.
    When using PWM, one can set the timer to either UP mode or CONTINUOUS mode:
    - When using UP mode, TA0.0 and TA1.0 set the counter number at which the timer is reset (thus the frequency of your PWM), while the other four can be used to set the PWM duty cycle (percentage).
    - When using CONTINUOUS mode, all six can be used to set PWM duty cycles, however the PWM frequency is severely limited since you cannot set a value for the counter reset; it is always 65535 (0xFFFF). You must, however, do a tiny bit of work in software; the "usual PWM modes" (MOD = 3 or 7) will clear on TAx.0, instead use MOD = 1 or 5 and on the TAIFG event (in the TAIV interrupt) manually clear all pins used for the PWM (set MOD to 0, set OUT to 0 or 1, set MOD back to 1 or 5)
     
    You do not mention TA0.2, probably with good reason to do so. However I am unable to find anything indicating it does not exist in the MSP430G2553.
  3. Like
    mbeals reacted to yyrkoon in Watchdog Timer Problems   
    Also something I was looking at:
     
     
    unsigned short flag_display; unsigned short flag_newbatch; unsigned short flag_connect; Do these flags really need to be 16 bits wide ?
     
    Just a suggestion, and something for you to think about. for single bit flags, consider using an unsigned char, and set bit positions within this "bit field" for toggling different flags.
     
    Something like this:
     
    #define Bit(n) (1<<n) #define FLAG0 0 ... .. #define FLAGx x //up to bitfield length -1 volatile unsigned char flags; // 8 bits wide // usage: DoSomething() { ... flags |= Bit(FLAG0); // Sets FLAG0, e.g. flags bit position 0 to 1 ... }  
    But yeah, really depends on how you're using your flags I guess. This should reduce memory usage somewhat though if you only need one bit to toggle.
     
    EDIT: I also see you're using 200 type int's for an array of length 200 . . . So, like thats 400 bytes by its self ? 
     
    Help me out here pabigot . . . lol This is actually helping me too somewhat. working all this out in my head.
     
    And wow major re-edits here as I go on lol. multiple typos, and corrections for clarity.. .
  4. Like
    mbeals got a reaction from GeekDoc in Oscilloscope project for Stellaris or C2000 LaunchPad   
    The DSO nano is a 200 kHz scope based on an ST arm processor and all of the firmware is open source.  You might be able to port the code over, or at lease take a look and see how the sampling and filtering is handled.  The firmware I would look at is the BenF version (http://code.google.com/p/benfwaves/).
  5. Like
    mbeals got a reaction from jsolarski in Project deathbot   
    The chassis came in today so I built it with the dual gearbox and mocked it up with both my launchpad and my STM32F3.  There is enough room between the plates that I should be able to house the batteries and all related electronics down there, leaving the top plate completely open for sensors and control electronics.
     
    I also got the ultrasonic sensor and hooked it up well enough to get some signal on my scope, so now I just need to start working on interfacing it with the other electronics.



  6. Like
    mbeals got a reaction from abecedarian in Project deathbot   
    The chassis came in today so I built it with the dual gearbox and mocked it up with both my launchpad and my STM32F3.  There is enough room between the plates that I should be able to house the batteries and all related electronics down there, leaving the top plate completely open for sensors and control electronics.
     
    I also got the ultrasonic sensor and hooked it up well enough to get some signal on my scope, so now I just need to start working on interfacing it with the other electronics.



  7. Like
    mbeals got a reaction from bluehash in Project deathbot   
    The chassis came in today so I built it with the dual gearbox and mocked it up with both my launchpad and my STM32F3.  There is enough room between the plates that I should be able to house the batteries and all related electronics down there, leaving the top plate completely open for sensors and control electronics.
     
    I also got the ultrasonic sensor and hooked it up well enough to get some signal on my scope, so now I just need to start working on interfacing it with the other electronics.



  8. Like
    mbeals reacted to SugarAddict in First eagle board....would someone mind checking?   
    It will add them automatically if you use the net tool, do not use the wire tool unless you are manually connecting something it doesn't ratsnest for you.
     
    Tapatalk Mobile Device
     
     
  9. Like
    mbeals reacted to TheDirty in First eagle board....would someone mind checking?   
    When you connect tracks to pins of a package that is not using your grid measurements, you should start the track from the actual pin, that way it is centred exactly on the pin and you move out from there.  If you are going pin to pin, start from one pin, go half way, and then restart on the other pin and connect in the middle.
     
    Usually you don't need a 5v level shifter for I2C.  Since it uses pullups and just sinks current you can use 3.3V pullups and it will work with 5V devices.
  10. Like
    mbeals reacted to RobG in First eagle board....would someone mind checking?   
    You are missing all vias. Place them where the Xs are.
    JP2 missing connection. Lots of other tracks that are not connected all the way (yellow lines.)
    REG711's pin 4 on the schematic is not connected.
  11. Like
    mbeals reacted to bluehash in Project deathbot   
    A shunt resistor in series with one of the motor lines. The voltage across the known  resistor will give you the current.
  12. Like
    mbeals got a reaction from pine in Project idea seeking comments - golf swing   
    It depends on the scope of what you are trying to do. If you want to do full 3-space tracking, then this becomes equivalent to an inertial navigation system (INS) similar to what they use in airplanes as a backup for GPS.  Since you are integrating the accelerometer data, errors add up quickly and your solution 'drifts'...which is why commercial units are so expensive.  This is also why biomechanics researchers use stereoscopic cameras to do point cloud tracking for this sort of thing instead of trying to use inertial sensors.
     
    If you can constrain the geometry the problem becomes a little simpler.  You might be able to use a gyro to track the orientation and rate of change of the club's shaft...which you can use to model the stroke given you make some assumptions about the geometry of the pivots.  You will need to estimate the angular velocities involved to figure out a decent sample rate, then match that to your sensor and micro
  13. Like
    mbeals got a reaction from jayachar88 in Software UART support in Energia, and interaction with processing   
    Timerserial works on the 2553 just fine. You just have to create an instance with a name other than Serial.
     

    #include <TimerSerial.h> TimerSerial TS; void setup(){ TS.begin(9600); } void loop() { TS.println{"Hello World"); delay(1000); }
  14. Like
    mbeals got a reaction from energia in Making SPI work   
    Well I fixed it. I believe the big issue was using signed ints where I should have been using unsigned ints, which was screwing up the bit shifts when I would shift over by a full byte.
     
    In case anyone wants to use this device in the future, here is a working set of functions for it. There is more functionality left in the chip, but this covers the main register access and sweep functions.
     

    /* CS -> P2.0 SCK -> P1.5 SDI -> P1.7 SDO -> P1.6 */ const unsigned int WIPER0 = 0x00; const unsigned int WIPER0_default = 0x02; const unsigned int WIPER1 = 0x01; const unsigned int WIPER1_default = 0x03; const unsigned int TCON = 0x04; const unsigned int STATUS = 0x05; const unsigned int DATA0 = 0x06; const unsigned int DATA1 = 0x07; const unsigned int DATA2 = 0x08; const unsigned int DATA3 = 0x09; const unsigned int DATA4 = 0x0A; const unsigned int DATA5 = 0x0B; const unsigned int DATA6 = 0x0C; const unsigned int DATA7 = 0x0D; const unsigned int DATA8 = 0x0E; const unsigned int DATA9 = 0x0F; //Command bits const byte READ = 0b11; const byte WRITE = 0b00; const byte UP = 0b01; const byte DOWN = 0b10; const byte chipSelectPin = 8; // the sensor communicates using SPI, so include the library: #include <SPI.h> #include <TimerSerial.h> TimerSerial TS; void setup() { //Setup the software UART TS.begin(9600); //Enable the CS pin as an output pinMode(chipSelectPin, OUTPUT); // start the SPI library: SPI.begin(); delay(100); } void loop() { } /*========= Write to device register and read result ======================*/ unsigned int pushCommand(unsigned int Register, unsigned int command, unsigned int value) { unsigned int COMMAND_MOSI; unsigned int COMMAND_MISO; unsigned int DATA_MOSI; unsigned int DATA_MISO; unsigned int packet; //Format full 2 bit packet into one int to handle overlap from 10 bit data packet = (Register << 12) | (command << 10) | value; //Chop packet into command and data bits COMMAND_MOSI = (packet & 0xFF00) >> 8; DATA_MOSI = (packet & 0xFF); //Enable chip select, write two bits, read two bits, then disable CS digitalWrite(chipSelectPin, LOW); COMMAND_MISO = SPI.transfer(COMMAND_MOSI); //Send command byte DATA_MISO = SPI.transfer(DATA_MOSI); //Send the data byte digitalWrite(chipSelectPin, HIGH); //reassemble and return the returned bytes return (COMMAND_MISO << 8) | DATA_MISO; } /*========= Read value in a register ==========================*/ unsigned int readRegister(unsigned int Register){ return pushCommand(Register,READ,0); } /*======== Write to a register ============================*/ unsigned int writeRegister(unsigned int Register, unsigned int value){ return pushCommand(Register,WRITE,value); } /*======== Step a register n steps up in order ====================*/ //The device supports sequential writing, so we can sweep the wiper up or down //at the clock frequency byte stepUP(unsigned int Register, unsigned int steps){ byte COMMAND_MOSI = (Register << 4) | (UP << 2); //Format command byte byte COMMAND_MISO = 1; //Preset "success" to 1 //Cycle CS, write and read to/from Bus digitalWrite(chipSelectPin, LOW); for(int i=0; i<steps; i++){ COMMAND_MISO &= (SPI.transfer(COMMAND_MOSI) & 2) >> 1; //Issue the step command 'steps' times } digitalWrite(chipSelectPin, HIGH); return COMMAND_MISO; } /*============ Step a register n steps down in order ====================*/ byte stepDOWN(unsigned int Register, int steps){ byte COMMAND_MOSI = (Register << 4) | (DOWN << 2); byte COMMAND_MISO = 1; digitalWrite(chipSelectPin, LOW); for(int i=0; i<steps; i++){ COMMAND_MISO &= (SPI.transfer(COMMAND_MOSI) & 2) >> 1; } digitalWrite(chipSelectPin, HIGH); return COMMAND_MISO; }
  15. Like
    mbeals got a reaction from abecedarian in Making SPI work   
    Well I fixed it. I believe the big issue was using signed ints where I should have been using unsigned ints, which was screwing up the bit shifts when I would shift over by a full byte.
     
    In case anyone wants to use this device in the future, here is a working set of functions for it. There is more functionality left in the chip, but this covers the main register access and sweep functions.
     

    /* CS -> P2.0 SCK -> P1.5 SDI -> P1.7 SDO -> P1.6 */ const unsigned int WIPER0 = 0x00; const unsigned int WIPER0_default = 0x02; const unsigned int WIPER1 = 0x01; const unsigned int WIPER1_default = 0x03; const unsigned int TCON = 0x04; const unsigned int STATUS = 0x05; const unsigned int DATA0 = 0x06; const unsigned int DATA1 = 0x07; const unsigned int DATA2 = 0x08; const unsigned int DATA3 = 0x09; const unsigned int DATA4 = 0x0A; const unsigned int DATA5 = 0x0B; const unsigned int DATA6 = 0x0C; const unsigned int DATA7 = 0x0D; const unsigned int DATA8 = 0x0E; const unsigned int DATA9 = 0x0F; //Command bits const byte READ = 0b11; const byte WRITE = 0b00; const byte UP = 0b01; const byte DOWN = 0b10; const byte chipSelectPin = 8; // the sensor communicates using SPI, so include the library: #include <SPI.h> #include <TimerSerial.h> TimerSerial TS; void setup() { //Setup the software UART TS.begin(9600); //Enable the CS pin as an output pinMode(chipSelectPin, OUTPUT); // start the SPI library: SPI.begin(); delay(100); } void loop() { } /*========= Write to device register and read result ======================*/ unsigned int pushCommand(unsigned int Register, unsigned int command, unsigned int value) { unsigned int COMMAND_MOSI; unsigned int COMMAND_MISO; unsigned int DATA_MOSI; unsigned int DATA_MISO; unsigned int packet; //Format full 2 bit packet into one int to handle overlap from 10 bit data packet = (Register << 12) | (command << 10) | value; //Chop packet into command and data bits COMMAND_MOSI = (packet & 0xFF00) >> 8; DATA_MOSI = (packet & 0xFF); //Enable chip select, write two bits, read two bits, then disable CS digitalWrite(chipSelectPin, LOW); COMMAND_MISO = SPI.transfer(COMMAND_MOSI); //Send command byte DATA_MISO = SPI.transfer(DATA_MOSI); //Send the data byte digitalWrite(chipSelectPin, HIGH); //reassemble and return the returned bytes return (COMMAND_MISO << 8) | DATA_MISO; } /*========= Read value in a register ==========================*/ unsigned int readRegister(unsigned int Register){ return pushCommand(Register,READ,0); } /*======== Write to a register ============================*/ unsigned int writeRegister(unsigned int Register, unsigned int value){ return pushCommand(Register,WRITE,value); } /*======== Step a register n steps up in order ====================*/ //The device supports sequential writing, so we can sweep the wiper up or down //at the clock frequency byte stepUP(unsigned int Register, unsigned int steps){ byte COMMAND_MOSI = (Register << 4) | (UP << 2); //Format command byte byte COMMAND_MISO = 1; //Preset "success" to 1 //Cycle CS, write and read to/from Bus digitalWrite(chipSelectPin, LOW); for(int i=0; i<steps; i++){ COMMAND_MISO &= (SPI.transfer(COMMAND_MOSI) & 2) >> 1; //Issue the step command 'steps' times } digitalWrite(chipSelectPin, HIGH); return COMMAND_MISO; } /*============ Step a register n steps down in order ====================*/ byte stepDOWN(unsigned int Register, int steps){ byte COMMAND_MOSI = (Register << 4) | (DOWN << 2); byte COMMAND_MISO = 1; digitalWrite(chipSelectPin, LOW); for(int i=0; i<steps; i++){ COMMAND_MISO &= (SPI.transfer(COMMAND_MOSI) & 2) >> 1; } digitalWrite(chipSelectPin, HIGH); return COMMAND_MISO; }
  16. Like
    mbeals reacted to websterling in Making SPI work   
    SPI.transfer only transfers 8 bits. This is what I'm using to transfer a 16 bit value to a DAC.
     

    void SPIWrite(int value){ // value is 16 bits // take the LE ( SS ) pin high to inhibit data latching: digitalWrite(latchEnablePin, HIGH); MSB = highByte(value); LSB = lowByte(value); SPI.transfer(MSB); SPI.transfer(LSB); // take the LE ( SS ) pin low to latch the data: digitalWrite(latchEnablePin, LOW); }
  17. Like
    mbeals reacted to simpleavr in webbotlib speech synthesizer on launchpad   
    ok, i tried the new code and everything works. it is talking faster though. we can adjust the loop inside pause() to make it slower.
     
    hooking up a direct 8ohm smallish speaker i could barely make out what it says but should work ok if u spend time to construction a rc filter, and or fiddle w/ the timer / timing a bit.
     
    i also tried my CCS build (eventually used mspdebug to download the .out file) and it also works likewise.
     
    in case we had crystal installed and can't use p2.6....
    i checked and find out that i had used p2.6 for TA0.1 (timerA out1) as p1.2 is already used for uart.
    we can changed the code so that we use the 2nd timerA and have our pwm out at p2.1 or p2.2.
    i tried p2.2 and it works well, basically we need to change inside webbot_lib.h
     
    CCR0 -> TA1CCR0
    CCR1 -> TA1CCR1
    CCTL0 -> TA1CCTL0
    CCTL1 -> TA1CCTL1
    TAR -> TA1R
    TACTL -> TA1CTL
    BIT6 -> BIT2 (both in P2SEL and P2DIR, setups)
     
    i tested the above on mspgcc.
     
    ie.

    void sound(uint8_t { b = (b & 15); // Update PWM volume int16_t duty = Volume[b]; // get duty cycle if (duty != TA1CCR1) { TA1R = 0; TA1CCR1 = duty; }//if }
     
    and
     

    void soundOff(void) { TA1CCTL0 &= ~CCIE; P2DIR &= ~BIT2; } void soundOn(void) { TA1CCTL0 &= ~CCIE; TA1CCTL1 = OUTMOD_7; TA1CCR0 = 0x200; // more like 16Khz (16Mhz/1024) TA1CCR1 = 0x00; TA1CTL = TASSEL_2 + MC_1; P2SEL |= BIT2; P2DIR |= BIT2; // initialise random number seed seed[0]=0xecu; seed[1]=7; seed[2]=0xcfu; }
  18. Like
    mbeals reacted to simpleavr in webbotlib speech synthesizer on launchpad   
    @mbeals
     
    i build this w/ mspgcc under both ubuntu 11 and windows/cygwin.
    i had just re-worked the package and tried build it in CCS, which compiled well but i had no way to verify it as i had setup issues and it did not download.
    u still need cygwin perl or some other perl to generate webbot_speech.h
    for CCS build u need to create a new project (w/ g2553 target), and copy talk.c, common.h, uart.h, webbot_speech.h to that folder.
     
    search simpleavr or webbot_talk430 on github
     
    the re-worked github package w/ the following highlighted changes
     
    . webbot_lib.h now reside in same directory
    . now uses webbotlib package 2.x versions
    . now compiles under CCS
    . adopt to new mspgcc
    . mspgcc-20120406-p20120502
    . use of #include
    . retire own intrinsic __delay_cycle(), now uses mspgcc's
    . adopt to newer interrupt naming convention
     
    i don't have the audio setup right now but the new cygwin build got loaded and i can connect via uart. just no sound as i don't have a speaker right now.
     
    let me know if u have any issues.
     
    good luck and happy building.
  19. Like
    mbeals got a reaction from Dimiric in Moving past Blinky   
    There was an article on hackaday showing how to break out the SBW from the launchpad for other chips. Just search google for using-spy-bi-wire-with-the-msp430-launchpad. It should be the first result.
     
    To mount that chip, you can make your own socket by pressing the chip into some polymer clay to make an impression, baking it to harden it, then using some fine copper wire to make contacts. Glue that on some perf board and run some wires from the contacts to some headers and you have a homebrew socket. For the final project, you will probably want to make a real board, or at least a breakout board with the chip soldered on.
  20. Like
    mbeals reacted to jsolarski-backup 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.
  21. Like
    mbeals got a reaction from Dimiric in Moving past Blinky   
    to program non-dip 430s you just need the chip on a board with a few pins broken out into a header, and another riser on the launch pad with matching connections and no micro.
     
    as for the led, first make sure the led is rated for the right voltage. a 12v led won't do much off a 3v signal line. Its also a good idea to run a current limiting resistor on there to be safe
×
×
  • Create New...