I've been thinking about sync detect without using an external sync separator. Doesn't seem to be much on the web about doing that with a microcontroller... ...but it also seems to me like it ought to be very possible. Referring to http://www.sxlist.com/techref/io/video/ntsc.htm if we add a check for a sync pulse in the character loop of the code below, so that it will pick up the sync pulse on the half scan line for even fields, and count scan lines so we know when to stop on the odd fields, we can enter a vertical refresh detection loop that counts the width and number of the pulses... We just need to look for 5 more fast (double the hsync rate) narrow pulses, then 6 fast wide pulses, then 6 fast narrow pulses. If we are counting narrow pulses and we see a wide pulse, then we resync to the wide pulse loop. If we see hsync rate pulses, we have missed the vertical sync and have to wait for the next one. If we match up with the entire vertical sync pattern and then miss one fast pulse, we are on an even field, otherwise we are starting an odd field. Doesn't it seem like that could pretty easily be turned into code? http://www.sxlist.com/techref/scenix/contest/video.htm --- James Newton 1-619-652-0593 mailto:jamesnewton@sxlist.com SX FAQ: http://www.sxlist.com -----Original Message----- From: James Newton [mailto:jamesnewton@piclist.com] Sent: Friday, December 01, 2000 10:09 To: sxtech@egroups.com; Pic Microcontroller Discussion List Cc: Bob Ammerman; Nikolai Golovchenko Subject: RE: [sx]: SCENIX VIDEO VIRTUAL PERIPHERAL Design Challenge and Contest This (TOTALLY UNTESTED OF THE TOP OF MY HEAD) code uses RA as the (4 bit) shift register so that only 3 IO lines are wasted. RA.0 is the video out pin. It assumes a 7 x (ScanLines / Rows) character size with each character pixel row stored in the lower byte of a 12 bit program memory word and that there are 256 characters (a kind of a waste but that could be fixed). It assumes that the SX's built in hardware comparitor is being used as a Horizontal Sync detector for an external source of video which is being overlaid with text. ;code for generating a frame of character video using the ;Ubicom (Scenix) SX 18 or 28. See ;http://www.sxlist.com/techref/scenix/contest/video.htm mov RowCout, #Rows :RowLoop mov RowScanLine, #(ScanLines/Rows) ;if you wanted to, you could skip a line of video here (between ;rows) and use the time to load a row of character data from ;external RAM or FRAM ;http://www.sxlist.com/techref/mem/srams.htm :ScanLineLoop jnb HorzSync, $ ;wait for the Horizontal sync. mov ColCount, #Cols mov w, ScanLine ;high pointer into the character generator table mov m, w ;(which character pixel row) mov w, ind ;low pointer into the table (which character) iread :CharScanLoop mov ra, w mov DataHi, W rr ra inc fsr rr ra setb fsr.4 rr ra mov w, <>DataHi mov ra, w mov w, ind rr ra iread rr ra dec ColCount rr ra jnz :CharScanLoop ;And extra cycle or 2 here just spaces the characters a bit more. djnz RowScanLine, :ScanLineLoop djnz RowCount, :RowLoop ;each entry in the character generator table needs to have bits 8..11 (the ;top 4 bits of the 12 bit word) set to the top 4 bits of the address of ;that word so that when M is loaded by the IREAD, its value is retained. ;http://www.sxlist.com/techref/datafile/charsets.htm Well? Does that help? Any comments? Anyone playing with it? --- James Newton 1-619-652-0593 mailto:jamesnewton@sxlist.com SX FAQ: http://www.sxlist.com -----Original Message----- From: pic microcontroller discussion list [mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of James Newton Sent: Friday, December 01, 2000 07:32 To: PICLIST@MITVMA.MIT.EDU Subject: Re: [sx]: SCENIX VIDEO VIRTUAL PERIPHERAL Design Challenge and Contest Importance: Low I believe your analysis is specific to graphic (pixel) data from RAM rather than character pixel data from program memory with the character selected by RAM data and that you have not taken into account the SX's IREAD instruction... http://www.sxlist.com/techref/scenix/inst.htm http://www.sxlist.com/techref/scenix/usersmanual/gohtm/result_86.html which does a one cycle lookup of a memory location any where in program memory (character data) addressed by the combination of the mode register and W and returns a 12 bit result in mode and W. I have a chunk of code written (untested) that will put out a pixel from a character table every other instruction with an extra pixel separation (black) between each character. Any takers? I'll post it tomorrow. James Newton jamesnewton@sxlist.com 1-619-652-0593 phone http://www.sxlist.com ----- Original Message ----- From: Bob Ammerman To: Sent: Thursday, November 30, 2000 16:01 Subject: Re: [sx]: SCENIX VIDEO VIRTUAL PERIPHERAL Design Challenge and Contest ----- Original Message ----- From: Russell McMahon To: Sent: Thursday, November 30, 2000 4:14 PM Subject: Re: [sx]: SCENIX VIDEO VIRTUAL PERIPHERAL Design Challenge and Contest > >Sure would be nice to have a built in USART to shift out the dots. That is > >how my PIC18C manages to get 432 H x 240 V pixels on the screen, including > >animated graphics. > > > And how does that compare with the likely software only Scenix performance > using software alone I wonder? > Imagine using a scheme where you store 8 pixels in a PORT register, and feed the MSBit to the outputs. Now you could have code that looks like this: movwf PORTx ; output msbit i1 i2 i3 rlf PORTx,F ; move to next bit i1 i2 i3 rlf PORTx,F ; move to next bit i1 i2 i3 where 'i1', 'i2' and 'i3' are instructions that are getting the next byte of pixels ready to send. Note that this gives you 24 instructions to prepare each byte, but they have to be in little groups of 3. I would imagine you'd need at least these 4 instructions per pixel to manage anything reasonable. It would be hard to do anything conditional in fewer cycles. So: PIC = 8 instructions for 8 pixels and SX = 32 instructions for 8 pixels Thus for equivalent resolution the SX would need four times the MIPS as the PIC. My PIC does 10MIPS, so an SX at 40MIPS should be able to manage it. However, it would be _very_ tricky coding! Going to 50MIPs on the SX and 5 instructions per bit might help a lot. Bob Ammerman RAm Systems (contract development of high performance, high function, low-level software) -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details. Egroups help: http://www.egroups.com/info/help/main.html Parallax SX tech support: (916) 624-8333 -or- mailto:sxtech@parallaxinc.com -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body