Страница 6 из 17 ПерваяПервая 12345678910111216 ... ПоследняяПоследняя
Показано с 51 по 60 из 164
  1. #51
    Администратор Аватар для Chip
    Регистрация
    08.06.2007
    Возраст
    54
    Сообщений
    13,376
    Вес репутации
    10

    По умолчанию Re: Видеокарта для Arduino(CarduinoVideioCard).

    900 или 920 разницы особой нет
    Возможно ты залил скетчь написаный для NTSC, а не для PAL

  2. #52
    Пользователь
    Регистрация
    21.03.2010
    Сообщений
    64
    Вес репутации
    185

    По умолчанию Re: Видеокарта для Arduino(CarduinoVideioCard).

    скетч вот этот
    Код:
    //Arduino Tv framebuffer
    //Alastair Parker
    //2007
    
    // Video out voltage levels
    #define _SYNC 0x00
    #define _BLACK 0x01
    #define _GRAY 0x02
    #define _WHITE 0x03
    
    // dimensions of the screen
    #define WIDTH 38
    #define HEIGHT 14
    
    //number of lines to display
    #define DISPLAY_LINES 240
    
    // update speed for the main loop of the game
    #define UPDATE_INTERVAL 1
    
    // positions of the player paddles
    #define PLAYER_RIGHT_X 35
    #define PLAYER_LEFT_X 2
    
    // maximum velocity of the ball
    #define MAX_VEL 10
    
    // locations of the top and bottom virtual bars
    #define SCORE_BAR 3
    #define BASE_BAR 13
    
    // time to wait while paused
    #define DONE_WAITING 30
    #define SCORE_WAITING 30
    
    // max player life
    #define MAX_LIFE 6
    
    //positions of player life bars
    #define PLAYER_LEFT_LIFE 2
    #define PLAYER_RIGHT_LIFE 23
    
    // input pins for the player pots
    #define PLAYER_LEFT_PIN 2
    // currently the same pin
    #define PLAYER_RIGHT_PIN 3
    
    //video pins
    #define DATA_PIN 9
    #define SYNC_PIN 8
    
    // the video frameBuffer
    byte frameBuffer[WIDTH][HEIGHT];
    
    // loop indices
    byte index, index2;
    
    // pal video line loop
    byte line;
    // current drawing line in framebuffer
    byte newLine;
    
    // flag used in wait loop to indicate that player just scored
    boolean justScored=false;
    
    // positions for the left paddle
    byte playerLeft;
    byte playerLeftOld=-1;
    // life for the left player
    byte playerLeftLife = MAX_LIFE;
    
    // positions of the right paddle
    byte playerRight;
    byte playerRightOld=-1;
    // life for the right player
    byte playerRightLife = MAX_LIFE;
    
    // positions and velocity of the ball
    int ballXVel = -1;
    int ballYVel = -5;
    byte ballXPos = 14;
    byte ballYPos = 7;
    
    // loop counters to control the velocity of the ball
    byte ballXLoop =MAX_VEL;
    byte ballYLoop =MAX_VEL;
    
    // loop counter to for the main loop delay 
    int waitingCount = 0;
    
    // start postion of the loading bar
    byte loadingBar = 2;
    
    // if the left player should be updated or the right
    boolean playerLeftTurn=true;
    
    // if we should be waiting for something to happen
    boolean waiting=true;
    // if displaying the title
    boolean showingTitle = true;
    
    // value of the counter controlling the freq of updates
    byte updateCounter=0;
    
    // init the variables
    void initGame()
    {
    playerLeftOld=-1;
    playerLeftLife = MAX_LIFE;
    playerRightOld=-1;
    playerRightLife = MAX_LIFE;
    ballXVel = -1;
    ballYVel = -5;
    ballXPos = 14;
    ballYPos = 7;
    ballXLoop =MAX_VEL;
    ballYLoop =MAX_VEL;
    waitingCount = 0;
    loadingBar = 2;
    playerLeftTurn=true;
    waiting=true;
    showingTitle = true;
    justScored=false;
    updateCounter=0;
    }
    
    // draw a pixel to the buffer
    void setPixel(byte x,byte y)
    {
    frameBuffer[x][y]= _WHITE;
    }
    
    void grayPixel(byte x, byte y)
    {
    frameBuffer[x][y]= _GRAY;
    }
    
    // draw a black pixel to the buffer
    void clearPixel(byte x,byte y)
    {
    frameBuffer[x][y]= _BLACK;
    }
    
    // draw a paddle
    void drawPaddle(byte x,byte y,byte col)
    {
    frameBuffer[x][y]= col;
    frameBuffer[x][y+1]= col;
    }
    
    
    //draw the title message
    void drawArduinoPong()
    {
    //arduino
    setPixel(7,3);
    setPixel(8,3);
    setPixel(15,3);
    setPixel(21,3);
    setPixel(6,4);
    setPixel(8,4);
    setPixel(14,4);
    setPixel(15,4);
    setPixel(28,4);
    setPixel(6,5);
    setPixel(7,5);
    setPixel(8,5);
    setPixel(10,5);
    setPixel(11,5);
    setPixel(13,5);
    setPixel(15,5);
    setPixel(17,5);
    setPixel(19,5);
    setPixel(21,5);
    setPixel(23,5);
    setPixel(24,5);
    setPixel(27,5);
    setPixel(29,5);
    setPixel(6,6);
    setPixel(8,6);
    setPixel(10,6);
    setPixel(14,6);
    setPixel(15,6);
    setPixel(18,6);
    setPixel(19,6);
    setPixel(21,6);
    setPixel(23,6);
    setPixel(25,6);
    setPixel(28,6);
    
    //pong
    setPixel(10,8);
    setPixel(11,8);
    setPixel(15,8);
    setPixel(16,8);
    setPixel(19,8);
    setPixel(22,8);
    setPixel(24,8);
    setPixel(25,8);
    setPixel(26,8);
    setPixel(10,9);
    setPixel(12,9);
    setPixel(14,9);
    setPixel(17,9);
    setPixel(19,9);
    setPixel(20,9);
    setPixel(22,9);
    setPixel(24,9);
    setPixel(10,10);
    setPixel(11,10);
    setPixel(14,10);
    setPixel(17,10);
    setPixel(19,10);
    setPixel(21,10);
    setPixel(22,10);
    setPixel(24,10);
    setPixel(26,10);
    setPixel(10,11);
    setPixel(15,11);
    setPixel(16,11);
    setPixel(19,11);
    setPixel(22,11);
    setPixel(24,11);
    setPixel(25,11);
    setPixel(26,11);
    }
    
    // do the main game logic regarding the ball and collisions
    void updateBall(boolean xEvent)
    {
    // if checking the x coords of the ball
    if(xEvent)
    {
    /*
    TODO
    
    have the yvel start 1t 1
    
    */
    
    //check for collision with left player
    if(ballXPos <PLAYER_LEFT_X+2 & (playerLeft == ballYPos or playerLeft+1 == ballYPos))
    {
    ballXVel = -1 * ballXVel;
    ballXPos=PLAYER_LEFT_X+1;
    }
    //check for collision with right player
    if(ballXPos > PLAYER_RIGHT_X-2 & (playerRight == ballYPos or playerRight+1 == ballYPos))
    {
    ballXVel = -1 * ballXVel;
    ballXPos=PLAYER_RIGHT_X-1;
    }
    
    //move the ball in the x direction
    if(ballXVel < 1)
    {
    ballXPos--;
    }
    else
    {
    ballXPos++;
    }
    }
    
    //if checking the y coords
    if(!xEvent)
    {
    //check for top of screen hit
    if( ballYPos <= SCORE_BAR )
    {
    ballYVel = -1 * ballYVel; 
    ballYPos = SCORE_BAR;
    }
    //check for bottom of screen hit
    if( ballYPos>BASE_BAR )
    {
    ballYVel = -1 * ballYVel; 
    ballYPos = BASE_BAR+1;
    }
    
    // move the ball in the y direction
    if(ballYVel < 1)
    {
    ballYPos--;
    }
    else
    {
    ballYPos++;
    } 
    }
    
    //always check for scoring of points
    
    //right player scores
    if(ballXPos==PLAYER_LEFT_X)//0
    {
    //reset the position of the ball
    ballXPos = PLAYER_RIGHT_X - 5;
    ballYPos=7;
    
    // change the other players life
    clearPixel(PLAYER_LEFT_LIFE+2*playerLeftLife-2,SCORE_BAR-1);
    playerLeftLife--;
    
    // indicate that someone scored so the wait doesn't start a new game
    justScored=true;
    // indicate that we should wait next loop
    waiting=true;
    
    // check if game is over
    if(playerLeftLife==0)
    justScored=false; 
    }
    
    //left player scores
    if(ballXPos==PLAYER_RIGHT_X)//38
    {
    //reset position of ball
    ballXPos = PLAYER_LEFT_X + 5;
    ballYPos=7;
    
    //update other players score
    clearPixel(PLAYER_RIGHT_LIFE+2*(MAX_LIFE-playerRightLife)+2,SCORE_BAR-1);
    playerRightLife--;
    
    // indicate that someone scored so the wain doesn't start a new game
    justScored=true;
    // indicate that we should wait next loop
    waiting=true;
    
    // check for game over
    if(playerRightLife==0)
    justScored=false;
    }
    
    }
    
    // draw the player life bars
    void initScreen()
    {
    for(index=1;index<=MAX_LIFE;++index)
    {
    grayPixel(index*2,SCORE_BAR-1);
    grayPixel(index*2+PLAYER_RIGHT_LIFE,SCORE_BAR-1);
    }
    }
    
    
    // draw the ball
    void drawBall(byte col)
    {
    frameBuffer[ballXPos][ballYPos]=col;
    }
    
    // clear the screen
    void clearScreen()
    {
    for (index = 0; index < WIDTH; index++)
    for (index2=0;index2<=HEIGHT;++index2)
    {
    frameBuffer[index][index2] = _BLACK;
    } 
    }
    
    // the setup routine
    void setup()
    {
    cli();
    pinMode (SYNC_PIN, OUTPUT);
    pinMode (DATA_PIN, OUTPUT);
    digitalWrite (SYNC_PIN, HIGH);
    digitalWrite (DATA_PIN, HIGH);
    clearScreen();
    drawArduinoPong();
    }
    
    void loop()
    {
    // iterate over the lines on the tv
    for ( line =0;line< DISPLAY_LINES;++line)
    {
    
    // HSync
    // front porch (1.5 us)
    PORTB = _BLACK;
    delayMicroseconds(1.5);
    //sync (4.7 us)
    PORTB = _SYNC;
    delayMicroseconds(4.7);
    // breezeway (.6us) + burst (2.5us) + colour back borch (1.6 us)
    PORTB = _BLACK;
    delayMicroseconds(0.6+2.5+1.6);
    
    
    //calculate which line to draw to
    newLine = line >>4;
    delayMicroseconds(1); 
    
    //display the array for this line
    // a loop would have been smaller, but it messes the timing up
    PORTB = frameBuffer[0][newLine];
    delayMicroseconds(1);
    PORTB = frameBuffer[1][newLine];
    delayMicroseconds(1);
    PORTB = frameBuffer[2][newLine];
    delayMicroseconds(1);
    PORTB = frameBuffer[3][newLine];
    delayMicroseconds(1);
    PORTB = frameBuffer[4][newLine];
    delayMicroseconds(1);
    PORTB = frameBuffer[5][newLine];
    delayMicroseconds(1);
    PORTB = frameBuffer[6][newLine];
    delayMicroseconds(1);
    PORTB = frameBuffer[7][newLine];
    delayMicroseconds(1);
    PORTB = frameBuffer[8][newLine];
    delayMicroseconds(1);
    PORTB = frameBuffer[9][newLine];
    delayMicroseconds(1);
    PORTB = frameBuffer[10][newLine];
    delayMicroseconds(1);
    PORTB = frameBuffer[11][newLine];
    delayMicroseconds(1);
    PORTB = frameBuffer[12][newLine];
    delayMicroseconds(1);
    PORTB = frameBuffer[13][newLine];
    delayMicroseconds(1);
    PORTB = frameBuffer[14][newLine];
    delayMicroseconds(1);
    PORTB = frameBuffer[15][newLine];
    delayMicroseconds(1);
    PORTB = frameBuffer[16][newLine];
    delayMicroseconds(1);
    PORTB = frameBuffer[17][newLine];
    delayMicroseconds(1);
    PORTB = frameBuffer[18][newLine];
    delayMicroseconds(1);
    PORTB = frameBuffer[19][newLine];
    delayMicroseconds(1);
    PORTB = frameBuffer[20][newLine];
    delayMicroseconds(1);
    PORTB = frameBuffer[21][newLine];
    delayMicroseconds(1);
    PORTB = frameBuffer[22][newLine];
    delayMicroseconds(1); 
    PORTB = frameBuffer[23][newLine];
    delayMicroseconds(1);
    PORTB = frameBuffer[24][newLine];
    delayMicroseconds(1); 
    PORTB = frameBuffer[25][newLine];
    delayMicroseconds(1);
    PORTB = frameBuffer[26][newLine];
    delayMicroseconds(1);
    PORTB = frameBuffer[27][newLine];
    delayMicroseconds(1);
    PORTB = frameBuffer[28][newLine];
    delayMicroseconds(1);
    PORTB = frameBuffer[29][newLine];
    delayMicroseconds(1);
    PORTB = frameBuffer[30][newLine];
    delayMicroseconds(1);
    PORTB = frameBuffer[31][newLine];
    delayMicroseconds(1);
    PORTB = frameBuffer[32][newLine];
    delayMicroseconds(1);
    PORTB = frameBuffer[33][newLine];
    delayMicroseconds(1);
    PORTB = frameBuffer[34][newLine];
    delayMicroseconds(1);
    PORTB = frameBuffer[35][newLine];
    delayMicroseconds(1);
    
    // klugdge to correct timings
    PORTB = frameBuffer[36][newLine]; 
    PORTB=PORTB;
    PORTB=PORTB;
    PORTB=PORTB;
    delayMicroseconds(3);
    }
    
    
    //vsync 
    PORTB = _SYNC;
    
    // if delaying for some reason
    if(waiting)
    {
    // increment the waiting counter
    waitingCount++;
    
    // if waiting is over for a new game
    if(waitingCount==DONE_WAITING & !justScored)
    {
    waitingCount=0;
    // if on title screen
    if(showingTitle)
    {
    // draw the loading bar
    grayPixel(loadingBar,BASE_BAR);
    loadingBar+=2;
    
    // done loading
    if (loadingBar > 37)
    {
    showingTitle=false;
    clearScreen(); 
    initGame();
    initScreen();
    waiting=false;
    }
    }
    }
    
    // waiting because someone scored
    if(waitingCount==SCORE_WAITING & justScored)
    {
    justScored=false; 
    waitingCount=0;
    waiting=false;
    }
    // wait for the remainder of the sync period
    delayMicroseconds(305);
    }
    // not waiting
    else
    {
    // increment the update delay counter
    updateCounter++;
    if( updateCounter >= UPDATE_INTERVAL)
    {
    //player movement
    if(playerLeftTurn)
    {
    drawPaddle(PLAYER_LEFT_X,playerLeftOld,_BLACK);
    playerLeft = analogRead(PLAYER_LEFT_PIN)>>6;
    if(playerLeft<SCORE_BAR)
    playerLeft=SCORE_BAR;
    if(playerLeft>BASE_BAR)
    playerLeft=BASE_BAR;
    drawPaddle(PLAYER_LEFT_X,playerLeft,_WHITE);
    playerLeftOld=playerLeft;
    playerLeftTurn=false;
    }
    else
    {
    drawPaddle(PLAYER_RIGHT_X,playerRightOld,_BLACK);
    playerRight = analogRead(PLAYER_RIGHT_PIN)>>6;
    if(playerRight<SCORE_BAR)
    playerRight=SCORE_BAR;
    if(playerRight>BASE_BAR)
    playerRight=BASE_BAR;
    drawPaddle(PLAYER_RIGHT_X,playerRight,_WHITE);
    playerRightOld=playerRight; 
    playerLeftTurn=true;
    }
    // remainder of sync period
    delayMicroseconds(10); 
    updateCounter=0;
    }
    else
    // remainder of sync period
    delayMicroseconds(250); 
    
    // perform ball x velocity delay
    ballXLoop--;
    if(ballXLoop <= abs(ballXVel) and ballXVel != 0)
    {
    //ball movement;
    drawBall(_BLACK);
    updateBall(true);
    ballXLoop=MAX_VEL;
    }
    
    // perform ball y velocity delay 
    ballYLoop--;
    if(ballYLoop <= abs(ballYVel) and ballYVel != 0)
    {
    //ball movement;
    drawBall(_BLACK);
    updateBall(false);
    ballYLoop=MAX_VEL;
    }
    // draw new ball
    drawBall(_GRAY); 
    }
    }
    P.S. Блин, точн для ntsc ) все разобался, ушел в тругую комнату на нормальный телек, там все норм спс
    P.S.S. Не, не разорбался просмотрел скетч нашел
    Код:
    // pal video line loop
    И все таки хочу заставить его работать на етом телеке.
    Последний раз редактировалось Ant1Player; 30.07.2010 в 16:56.

  3. #53
    Продвинутый Аватар для HiddenPilot
    Регистрация
    14.04.2008
    Возраст
    44
    Сообщений
    354
    Вес репутации
    290

    По умолчанию Re: Видеокарта для Arduino(CarduinoVideioCard).

    до кучи ссылочка
    http://www.elenafrancesco.org/arduino/
    первые 2 проекта вроде то что нужно



    ---------------------------------------------
    и еще страничка со списком OSD микросхем
    http://deka18.tsk.ru/er/TV/osd.shtml
    ---------------------------------------------


    И еще ссылочка... не совсем ардуино... но для базы знаний пойдет
    http://www.micro-examples.com/public...d-superimposer

    Последний раз редактировалось Chip; 20.03.2011 в 10:34.

  4. #54
    Администратор Аватар для Chip
    Регистрация
    08.06.2007
    Возраст
    54
    Сообщений
    13,376
    Вес репутации
    10

    По умолчанию Re: Видеокарта для Arduino(CarduinoVideioCard).

    Советую использовать OSD микросхему, потому как на формирование видеосигнала уходит много ресурсов контроллера.
    Микросхема MAX7456 может работать не только с внешним сигналом, у нее есть функция формирования синхроимпульсов. На видео в шапке видно что изображение не использует внешнего видеосигнала и синхроимпульсов
    Последний раз редактировалось Chip; 20.03.2011 в 12:39.

  5. #55
    Продвинутый Аватар для HiddenPilot
    Регистрация
    14.04.2008
    Возраст
    44
    Сообщений
    354
    Вес репутации
    290

    По умолчанию Re: Видеокарта для Arduino(CarduinoVideioCard).

    всетаки дороговата она... для прстого смертного 1000р, (600 если изголиться)...
    А здесь по сути можно сделать тот же знакогенератор за 100-150р... и если постараться то даже попробовать генерировать готовый сигнал...

    Но основное примениение выше указанных ссылок, это конечно же наложение текста/ картинки на готовый видеосигнал... например на камеру заднего вида...

    А вообще куда нужни оставшиеся ресурсы ардуины? снять какие то показания? 1% от всех ресуров ардуины...

    Вот например в этом проекте...

    http://www.smalltim.ru/production/osd-mini/features/
    ардуино не только генерирует/накладывает графическо символьную информацию, но при этом еще выводит и собирает информацию с различных датчиков и ЕЩЕ успевает анализиорвать и приобразовывать информацию с GPS приемника!!! :

    •Полетное время
    •Качество/наличие приема RC сигнала с передатчика для PPM приемников
    •Высота по барометрическому датчику: -999..9999м (опционально)
    •Воздушная скорость : 0..350км/ч (опционально)
    •Температура : -45..+165°С
    •Ток: 0..99А
    •Напряжение (3 входа): 0..15В, автоматическое определение наличия подключения батареи
    •Израсходованный заряд батареи: 0..9999мАч
    •Высота по GPS: -999..9999м
    •Скорость относительно земли по GPS: 0..999км/ч
    •Расстояние по земле от точки взлета по GPS: 0..9999м
    •Направление вектора текущей скорости: лента со шкалой "компаса"
    •Направление на точку взлета: -180..180 градусов, лента с маркером "базы"
    •Вариометр (набор/снижение высоты)
    •Количество видимых спутников GPS: 0..12
    •Формат определения положения модулем GPS: NA / 2D / 3D
    •Широта/долгота в строковом виде: 1234.567N/89012.345E


    Последний раз редактировалось HiddenPilot; 20.03.2011 в 14:48.

  6. #56
    Пользователь Аватар для novorado
    Регистрация
    25.12.2009
    Сообщений
    53
    Вес репутации
    186

    По умолчанию Re: Видеокарта для Arduino(CarduinoVideioCard).

    Красивый наложенный композитный сигнал (говорим только о монохромном, ибо цветной это другая песня совсем), что бы грамотно делать, нужно следующее:
    1. При наложении пикселов нужно цеплятся к горизонтальной развертке, Hsync - иначе будут зубья
    2. Если входной сигнал отъехал (камеру например отпилили бастарды во дворе), приличная схема должна уметь сама генерить развертку и писать в синий экран.

    Все приведенные PIC схемы, используют свой клок на 27Mhz или около того. Контроллер будет нехило кушать. Для наших дел, частоту лучше сильно не задирать без надобности.

    Соглашусь с Chip'om, MAX7456EUI+ - доступная у нас версия, все это делает. Это самый гуманный вариант.

    Теоретически можно и*нутся, выделить и синхронизировать ПИК от горизонтальной развертки, прецеденты бывали. Встроенный A/D в ПИКах это позволяет, если лавэ савсем нэту ..

    PS: Я заказал пару устройств с MAX7456. Приедут, поиграемся.
    Миниатюры Миниатюры Нажмите на изображение для увеличения. 

Название:	hsync.jpg 
Просмотров:	1742 
Размер:	74.5 Кб 
ID:	11649  
    Последний раз редактировалось novorado; 20.03.2011 в 15:21.

  7. #57
    Администратор Аватар для Chip
    Регистрация
    08.06.2007
    Возраст
    54
    Сообщений
    13,376
    Вес репутации
    10

    По умолчанию Re: Видеокарта для Arduino(CarduinoVideioCard).

    Если кого заинтересует , то у меня есть лишняя микросхема MAX7456EUI+
    отдам за 800руб.

  8. #58
    Продвинутый Аватар для HiddenPilot
    Регистрация
    14.04.2008
    Возраст
    44
    Сообщений
    354
    Вес репутации
    290

    По умолчанию Re: Видеокарта для Arduino(CarduinoVideioCard).

    Цитата Сообщение от Chip Посмотреть сообщение
    Если кого заинтересует , то у меня есть лишняя микросхема MAX7456EUI+
    отдам за 800руб.
    xDriver вроде не успел в свое время может еще у него не пропало желание ?
    http://www.compcar.ru/forum/showpost...8&postcount=36

  9. #59
    Пользователь
    Регистрация
    28.10.2010
    Возраст
    38
    Сообщений
    42
    Вес репутации
    174

    По умолчанию Re: Видеокарта для Arduino(CarduinoVideioCard).

    вот готовый вариант на MAX7456, и стоит как у нас одна микросхема
    http://www.aliexpress.com/product-fm...olesalers.html
    в комплекте есть все ПО для изменения и вшития шрифтов

  10. #60
    Продвинутый Аватар для aptm
    Регистрация
    01.09.2007
    Сообщений
    341
    Вес репутации
    358

    По умолчанию Re: Видеокарта для Arduino(CarduinoVideioCard).


Страница 6 из 17 ПерваяПервая 12345678910111216 ... ПоследняяПоследняя

Информация о теме

Пользователи, просматривающие эту тему

Эту тему просматривают: 1 (пользователей: 0 , гостей: 1)

Ваши права

  • Вы не можете создавать новые темы
  • Вы не можете отвечать в темах
  • Вы не можете прикреплять вложения
  • Вы не можете редактировать свои сообщения
  •