Go Down

Topic: NTSC video out library (Read 38620 times) previous topic - next topic

weirdo557

#255
Oct 11, 2010, 11:00 pm Last Edit: Oct 11, 2010, 11:03 pm by weirdo557 Reason: 1
added the diodes, now everything seems stable enough. i think its safe to say that the teensy port is now functional :)

--minus the uart that is

thatcherc

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

carl47

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.



mdmetzle

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).

carl47

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

Keep up your good work it's much appreciated.

Cheers.

Igor R

#260
Nov 28, 2010, 11:42 pm Last Edit: Nov 28, 2010, 11:44 pm by igorreal Reason: 1
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  ;)


Igor R.

focalist

#261
Nov 28, 2010, 11:52 pm Last Edit: Nov 29, 2010, 12:14 am by focalist Reason: 1
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...

;)

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?
When the testing is complete there will be... cake.

Igor R

#262
Nov 29, 2010, 12:03 am Last Edit: Nov 29, 2010, 01:15 am by igorreal Reason: 1
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]


;)


mdmetzle

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.

focalist

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!
When the testing is complete there will be... cake.

mdmetzle

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.

focalist

#266
Dec 03, 2010, 05:01 pm Last Edit: Dec 03, 2010, 05:02 pm by focalist Reason: 1
:D  

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.
When the testing is complete there will be... cake.

mdmetzle

actually draw_line will use the faster methods when it can.

mdmetzle

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

focalist

#269
Dec 03, 2010, 05:50 pm Last Edit: Dec 03, 2010, 06:17 pm by focalist Reason: 1
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 ;)

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..
When the testing is complete there will be... cake.

Go Up