Jump to content
43oh

GeoNomad

Members
  • Content Count

    13
  • Joined

  • Last visited

Reputation Activity

  1. Like
    GeoNomad got a reaction from gatImmusepete in Getting into HAM Radio. Need some help   
    Ham radio is a great hobby and a wonderful community. You will meet fine hams all over the world, on the radio, on the internet, and if you travel, in person.
     
    Start by meeting the local hams in the nearest club(s).
     
    Look for the various hamfests that might be near you. There are small regional ones and large divisional ones, and then there is Dayton.
     
    http://www.arrl.org/hamfests-and-conventions-calendar
     
    And most important, turn on the radio and LISTEN. Listen to HF, listen to 2 meters, listen to some morse code. Find your niche, maybe you will get hooked on digital transmissions (CW was the first digital transmission - it is all ones and zeros). Maybe satellite or moonbounce. Maybe contests. Maybe just having an HT on your belt and a radio in the car. There is something for everyone.
     
    And always something new. BTW, there are now over 700,000 hams in the US. More per capita than at any previous time. It is not a dying hobby. And a surprising number of new hams choose to learn CW, even though it is no longer required. You can do a lot more with a small budget or a small lot using CW.
     
    73 :wave:
    Peter
    AB6WM - VE3SUN - C31LJ
  2. Like
    GeoNomad reacted to oPossum in Software async serial tx/rx without timer   
    Had some requests for this in IRC so here it is. This is an improved version of the serial tx previously posted and new serial rx code. Both tx and rx are blocking and interrupts should be disabled before calling.
     
    C code to show how to use the serial_setup(), putc(), puts(), and getc() functions.
    This will receive a character, increment it and echo it back. So if you type 'A', then 'B' will be echoed.

    // test.c #include "msp430g2211.h" // Functions in serial.asm (this really should be in a header file) void serial_setup(unsigned out_mask, unsigned in_mask, unsigned duration); void putc(unsigned); void puts(char *); unsigned getc(void); void main(void) { char c; // Disable watchdog WDTCTL = WDTPW + WDTHOLD; // Use 1 MHz DCO factory calibration DCOCTL = 0; BCSCTL1 = CALBC1_1MHZ; DCOCTL = CALDCO_1MHZ; // Setup the serial port // Serial out: P1.1 (BIT1) // Serial in: P1.2 (BIT2) // Bit rate: 9600 (CPU freq / bit rate) serial_setup(BIT1, BIT2, 1000000 / 9600); // Send a string puts("\r\nRunning...\r\n"); for(; { // Do forever c = getc(); // Get a char ++c; // Increment it putc(c); // Echo it back } }
     
    The serial tx/rx code. Just add this as a new source file in your CCS project and it will be callable from your C code.

    ; serial.asm .cdecls C, LIST, "msp430g2231.h" .bss in_bit_mask, 2 ; Serial in pin .bss out_bit_mask, 2 ; Serial out pin .bss bit_dur, 2 ; Bit duration in cycles .bss half_dur, 2 ; Half bit duration in cycles ; .text ; .def serial_setup ; void serial_setup(unsigned out_mask, unsigned in_mask, unsigned bit_duration); .def putc ; void putc(unsigned c); .def puts ; void puts(char *s); .def getc ; unsigned getc(void); ; ; serial_setup ; - Setup serial I/O bitmasks and bit duration (32 minimum) mov R12, &out_bit_mask ; Save serial output bitmask mov R13, &in_bit_mask ; Save serial input bitmask bis.b R12, &P1DIR ; Setup output pin bis.b R12, &P1OUT ; bic.b R13, &P1DIR ; Setup input pin or R13, R12 ; bic.b R12, &P1SEL ; Setup peripheral select mov R14, R12 ; sub #16, R14 ; Adjust count for loop overhead rla R14 ; Multiply by 2 because NOP is two bytes mov R14, &bit_dur ; Save bit duration sub #32, R12 ; Adjust count for loop overhead mov R12, &half_dur ; Save half bit duration ret ; Return ; ; - Send a single char putc ; Char to tx in R12 ; R12, R13, R14, R15 trashed mov &out_bit_mask, R15 ; Serial output bitmask mov &bit_dur, R14 ; Bit duration or #0x0300, R12 ; Stop bit(s) jmp bit_low ; Send start bit... ; tx_bit mov R14, R13 ; Get bit duration tx_delay nop ; 4 cycle loop sub #8, R13 ; jc tx_delay ; subc R13, PC ; 0 to 3 cycle delay nop ; 3 nop ; 2 nop ; 1 ; rra R12 ; Get bit to tx, test for zero jc bit_high ; If high... bit_low bic.b R15, &P1OUT ; Send zero bit jmp tx_bit ; Next bit... bit_high bis.b R15, &P1OUT ; Send one bit jnz tx_bit ; If tx data is not zero, then there are more bits to send... ; ret ; Return when all bits sent ; ; ; - Send a NULL terminated string puts ; Tx string using putc push R11 ; mov R12, R11 ; String pointer in R12, copy to R11 putsloop ; mov.b @R11+, R12 ; Get a byte, inc pointer tst.b R12 ; Test if end of string jz putsx ; Yes, exit... call #putc ; Call putc jmp putsloop ; putsx pop R11 ; ret ; ; getc ; - Get a char mov &bit_dur, R14 ; Bit duration mov &in_bit_mask, R13 ; Input bitmask mov #0x01FF, R12 ; 9 bits - 8 data + stop ; rx_start ; Wait for start bit mov.b &P1IN, R15 ; Get serial input and R13, R15 ; Mask and test bit jc rx_start ; Wait for low... ; mov &half_dur, R13 ; Wait for 1/2 bit time ; rx_delay nop ; Bit delay sub #8, R13 ; jc rx_delay ; subc R13, PC ; 0 to 3 cycle delay nop ; 3 nop ; 2 nop ; 1 ; mov.b &P1IN, R15 ; Get serial input and &in_bit_mask, R15 ; rrc R12 ; Shift in a bit ; mov R14, R13 ; Setup bit timer jc rx_delay ; Next bit... ; rla R12 ; Move stop bit to carry swpb R12 ; Move rx byte to lower byte, start bit in msb ret ; Return with rx char and start bit in R12, stop bit in carry ; .end ;
  3. Like
    GeoNomad got a reaction from thanhtran in GoPro Camera Controller   
    Yes, that is what I meant.
     
    I am camping in France right now, so my replies are not proofread...
     
    :roll:
  4. Like
    GeoNomad got a reaction from cde in GoPro Camera Controller   
    The GoPro HD Hero camera does not have a remote shutter input, but it does have an interface bus on the back designed for an add-on LCD display and other accessories not yet available.
     
    I thought it would be interesting to interface an MSP430 to the camera to automate the taking of photos for time-lapse photography, and to add a remote control and motion detection.
     
    The easiest way to do this turned out to be the PWR/MODE button which is brought to the connector on the back. The camera has a one-button mode which will take a photo or start a video recording when the camera is powered on.
     
    I elected to use the EZ430 F2012 because I had one that I got for free a while back.

    The interface to the camera is via two wires - the pullup on the input for the power button provides enough power to run the MSP430. A 1,000 microfarad cap provides power for when the processor grounds the input to turn the camera on and off.
     

     
    The program only has to do a few things. After initializing the output and setting up the watchdog timer to interrupt every 256 mSec, it goes to sleep.
     
    On interrupt, it decides what to do next which depends on where it is in the picture taking cycle. A cycle consists of: Turn on the camera with a 250 mSec low pulse. Wait 3 seconds for the image capture. Turn off the camera with a 3 second low pulse. Flash the LED to show things are working. Wait until it is time to do it all again.
     

    //****************************************************************************** // // GoPro HD Camera Control using BUS connector // for MSP430F2012 // // Uses PWR/MODE button to wake camera up and take photo in One Button Mode // // Set SHOT_RATE for number of seconds between shots // If not using xtal control, time requires CALIBRATION // // closes PWR button for 250 mSec to wake up camera // waits 3.75 seconds for snap and store // closes PWR button for 3 seconds to turn camera off // flashes LED to indicate start of next cycle // // Peter Jennings http://benlo.com/msp430 // //****************************************************************************** #include "msp430.h" #define SHOT_RATE 60 // seconds between shots #define CALIBRATION 7 // calibration to improve accuracy #define WAITING 0 // waiting for next cycle #define STARTING 1 // button down to start #define WAITING_CAMERA 2 // waiting for camera to take pic #define STOPPING 3 // button down to stop static int tick; static int state; static int time; // seconds since last save void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer P1SEL |= 0x00; // P1.1 option select - just I/O P1DIR |= 0x11; // Set P1.0 P1.4 to output direction P1OUT |= 0x10; // LED off, GoPro button off BCSCTL2 |= DIVS_3; // SMCLK/8 WDTCTL = WDT_MDLY_32; // WDT Timer interval 32mS tick = 0; time = 10; // wait for cap to charge up state = WAITING; IE1 |= WDTIE; // Enable WDT interrupt 256 mSec _BIS_SR(LPM0_bits + GIE); // Enter LPM0 with interrupt } // Watchdog Timer interrupt service routine #pragma vector=WDT_VECTOR __interrupt void watchdog_timer(void) { if ( (state == STARTING) && (tick >= 1 ) ) // start takes .25 seconds { state = WAITING_CAMERA; P1OUT |= 0x10; // button up } if ( tick & 0x03 ) // most of the time { P1OUT &= ~0x01; // LED off and go back to sleep } else // about once very 1.024 seconds { time++; if ( (state == WAITING) && (time >= SHOT_RATE+CALIBRATION) ) // time for photo { P1OUT &= ~0x10; // button down time = 0; tick = 0; state = STARTING; } else if ((state == WAITING_CAMERA) && (time >= 4) ) // time to turn off { state = STOPPING; P1OUT &= ~0x10; // button down } else if ((state == STOPPING) && (time >= 7)) // should be off now { state = WAITING; P1OUT |= 0x10; // button up P1OUT |= 0x01; // LED flash to indicate done cycle } } tick++; // 256 mSec ticks }
     
    I have written no more than a few lines of code for this processor in my life and am basically unfamiliar with it. I would appreciate any pointers from those who are more familiar with the chip, both with regards to the hardware interfacing and the software program. I am sure I am missing some basic details and it would be good to correct them before other users implement these instructions. Feedback is encouraged.
     
    The complete writeup is at http://benlo.com/msp430/GoProController.html
     
    Peter
  5. Like
    GeoNomad got a reaction from bluehash in GoPro Camera Controller   
    To fit the controller into a completely waterproof case, I use the back that comes with the LED back. That has sufficient extra room for everything with any of the low profile connectors.
     
    I also sealed the top of the LED back cover that has holes in it for sound. That makes a water resistant - i.e. open at the bottom but not at the top enclosure so I can run a cable out the bottom holes for USB power on the bus plug. Good for making very long time lapses.
     
    It has the added advantage of not steaming up when the temperature changes drastically, so I also use it on my helmet when flying. High altitude flights used to steam the lens as the temperature changed rapidly.
     
    Peter
  6. Like
    GeoNomad got a reaction from thanhtran in GoPro Camera Controller   
    There is a link on my web page to the supplier.
     

     
    Yes, it fits in the waterproof back with the small connector, using the wider backs that comes with the LCD display. The one pictured works with the open back after a little Dremel work.
     
     
    In fact, I just built a second one with a crystal for accurate time resolution and lower power by setting the ports to output.
     
    Peter
  7. Like
    GeoNomad got a reaction from jsolarski in GoPro Camera Controller   
    The GoPro HD Hero camera does not have a remote shutter input, but it does have an interface bus on the back designed for an add-on LCD display and other accessories not yet available.
     
    I thought it would be interesting to interface an MSP430 to the camera to automate the taking of photos for time-lapse photography, and to add a remote control and motion detection.
     
    The easiest way to do this turned out to be the PWR/MODE button which is brought to the connector on the back. The camera has a one-button mode which will take a photo or start a video recording when the camera is powered on.
     
    I elected to use the EZ430 F2012 because I had one that I got for free a while back.

    The interface to the camera is via two wires - the pullup on the input for the power button provides enough power to run the MSP430. A 1,000 microfarad cap provides power for when the processor grounds the input to turn the camera on and off.
     

     
    The program only has to do a few things. After initializing the output and setting up the watchdog timer to interrupt every 256 mSec, it goes to sleep.
     
    On interrupt, it decides what to do next which depends on where it is in the picture taking cycle. A cycle consists of: Turn on the camera with a 250 mSec low pulse. Wait 3 seconds for the image capture. Turn off the camera with a 3 second low pulse. Flash the LED to show things are working. Wait until it is time to do it all again.
     

    //****************************************************************************** // // GoPro HD Camera Control using BUS connector // for MSP430F2012 // // Uses PWR/MODE button to wake camera up and take photo in One Button Mode // // Set SHOT_RATE for number of seconds between shots // If not using xtal control, time requires CALIBRATION // // closes PWR button for 250 mSec to wake up camera // waits 3.75 seconds for snap and store // closes PWR button for 3 seconds to turn camera off // flashes LED to indicate start of next cycle // // Peter Jennings http://benlo.com/msp430 // //****************************************************************************** #include "msp430.h" #define SHOT_RATE 60 // seconds between shots #define CALIBRATION 7 // calibration to improve accuracy #define WAITING 0 // waiting for next cycle #define STARTING 1 // button down to start #define WAITING_CAMERA 2 // waiting for camera to take pic #define STOPPING 3 // button down to stop static int tick; static int state; static int time; // seconds since last save void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer P1SEL |= 0x00; // P1.1 option select - just I/O P1DIR |= 0x11; // Set P1.0 P1.4 to output direction P1OUT |= 0x10; // LED off, GoPro button off BCSCTL2 |= DIVS_3; // SMCLK/8 WDTCTL = WDT_MDLY_32; // WDT Timer interval 32mS tick = 0; time = 10; // wait for cap to charge up state = WAITING; IE1 |= WDTIE; // Enable WDT interrupt 256 mSec _BIS_SR(LPM0_bits + GIE); // Enter LPM0 with interrupt } // Watchdog Timer interrupt service routine #pragma vector=WDT_VECTOR __interrupt void watchdog_timer(void) { if ( (state == STARTING) && (tick >= 1 ) ) // start takes .25 seconds { state = WAITING_CAMERA; P1OUT |= 0x10; // button up } if ( tick & 0x03 ) // most of the time { P1OUT &= ~0x01; // LED off and go back to sleep } else // about once very 1.024 seconds { time++; if ( (state == WAITING) && (time >= SHOT_RATE+CALIBRATION) ) // time for photo { P1OUT &= ~0x10; // button down time = 0; tick = 0; state = STARTING; } else if ((state == WAITING_CAMERA) && (time >= 4) ) // time to turn off { state = STOPPING; P1OUT &= ~0x10; // button down } else if ((state == STOPPING) && (time >= 7)) // should be off now { state = WAITING; P1OUT |= 0x10; // button up P1OUT |= 0x01; // LED flash to indicate done cycle } } tick++; // 256 mSec ticks }
     
    I have written no more than a few lines of code for this processor in my life and am basically unfamiliar with it. I would appreciate any pointers from those who are more familiar with the chip, both with regards to the hardware interfacing and the software program. I am sure I am missing some basic details and it would be good to correct them before other users implement these instructions. Feedback is encouraged.
     
    The complete writeup is at http://benlo.com/msp430/GoProController.html
     
    Peter
  8. Like
    GeoNomad got a reaction from bluehash in GoPro Camera Controller   
    The GoPro HD Hero camera does not have a remote shutter input, but it does have an interface bus on the back designed for an add-on LCD display and other accessories not yet available.
     
    I thought it would be interesting to interface an MSP430 to the camera to automate the taking of photos for time-lapse photography, and to add a remote control and motion detection.
     
    The easiest way to do this turned out to be the PWR/MODE button which is brought to the connector on the back. The camera has a one-button mode which will take a photo or start a video recording when the camera is powered on.
     
    I elected to use the EZ430 F2012 because I had one that I got for free a while back.

    The interface to the camera is via two wires - the pullup on the input for the power button provides enough power to run the MSP430. A 1,000 microfarad cap provides power for when the processor grounds the input to turn the camera on and off.
     

     
    The program only has to do a few things. After initializing the output and setting up the watchdog timer to interrupt every 256 mSec, it goes to sleep.
     
    On interrupt, it decides what to do next which depends on where it is in the picture taking cycle. A cycle consists of: Turn on the camera with a 250 mSec low pulse. Wait 3 seconds for the image capture. Turn off the camera with a 3 second low pulse. Flash the LED to show things are working. Wait until it is time to do it all again.
     

    //****************************************************************************** // // GoPro HD Camera Control using BUS connector // for MSP430F2012 // // Uses PWR/MODE button to wake camera up and take photo in One Button Mode // // Set SHOT_RATE for number of seconds between shots // If not using xtal control, time requires CALIBRATION // // closes PWR button for 250 mSec to wake up camera // waits 3.75 seconds for snap and store // closes PWR button for 3 seconds to turn camera off // flashes LED to indicate start of next cycle // // Peter Jennings http://benlo.com/msp430 // //****************************************************************************** #include "msp430.h" #define SHOT_RATE 60 // seconds between shots #define CALIBRATION 7 // calibration to improve accuracy #define WAITING 0 // waiting for next cycle #define STARTING 1 // button down to start #define WAITING_CAMERA 2 // waiting for camera to take pic #define STOPPING 3 // button down to stop static int tick; static int state; static int time; // seconds since last save void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer P1SEL |= 0x00; // P1.1 option select - just I/O P1DIR |= 0x11; // Set P1.0 P1.4 to output direction P1OUT |= 0x10; // LED off, GoPro button off BCSCTL2 |= DIVS_3; // SMCLK/8 WDTCTL = WDT_MDLY_32; // WDT Timer interval 32mS tick = 0; time = 10; // wait for cap to charge up state = WAITING; IE1 |= WDTIE; // Enable WDT interrupt 256 mSec _BIS_SR(LPM0_bits + GIE); // Enter LPM0 with interrupt } // Watchdog Timer interrupt service routine #pragma vector=WDT_VECTOR __interrupt void watchdog_timer(void) { if ( (state == STARTING) && (tick >= 1 ) ) // start takes .25 seconds { state = WAITING_CAMERA; P1OUT |= 0x10; // button up } if ( tick & 0x03 ) // most of the time { P1OUT &= ~0x01; // LED off and go back to sleep } else // about once very 1.024 seconds { time++; if ( (state == WAITING) && (time >= SHOT_RATE+CALIBRATION) ) // time for photo { P1OUT &= ~0x10; // button down time = 0; tick = 0; state = STARTING; } else if ((state == WAITING_CAMERA) && (time >= 4) ) // time to turn off { state = STOPPING; P1OUT &= ~0x10; // button down } else if ((state == STOPPING) && (time >= 7)) // should be off now { state = WAITING; P1OUT |= 0x10; // button up P1OUT |= 0x01; // LED flash to indicate done cycle } } tick++; // 256 mSec ticks }
     
    I have written no more than a few lines of code for this processor in my life and am basically unfamiliar with it. I would appreciate any pointers from those who are more familiar with the chip, both with regards to the hardware interfacing and the software program. I am sure I am missing some basic details and it would be good to correct them before other users implement these instructions. Feedback is encouraged.
     
    The complete writeup is at http://benlo.com/msp430/GoProController.html
     
    Peter
×
×
  • Create New...