Jack1

Forum Replies Created

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • in reply to: RTC with Video Experimenter #1763
    Jack1
    Member

    Didn’t work. Any other to try?

    in reply to: RTC with Video Experimenter #1710
    Jack1
    Member

    Ok i will try that thank you.

    in reply to: RTC with Video Experimenter #1708
    Jack1
    Member

    Still no answer. :/

    in reply to: RTC with Video Experimenter #1674
    Jack1
    Member

    The date and time is displayed correctly now! New problem is that when there is no video input to the video experimenter the arduino executes too fast and the clock goes fast forward. Here is code:

    #include 
    #include
    #include
    #include

    #define W 136
    #define H 96

    RTC_DS1307 RTC;
    TVout tv;
    char s[32];
    DateTime dateOnStart;

    unsigned int DATE_HOUR;
    unsigned int DATE_MIN;
    unsigned int DATE_SEC;
    unsigned int DATE_DAY;
    unsigned int DATE_MONTH;
    unsigned int DATE_YEAR;

    unsigned long int unixTime2;

    void increment() {
    unixTime2 = unixTime2 + 1;

    DateTime unixTime(unixTime2);
    DATE_HOUR = unixTime.hour();
    DATE_MIN = unixTime.minute();
    DATE_SEC = unixTime.second();
    DATE_DAY = unixTime.day();
    DATE_MONTH = unixTime.month();
    DATE_YEAR = unixTime.year();
    }

    void setup() {
    Wire.begin();
    RTC.begin();
    dateOnStart = RTC.now();
    unixTime2 = dateOnStart.unixtime();

    tv.begin(PAL, W, H);
    initOverlay();
    tv.select_font(font6x8);
    tv.fill(0);
    }

    // Initialize ATMega registers for video overlay capability.
    // Must be called after tv.begin().
    void initOverlay() {
    TCCR1A = 0;
    // Enable timer1. ICES0 is set to 0 for falling edge detection on input capture pin.
    TCCR1B = _BV(CS10);

    // Enable input capture interrupt
    TIMSK1 |= _BV(ICIE1);

    // Enable external interrupt INT0 on pin 2 with falling edge.
    EIMSK = _BV(INT0);
    EICRA = _BV(ISC11);
    }

    // Required to reset the scan line when the vertical sync occurs
    ISR(INT0_vect) {
    display.scanLine = 0;
    }

    void loop() {
    sprintf(s, "%u:%u:%u %u.%u.%u", DATE_HOUR, DATE_MIN, DATE_SEC, DATE_DAY, DATE_MONTH, DATE_YEAR);
    tv.print(0, 0, s);
    increment();
    delay(2500);
    }

    Another problem: there is some strange pixels on the screen.
    Here is a picture:

    in reply to: RTC with Video Experimenter #1673
    Jack1
    Member

    I’m sure that the RTC is working properly. I actually took timer code and RTC code away and then the date and time showed as zeros. I will try messing aorund with the code some more to see if i get it working.
    I think that the wire library interferes with the video experimenter.

    in reply to: RTC with Video Experimenter #1671
    Jack1
    Member

    It dont show any text on screen. But when i remove all code related to rtc and change sprintf to something that outputs only text then it shows that text.

    in reply to: RTC with Video Experimenter #1669
    Jack1
    Member

    So i made the code now but it still doesnt work for some reason.
    Could you see if it has something wrong? Here it is:

    #include 
    #include
    #include
    #include
    #include

    #define W 136
    #define H 96

    RTC_DS1307 RTC;
    TVout tv;
    char s[32];
    DateTime dateOnStart;

    unsigned int DATE_HOUR;
    unsigned int DATE_MIN;
    unsigned int DATE_SEC;
    unsigned int DATE_DAY;
    unsigned int DATE_MONTH;
    unsigned int DATE_YEAR;

    unsigned long int unixTime2;

    void increment() {
    unixTime2 = unixTime2 + 1;

    DateTime unixTime;
    DATE_HOUR = unixTime.hour();
    DATE_MIN = unixTime.minute();
    DATE_SEC = unixTime.second();
    DATE_DAY = unixTime.day();
    DATE_MONTH = unixTime.month();
    DATE_YEAR = unixTime.year();
    }

    void setup() {
    Wire.begin();
    RTC.begin();
    dateOnStart = RTC.now();
    unixTime2 = dateOnStart.unixtime();

    MsTimer2::set(1000, increment);
    MsTimer2::start();

    tv.begin(PAL, W, H);
    initOverlay();
    tv.select_font(font6x8);
    tv.fill(0);
    }

    // Initialize ATMega registers for video overlay capability.
    // Must be called after tv.begin().
    void initOverlay() {
    TCCR1A = 0;
    // Enable timer1. ICES0 is set to 0 for falling edge detection on input capture pin.
    TCCR1B = _BV(CS10);

    // Enable input capture interrupt
    TIMSK1 |= _BV(ICIE1);

    // Enable external interrupt INT0 on pin 2 with falling edge.
    EIMSK = _BV(INT0);
    EICRA = _BV(ISC11);
    }

    // Required to reset the scan line when the vertical sync occurs
    ISR(INT0_vect) {
    display.scanLine = 0;
    }

    void loop() {
    sprintf(s, "%u:%u:%u %u.%u.%u", DATE_HOUR, DATE_MIN, DATE_SEC, DATE_DAY, DATE_MONTH, DATE_YEAR);
    tv.print(0, 0, s);
    }
    in reply to: RTC with Video Experimenter #1668
    Jack1
    Member

    Thank you! I think i can do it now. Thanks for your help

    in reply to: RTC with Video Experimenter #1664
    Jack1
    Member

    Could you provide some example code on ISR and those timers to get me started?

    in reply to: RTC with Video Experimenter #1660
    Jack1
    Member

    I think it uses I2C communications. Is there any other way i could get time displayed on the video?

Viewing 10 posts - 1 through 10 (of 10 total)