AVR Video Generation - PowerPoint PPT Presentation

1 / 11
About This Presentation
Title:

AVR Video Generation

Description:

LineCount ; //update the current scanline number. if (LineCount==248) //begin inverted ... The 0xfff8 truncates the odd line bit //ScreenTop=30, ScreenBot=230 ... – PowerPoint PPT presentation

Number of Views:114
Avg rating:3.0/5.0
Slides: 12
Provided by: JOE87
Category:

less

Transcript and Presenter's Notes

Title: AVR Video Generation


1
AVR Video Generation
  • Joe Crop

2
NTSC Composite Video Signal
3
NTSC Composite Video Signal
4
The Video Circuit
5
VH Sync
ISR(TIMER1_COMPA_vect) PORTD syncON
//start the Horizontal sync pulse LineCount
//update the current scanline number if
(LineCount248) //begin inverted (Vertical) sync
after line 247 syncON 0b00100000
syncOFF 0 if (LineCount251) //back to
regular sync after line 250 syncON 0
syncOFF 0b00100000 if (LineCount263)
//start new frame after line 262
LineCount 1 _delay_us(2.65) //extra
delay for 16MHz CPU PORTD syncOFF //end
sync pulse
6
avr/sleep.h
AVR-GCC include ltavr/sleep.hgt sleep_enable() sl
eep_CPU()
CodeVision Compiler MCUCR 0b00100000 asm
("sleep")
Other Functions //idle, power-down, ADC noise
reduction, standby... set_sleep_mode(ltmodegt)
sleep_mode() // go to sleep with selected
mode. sleep_disable() // disable sleep mode.
7
Pixel Manipulation
char screen800
Line 1 Line 2
. .
Line 100
//left-shift 3 would be individual lines



// ltlt2 means line-double the pixels



//The 0xfff8 truncates the odd line bit
//ScreenTop30, ScreenBot230



i(LineCount-ScreenTop)ltlt2 0xfff8
8
Predicting the Compiler
AVR-GCC If((v1 0b10000000) ! 0) PORTD
0x40 else PORTD 0xBF asm("nop") as
m("nop") asm("nop") asm("nop")
CodeVision Compiler PORTD.6 v1 0b10000000
PORTD.6 v1 0b01000000 PORTD.6 v1
0b00100000 PORTD.6 v1 0b00010000 PORTD.6
v1 0b00001000 PORTD.6 v1
0b00000100 PORTD.6 v1 0b00000010 PORTD.6
v1 0b00000001
What do you expect the assembly to be?
9
Predicting the Compiler
  • Unfortunately we cant trust GCC to compile this
    bit-for-bit.
  • GCC adds random bookkeeping code that ruins the
    timing.
  • Proposed Solution
  • Put video variables in registers
  • register uint8_t v1 asm(r6")
  • Write video generation code in assembly.

10
References / Sources
  • Stanford University EE281 Lab 4 "TV Paint
  • http//www.stanford.edu/class/ee281/handouts/lab4.
    pdf
  • Atmel Applications Journal AVR video generator
    with an AVR Mega163
  • http//www.atmel.com/dyn/resources/prod_documents/
    mega163_3_04.pdf
  • Cornell University EE476 "Video Generation with
    AVR Microntrollers
  • http//instruct1.cit.cornell.edu/courses/ee476/vid
    eo/index.html

11
Demonstration
  • My Version of Wii Fit
Write a Comment
User Comments (0)
About PowerShow.com