Show Posts
Pages: 1 ... 7 8 [9] 10
121  Forum 2005-2010 (read only) / Interfacing / Re: Reading a IR reciever on: August 05, 2006, 06:11:48 pm
Hello Seltar,

   Take a look at http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1152894029. I've made an SIRCS IR decoder. It's in french but you can ask me if you have some questions.
122  Forum 2005-2010 (read only) / Exhibition / Re: Arduino Pong on: August 22, 2007, 05:21:44 am
WOOOH ! GREAT JOB !
123  Forum 2005-2010 (read only) / Exhibition / Re: Paint on the TV screen with Arduino on: April 22, 2007, 04:23:03 pm
Hello,

  It's "more simple" to do it in asm because you can now exactly the code that you generate and THE timing of each instruction.
124  Forum 2005-2010 (read only) / Exhibition / Re: Paint on the TV screen with Arduino on: April 21, 2007, 02:24:26 pm
I've read your post again, ...

Yes it run on an arduino, I've read it to quickly.

Ok for the optimizations possibles in asm, but I d'on't understand what yhe matter with bootloader and a slower program ? Could you explain us ?

I'm actually working on an (low res) code with tming "running" (I don't speak english smiley-sad) with interrupt. I have sometimes "jitter" depends on code but I don't understand why ?

the code is below, have you any idea ?

Code:
#define _SYNC 0x00
#define _BLACK  0x01
#define _GRAY  0x02
#define _WHITE  0x03

// compensation chargement us de 1 incluse
/*
#define _NORMAL_SYNC 32
#define _LONG_SYNC 240
#define _SHORT_SYNC 16
#define _LONG_SYNC_DELAI 16
#define _SHORT_SYNC_DELAI 240
*/


#define _NB_PIXELS 29
#define _NB_LIGNES 19


#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
#ifndef sbi
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
#endif

byte memVideo[_NB_PIXELS][_NB_LIGNES];
byte index, index2;
int noligne = 0;
byte diviseur = 0;

boolean bCalcul = false;

SIGNAL(SIG_OVERFLOW0)
{
  TCNT0 = 256 - 128;
  PORTB = _SYNC;
      
  if (noligne == 3 || noligne == 4)
  {
    // SYNCHRO
    while (TCNT0 < (128 + 4)); // 2 uS
        
    PORTB = _BLACK;
    while (TCNT0 < (128 + 60 + 4)); // 32 us
    
    PORTB = _SYNC;
    while (TCNT0 < (128 + 60 + 4 + 4));
  }
    
  // fin
  if (noligne >= 309)
  {
    // SHORT
    while (TCNT0 < (128 + 4)); // 2 uS
    
    PORTB = _BLACK;
    while (TCNT0 < (128 + 60 + 4)); // 32 us
    
    // SHORT
    PORTB = _SYNC;
    while (TCNT0 < (128 + 60 + 4 + 4));
  }

  // image
  if (noligne >= 5 && noligne < 309)
  {
    // SYNC
    while (TCNT0 < (128 + 8));
    
    PORTB = _BLACK; // porch
    while (TCNT0 < (128 + 8 + 8));
    
    //** image ligne 52 uS
//##    if (noligne >= 32 && noligne < 304)
    {
      for (index = 0; index < _NB_PIXELS; index++)
      {
        PORTB = memVideo[index][(noligne>>4)];
        PORTB = PORTB;
        PORTB = PORTB;
      }
    }
  }
  
  if (noligne == 2)
  {
    // SYNCHRO
    while (TCNT0 < (128 + 60));
    
    PORTB = _BLACK;
    while (TCNT0 < (128 + 60 + 4));

    PORTB = _SYNC;
    while (TCNT0 < (128 + 60 + 4 + 4));
  }
  
  if (noligne < 2)
  {
    // SYNCHRO
    while (TCNT0 < (128 + 60));
    
    PORTB = _BLACK;
    while (TCNT0 < (128 + 60 + 4));

    PORTB = _SYNC;
    while (TCNT0 < (128 + 60 + 4 + 60));
  }
  
  PORTB = _BLACK;
      
  // COMPTEUR LIGNE
  if (noligne == 311)
    noligne = 0;
  else
    noligne++;
}

void InitTimer()
{
  #if defined(__AVR_ATmega168__)
      sbi(TCCR0A, WGM01);
      sbi(TCCR0A, WGM00);
  #endif  
      // set timer 0 prescale factor to 8
  #if defined(__AVR_ATmega168__)
        cbi(TCCR0B, CS02);
      sbi(TCCR0B, CS01);
      cbi(TCCR0B, CS00);
  #else
        cbi(TCCR0, CS02);
      sbi(TCCR0, CS01);
      cbi(TCCR0, CS00);
  #endif

      // enable timer 0 overflow interrupt
  #if defined(__AVR_ATmega168__)
        sbi(TIMSK0, TOIE0);
  #else
        sbi(TIMSK, TOIE0);
  #endif
}

void setup()
{
  pinMode (8, OUTPUT);
  pinMode (9, OUTPUT);
  digitalWrite (8, HIGH);
  digitalWrite (9, HIGH);
/*
  Serial.begin(19200);
  Serial.print ("GO");
  Serial.print (13, BYTE);
*/
  for (index2 = 0; index2 < _NB_LIGNES; index2++)
     for (index = 0; index < _NB_PIXELS; index++)
     {
       /*memVideo[index][index2] = _BLACK;*/
       memVideo[index][index2] = (index + index2) % 3 + 1;
     }

  memVideo[2][2] = _WHITE;

  InitTimer();
}

int ligne;
char car;
int cx=0, cy=0;
byte couleur = _BLACK;

void loop()
{
  /*
  if (bCalcul)
  {
    bCalcul = false;
   if (serialAvailable())
   {
     Serial.read();
   }
  }
  */
}

If I uncomment the line wich start with "//##" the screen is scrambled but stable ? ? ?
125  Forum 2005-2010 (read only) / Exhibition / Re: Paint on the TV screen with Arduino on: April 21, 2007, 10:48:06 am
Sorry for the mistake Erik and Zitron my last message was for Zitron. This now correct !

Zitron,

  please test this code made with interrupt :

Code:

#define _SYNC 0x00
#define _BLACK  0x01
#define _GRAY  0x02
#define _WHITE  0x03

// compensation chargement us de 1 incluse
/*
#define _NORMAL_SYNC 32
#define _LONG_SYNC 240
#define _SHORT_SYNC 16
#define _LONG_SYNC_DELAI 16
#define _SHORT_SYNC_DELAI 240
*/

#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
#ifndef sbi
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
#endif

byte memVideo[_NB_PIXELS][_NB_LIGNES];
byte index, index2;
int noligne = 0;
byte diviseur = 0;

SIGNAL(SIG_OVERFLOW0)
{
  TCNT0 = 256 - 128;
  PORTB = _SYNC;
      
  if (noligne == 3 || noligne == 4)
  {
    // SYNCHRO
    while (TCNT0 < 128 + 4); // 2 uS
        
    PORTB = _BLACK;
    while (TCNT0 < 128 + 60 + 4); // 32 us
    
    PORTB = _SYNC;
    while (TCNT0 < 128 + 60 + 4 + 4);
    
    PORTB = _BLACK;
  }
    
  // fin
  if (noligne >= 309)
  {
    // SHORT
    while (TCNT0 < 128 + 4); // 2 uS
    
    PORTB = _BLACK;
    while (TCNT0 < 128 + 60 + 4); // 32 us
    
    // SHORT
    PORTB = _SYNC;
    while (TCNT0 < 128 + 60 + 4 + 4);
    
    PORTB = _BLACK;
  }

  // image
  if (noligne >= 5 && noligne < 309)
  {
    // SYNC
    while (TCNT0 < 128 + 8);
    
    PORTB = _BLACK; // porch
    while (TCNT0 < 128 + 8 + 8);
    
    //** image ligne 52 uS
//    if (noligne >= 16 && noligne < 304)
      for (index = 0; index < _NB_PIXELS; index++)
      {
        PORTB = memVideo[index][(noligne>>4)];
        PORTB = PORTB;
        PORTB = PORTB;
      }
    
    PORTB = _BLACK;
  }
  
  if (noligne < 2)
  {
    // SYNCHRO
    while (TCNT0 < 128 + 60);
    
    PORTB = _BLACK;
    while (TCNT0 < 128 + 60 + 4);

    PORTB = _SYNC;
    while (TCNT0 < 128 + 60 + 4 + 60);

    PORTB = _BLACK;
  }
      
  // COMPTEUR LIGNE
  if (noligne == 311)
    noligne = 0;
  else
    noligne++;
}

void InitTimer()
{
  #if defined(__AVR_ATmega168__)
      sbi(TCCR0A, WGM01);
      sbi(TCCR0A, WGM00);
  #endif  
      // set timer 0 prescale factor to 8
  #if defined(__AVR_ATmega168__)
        cbi(TCCR0B, CS02);
      sbi(TCCR0B, CS01);
      cbi(TCCR0B, CS00);
  #else
        cbi(TCCR0, CS02);
      sbi(TCCR0, CS01);
      cbi(TCCR0, CS00);
  #endif

      // enable timer 0 overflow interrupt
  #if defined(__AVR_ATmega168__)
        sbi(TIMSK0, TOIE0);
  #else
        sbi(TIMSK, TOIE0);
  #endif
}

void setup()
{
  pinMode (8, OUTPUT);
  pinMode (9, OUTPUT);
  digitalWrite (8, HIGH);
  digitalWrite (9, HIGH);

  Serial.begin(19200);
  Serial.print ("GO");
  Serial.print (13, BYTE);
  
  for (index2 = 0; index2 < _NB_LIGNES; index2++)
     for (index = 0; index < _NB_PIXELS; index++)
     {
       /*memVideo[index][index2] = _BLACK;*/
       memVideo[index][index2] = (index + index2) % 3 + 1;
     }

  memVideo[2][2] = _WHITE;

  InitTimer();
}

int ligne;
char car;
int cx=0, cy=0;
byte couleur = _BLACK;

void loop()
{

}

It must be time independent.

You have to comment some code in wiring.c !
Search for "SIGNAL(SIG_OVERFLOW0)" and comment the function like this :
Code:
/*
SIGNAL(SIG_OVERFLOW0)
{
      timer0_overflow_count++;
}
*/

Tell me  if it work !
126  Forum 2005-2010 (read only) / Exhibition / Re: Paint on the TV screen with Arduino on: April 21, 2007, 08:26:08 am
Erik, Zitron,

  How have you disabled interrupts ? With a cli() or by comment source code parts in wiring.c ? The cli() does not work, comment the code in wiring.c.

  I've try again my code and your screen shots look's like interrupts problem.

  
127  Forum 2005-2010 (read only) / Exhibition / Re: Paint on the TV screen with Arduino on: April 21, 2007, 08:10:15 am
Hello,

First Erik : the post http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1166667354/11#11 does not acheive a high res the picture is not an ouput of an Arduino board. I'm actually try to make an higher stable picture using an interup an then i'll try higher res.

Second Zitron : I's difficult to me to help you at distance. Yes, you can adjust timing with number of black lines but normaly you don't have to. This progam is an experimentation and it work on my old monitor, maybe timing is different on yours. But in all case you have to disable interrupts. If the timming is not good enough for your tv screen, you'll have to adjust all the delays smiley-sad. If you have an osciloscope use it, I don't have one smiley-sad. If I make interrupt program working all this pbs go out smiley.
128  Forum 2005-2010 (read only) / Exhibition / Re: Paint on the TV screen with Arduino on: April 20, 2007, 03:42:24 pm
Hello Zitron,

  I'm going to try it in english...

  Please, take a look at the french post for pictures and code.

  First go to this page to uderstand what king of signal we have to generate : http://www.retroleum.co.uk/PALTVtimingandvoltages.html. It was a little bit different in NTSC, you'll have to change some timings to according to the NTSC standard (google is your friend).

  The resistors made a 2 bits DAC (Digital to Analog Converter). I have choose to connect them to the digital ouputs 8 and 9.

  All the code in the loop() function genrate the composite signal according to the PAL standard. The tab memVideo[][] is used as video memory. Each byte of it represent a (big) pixel at screen ; you can video on video by putting _BLACK, _WHITE or _GRAY in a cell of these tab. it was doing by the "switch() case" wich interpret some serial input as command.

  If you want to try these code, you'll have to change the content of the file "wiring.c" which is in "\arduino-0007\lib\targets\arduino". make a copy before you change it to restore it after. The changes to mades are explainded in the "Reply #4" of the french post. The changes are made to stop the millis() and delay() interupt, so can't use them in the program.

  To test these experimentation, you can trace on screen bt using the keypad key 2 4 6 8 to move an invisible cursor, 5 to trace (print ?) and b g n to change color of the pen (b->White n->Black g->Gray). The first line is invisible and the pen is black at start.

  Ask me if you have any question

  
129  Forum 2005-2010 (read only) / Exhibition / Paint on the TV screen with Arduino on: April 17, 2007, 09:13:12 am
Hello,

  I post to the french forum an experiment to interface crt monitors with Arduino.

  

  The post is in French but you can take a look to the program if you're interested :
  http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1176757335
130  Forum 2005-2010 (read only) / Exhibition / Re: Arduino + Second Life on: April 21, 2007, 11:46:58 am
Super !
131  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Generating Composite Video on: May 25, 2007, 06:04:42 am
Hello,

  Yes, I'm thinking about soltions with external components. But, at first I want to do it the best without active components. It's a challenge with Arduino Board  smiley. I will try with some asm code include in  C code...
132  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Generating Composite Video on: May 10, 2007, 04:10:37 pm
Hello droolcup,

  Thank's for your post. I've just seen the video of your project. I have the same result with interrupt, one somme image configuration there some lines are "overshooting", it depends of the white surface on screen...

  I think I'll have to write some parts of the code in asm to be sure of timings.
133  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Generating Composite Video on: April 20, 2007, 09:22:40 am
Hello,

  I've read the post. You have the same problems smiley of timing.

  Could we try to resolve them together ? My project is working in the loop() function, everything is ok. I try do it with interupt but I don't have an oscilloscope to fine tuning synchro.
134  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Generating Composite Video on: April 20, 2007, 09:13:03 am
hello,

  I had the same idea : http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1176757335.

  Now I'm giong to read your post, I have some timming pbroblems in interruption mode...

135  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: arduino RPM meter for laser project on: July 16, 2006, 05:47:50 pm
Hello Tomas,

I've made a reply with code here : http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1152891511/0.
Pages: 1 ... 7 8 [9] 10