FWIW you could also drive your LEDS with a CD4040BE using a CD4011 (page 7) as a crystal oscillator
I can test build a patch file and send it to you. Are you still using the SX200is ?
Quote from: ahull on 20 / November / 2013, 08:25:28FWIW you could also drive your LEDS with a CD4040BE using a CD4011 (page 7) as a crystal oscillatorAs a matter of interest what method would you use to divide the frequency by a four-digit number (that is not a multiple of 2 or 10) ?A microcontroller ?
#define GPIO_VSYNC_UPDATE 0xC0F06000#define GPIO_VSYNC_MAX 0xC0F06014#define GPIO_VSYNC_CURRENT 0xC0F070C8 // 0xC0F07008 ??void _wait_until_remote_button_is_released(void){ int tick; if ( ( conf.remote_enable ) // menu : USB remote enabled - bracket everything in this function && ( conf.synch_enable ) // menu : Sync enabled - tells us to wait for USB to disconnect && ( usb_sync_wait ) ) // only sync when USB remote is active - don't trap normal shooting { usb_remote_status_led(1); // indicate to user we are waiting for remote button to release - this happens every time the camera takes a picture tick = get_tick_count(); // timestamp so we don't hang here forever if something goes wrong #ifdef USB_REMOTE_PRECISION_SYNC int std_period = _EngDrvRead(GPIO_VSYNC_MAX); int sync_time = std_period * 3; // schedule the end of extended period at t = t(synch pulse) + sync_time do { } while( get_usb_bit() && ((int)get_tick_count()-tick < DELAY_TIMEOUT)); int cur_cnt = *(volatile int*)(GPIO_VSYNC_CURRENT) & 0xffff; // get the counter state at the time of sync int sync_period = sync_time - (std_period - cur_cnt); if (std_period - cur_cnt < 10) { // too close to overflow, wait for the next period sync_period -= std_period; while ((*(volatile int*)(GPIO_VSYNC_CURRENT) & 0xffff) >= cur_cnt) {}; } *(volatile int*)(GPIO_VSYNC_MAX) = sync_period; // write the length of the extended period to the register *(volatile int*)(GPIO_VSYNC_UPDATE) = 1; while (*(volatile int*)(GPIO_VSYNC_UPDATE)) {}; // wait until the new value is applied //now we are at the beginning of extended period *(volatile int*)(GPIO_VSYNC_MAX) = std_period; // back to standard timing on next period *(volatile int*)(GPIO_VSYNC_UPDATE) = 1; msleep(40); #else // delay until USB state goes to "Off" or timeout do { } while( get_usb_bit() && ((int)get_tick_count()-tick < DELAY_TIMEOUT)); // add a sync calibration delay if requested if ( conf.synch_delay_enable && conf.synch_delay_value>0 ) kbd_synch_delay( conf.synch_delay_value ); #endif sync_counter++ ; usb_sync_wait = 0 ; usb_remote_status_led(0); // alert the user that we are all done }}
Updated patch file of vnd's code attached here in case I get distracted again. Seems to run on my cameras but I need to finish sync testing using my arduino setup. Note that the register addresses are my best guess from studying the various posts on this thread. Any bugs notes / fixes / improvements / updates would be appreciated.Code: [Select]#define GPIO_VSYNC_UPDATE 0xC0F06000#define GPIO_VSYNC_MAX 0xC0F06014#define GPIO_VSYNC_CURRENT 0xC0F070C8 // 0xC0F07008 ??void _wait_until_remote_button_is_released(void){ int tick; if ( ( conf.remote_enable ) // menu : USB remote enabled - bracket everything in this function && ( conf.synch_enable ) // menu : Sync enabled - tells us to wait for USB to disconnect && ( usb_sync_wait ) ) // only sync when USB remote is active - don't trap normal shooting { usb_remote_status_led(1); // indicate to user we are waiting for remote button to release - this happens every time the camera takes a picture tick = get_tick_count(); // timestamp so we don't hang here forever if something goes wrong #ifdef USB_REMOTE_PRECISION_SYNC int std_period = _EngDrvRead(GPIO_VSYNC_MAX); int sync_time = std_period * 3; // schedule the end of extended period at t = t(synch pulse) + sync_time do { } while( get_usb_bit() && ((int)get_tick_count()-tick < DELAY_TIMEOUT)); int cur_cnt = *(volatile int*)(GPIO_VSYNC_CURRENT) & 0xffff; // get the counter state at the time of sync int sync_period = sync_time - (std_period - cur_cnt); if (std_period - cur_cnt < 10) { // too close to overflow, wait for the next period sync_period -= std_period; while ((*(volatile int*)(GPIO_VSYNC_CURRENT) & 0xffff) >= cur_cnt) {}; } *(volatile int*)(GPIO_VSYNC_MAX) = sync_period; // write the length of the extended period to the register *(volatile int*)(GPIO_VSYNC_UPDATE) = 1; while (*(volatile int*)(GPIO_VSYNC_UPDATE)) {}; // wait until the new value is applied //now we are at the beginning of extended period *(volatile int*)(GPIO_VSYNC_MAX) = std_period; // back to standard timing on next period *(volatile int*)(GPIO_VSYNC_UPDATE) = 1; msleep(40); #else // delay until USB state goes to "Off" or timeout do { } while( get_usb_bit() && ((int)get_tick_count()-tick < DELAY_TIMEOUT)); // add a sync calibration delay if requested if ( conf.synch_delay_enable && conf.synch_delay_value>0 ) kbd_synch_delay( conf.synch_delay_value ); #endif sync_counter++ ; usb_sync_wait = 0 ; usb_remote_status_led(0); // alert the user that we are all done }}Update : the two values shown for GPIO_VSYNC_CURRENT are from this thread. The value commented out was originally posted by vnd. The value used in the patch was posted by microfunguy. Using vnd's value causes my A1200 to hang after a few shots - presumably in one of the wait loops as it looks at a value that does not change?
Now what I think is that even when the moment the exposure was triggered is nearly the same, the duration of the exposure varied a little. I am not really sure about that issue, but I hat several shots where the "start" of the light painting is the same among the pictures, but not the end. This seems to be a hint that the "real" exposure time varied. Is that possible?
Would there be a way to not only trigger the start of such an exposure but also the end, with USB remote?
-- close mechanical shutter function closeshutter() if (call_event_proc(closeproc) == -1) then print("closeshutter failed") end end -- open mechanical shutter function openshutter() if (call_event_proc(openproc) == -1) then print("openshutter failed") end end
Started by Microfunguy CHDK Releases
Started by Blooper « 1 2 » Creative Uses of CHDK
Started by David Ripple « 1 2 ... 6 7 » General Discussion and Assistance
Started by koshy « 1 2 ... 8 9 » General Discussion and Assistance
Started by cameraman Creative Uses of CHDK