Pages: 1 ... 16 17 [18] 19   Go Down
Author Topic: NTSC video out library  (Read 33946 times)
0 Members and 1 Guest are viewing this topic.
United States (Texas)
Offline Offline
God Member
*****
Karma: 3
Posts: 525
Arduino socks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

added the diodes, now everything seems stable enough. i think its safe to say that the teensy port is now functional smiley

--minus the uart that is
« Last Edit: October 11, 2010, 04:03:53 pm by weirdo557 » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 2
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This is so great! I've made several games like pong. Really easy to use.
Logged

Australia
Offline Offline
Full Member
***
Karma: 7
Posts: 210
AVR Microcontrollers
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm looking to display my sudoku program.

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1287366986/2

TVout is really easy to use and the most simple solution i've seen.

I worked my through it and produced:






Using this code:

Quote
#include <TVout.h>

char sudoku[81];
const char xoff[] = {20,21,29,37,45,46,54,62,70,71,79,87,95,96};
const char yoff[] = {0,1,10,19,28,29,38,47,56,57,66,75,84,85};
const char nxoff[] = {23,31,39,48,56,64,73,81,89};
const char nyoff[] = {3,12,21,31,40,49,59,68,77};
TVout TV;

unsigned char x,y;

void setup()  
{
 x=0;
 y=0;
 TV.start_render(_PAL);
 
 for(char i = 0; i < 81; i++)
 sudoku = i%9 + 0x31; 
}

void loop()

  TV.clear_screen();
  TV.delay_frame(50);
 
  for(char i = 0; i < 14; i++)
  TV.draw_line(xoff,0,xoff,85,1);//vertical lines
  
  for(char i = 0; i < 14; i++)
  TV.draw_line(20,yoff,96,yoff,1);//horizontal lines
  
  for(char i = 0; i < 9; i++)
  {
  for(char j = 0; j < 9; j++)
  TV.print_char(nxoff,nyoff[j],sudoku[j + i*9]);//characters
  }//end of display sudoku
 
  TV.delay_frame(500);
}//end of loop





Your display buffer is global:

With 128 X 96 this uses 1536 bytes. There is not much left for program.

I cannot use my program for the sudoku solution - it needs 730 bytes of RAM.

Is it possible to have the buffer declared in a local subroutine so that:

void pause_render();

Also releases the RAM used by your new display subroutine.

void resume_render();

Would restart the subroutine and declare the buffer.

I think your TVout is a really significant contribution
to the Arduino community.


Logged

Michigan, US
Offline Offline
Full Member
***
Karma: 3
Posts: 148
Go Huskies
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I would suggest dropping the resolution and using the 4x6 font.

I have removed pause and resume from the later releases and am going to add an end function that will clean it up and do what you want.

De allocating and re allocating would get very distracting as tvs don't lock onto the signal again very fast(from my experience).
Logged

Australia
Offline Offline
Full Member
***
Karma: 7
Posts: 210
AVR Microcontrollers
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I get your idea of the smaller font. I'll have a go.

Keep up your good work it's much appreciated.

Cheers.
Logged

0
Offline Offline
Edison Member
*
Karma: 16
Posts: 1579
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
First of all.... congratulations for the lib!!

I´ve tested it, and it has worked fine. I have a doubt... is there a generic function to show a bitmap?
I´ve modified the bitmap.h using Image2Code and it has worked but it would be great have a generic function to add all you want.
( I´ve used TVout_R5.91 )

Thank you  smiley-wink


Igor R.
« Last Edit: November 28, 2010, 05:44:43 pm by igorreal » Logged


Boston Suburbs
Offline Offline
God Member
*****
Karma: 16
Posts: 955
I am above your silly so-called "Laws", Mister Ohm.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Igor, I'm a huge fan of the lib- and to answer your question, I believe there is an updated version of the bitmap function, however it is not in the version of the lib (5.91 with audio) that's there for download... I think the "current" beta revision for R6.0 (or whatever) can be compiled from the code repository.

It's got some really great improvements on an already AWESOME lib, I personally can't wait for the next Rev to hit the distro... the next rev also fixes some issues like incompatability with serial I/O which has been pesky for me and a couple of things I've wanted to do with the lib.  Since I post my projects, I'm (painfully) avoiding using any of the new code or features until the new rev is officially out there.  Coding from a modified lib... begs for problems.

New toys to play with coming... c'mon Santa, bring me a fresh lib to diddle with, and bring it early...

smiley-wink

 ALSO:

In another thread, I was discussing image processing from NTSC video input, and it ocurred to me that the reverse of this library ought to be possible- without even a sync separator chip, with two digital lines using set-point resistors (two step resistor ladder), you should be able to do monochrome video digitization-  average luma level below logic threshold yields zero, above yields one.  If using a high-contrast background to foreground, it's all just a matter of voltage level timing since the vsync pulse.  One digital input is set for the sync pulse level, and the other for the black to white threshold level.   Got any thoughts on this?
« Last Edit: November 28, 2010, 06:14:15 pm by focalist » Logged

When the testing is complete there will be... cake.

0
Offline Offline
Edison Member
*
Karma: 16
Posts: 1579
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you focalist!! I´ve just checked in the source area..... you are correct, it´s a new function:
Quote
void TVout::bitmap(uint8_t x, uint8_t y, const unsigned char * bmp,uint16_t i, uint8_t width, uint8_t lines)

[edit]
I´ve tried the new library with the bitmap fuction and it is working perfect!! I´ve downloaded from: http://nootropicdesign.com/hackvision/games.html  (Tetris game) and I´m using pin7 in stead of 8.
[/edit]


 smiley-wink

« Last Edit: November 28, 2010, 07:15:24 pm by igorreal » Logged


Michigan, US
Offline Offline
Full Member
***
Karma: 3
Posts: 148
Go Huskies
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am very very close to releasing the newer version.  I am updating the documentation prior to releasing it as it will break 99% of the sketches written for the older releases.  The reason Its taking me so long to get this out is I only want to break things once and there are some fundamental changes that just kept pilling up.

The release will be a 1.0 beta and it will achieve 1.0 when some stuff on the backend gets fixed, I don't foresee any additional functionality being added after I release the beta.

Time permitting I would like to get this out this week. Honestly I am shooting for tonight but I doubt that will happen.
Logged

Boston Suburbs
Offline Offline
God Member
*****
Karma: 16
Posts: 955
I am above your silly so-called "Laws", Mister Ohm.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Well, I for one have to give a huge round of applause for the lib.  LED's are great, but that takes a ton of wiring.  LCD's aren't much better.  The ability to use a TV as an output device- something that all of us have already, no investment required- is just so dang useful for small-scale stuff that it's amazing.  It's an eye-grabber on a big-screen TV, and also PERFECT for using with portable LCD screens.. if you have kids, you probably have a portable DVD player.. and most have a video-in connection.  After the kids smear a peanut butter sandwich into the optics and mechanics of the DVD drive, the screen still works GREAT as a monitor, with it's own rechargable battery pack (which can also power the Arduino!).

Bravo!
Logged

When the testing is complete there will be... cake.

Michigan, US
Offline Offline
Full Member
***
Karma: 3
Posts: 148
Go Huskies
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have uploaded a zip of beta1.0 for TVout there have been many many additions, also there where a few changes that break current sketches see: http://code.google.com/p/arduino-tvout/wiki/Update for complete details. The video pin was also changed to pin7(m328 arduinos mega is on a7) to revert this change if you have created custom hardware comment out this line in hardware_setup.h #define ENABLE_FAST_OUTPUT, however doing so will not allow for the newer higher resolution methods.

  • Revamped font engine to use less flash memory. select_font() must be called see wiki for details.
  • Full print system for all data types, no more print_str instead use print().
  • rewrote draw_circle faster uses different arguments.
  • removed draw_box replaced with draw_rect faster easier.
  • added draw_row very fast horizontal line drawing.
  • added draw_column very fast column drawing.
  • added force functions for startline outputdelay and vertical scale.
  • remove fs_bitmap and replaced with general bitmap function.
  • added shift function to move screen in any direction.
  • delay now takes ms delays, delay_frames still takes frames.
  • millis replacement returns ms since begin was called.
  • added 4 and 3 cycle render routines for horizontal resolutions of up to 256.
  • added vertical and horizontal blanking hook functions for automatic polling.
  • added end function to clean up system.
  • started lowering memory footprint

There is also a polling serial library in this release.  I have not documented it however once setup it works just like the standard hardware serial.  Look at the example to see how to use it.
Logged

Boston Suburbs
Offline Offline
God Member
*****
Karma: 16
Posts: 955
I am above your silly so-called "Laws", Mister Ohm.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

 smiley-grin  

New toys, and it's not even Christmas yet!  Those linedrawing routines are about to get a test, should drastically speed up the update rate on the video spectrum analyzer jobbie.  There's a whole slew of projects I'm going to base off this, being chomping at the bit for the new release.  Please let me be the first to congratulate and commend you for bringing the new rev to fruition!

Bravo!  I really find the lib to be one of the most useful I've ever encountered-  great stuff.
« Last Edit: December 03, 2010, 11:02:24 am by focalist » Logged

When the testing is complete there will be... cake.

Michigan, US
Offline Offline
Full Member
***
Karma: 3
Posts: 148
Go Huskies
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

actually draw_line will use the faster methods when it can.
Logged

Michigan, US
Offline Offline
Full Member
***
Karma: 3
Posts: 148
Go Huskies
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Also for your spectrum analyzer i would try to write a fast poll system to be called once per scanline via set_hbi_hook().
Logged

Boston Suburbs
Offline Offline
God Member
*****
Karma: 16
Posts: 955
I am above your silly so-called "Laws", Mister Ohm.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Heh... small problem with your release: you forgot to include the fonts directory- the files (as used in DemoNTSC) of the fonts as well as fontAll.h must be in the main tvout library directory.  Without them the compile fails... they'll need to be included or the lib's not going to work

When I copied the files (.cpp & .h) from the source respository it compiled fine.  Looks like you just forgot to move them into the .zip of the lib... you'll probably have it done by the time you get the msg smiley-wink

Swapped the resistor over to pin 7, perfect.. looks awesome.  3d cube rotation.. cute!  Now to port over my own stuff and see what new things I ought not to do, but will do anyway..
« Last Edit: December 03, 2010, 12:17:13 pm by focalist » Logged

When the testing is complete there will be... cake.

Pages: 1 ... 16 17 [18] 19   Go Up
Jump to: