VGA output from PPDB troubles
doggiedoc
Posts: 2,250
Hello everyone! I've been trying to explore VGA output and have stumbled into a problem I can't seem to figure out on my own. I suspect it's something simple but my limited experience has me befuddled.
I been playing with the Microphone-to-VGA v1.0 object on my Prop Demo Board but when I tried to adapt it to the Propeller Professional Development Board I can't seem to figure out the pin assignments.
Currently the closest I can get is a green line about 1-2 pixels wide at the very top of the monitor. I mapped the pins based on my best analysis of the Demo Board.
Here's how I have it wired on the PPDB.
I've tried replacing the Prop Dip with a new one in the event I have damaged I/O pins but still get the same thing with a new chip.
Any guidance would be greatly appreciated.
Paul
I been playing with the Microphone-to-VGA v1.0 object on my Prop Demo Board but when I tried to adapt it to the Propeller Professional Development Board I can't seem to figure out the pin assignments.
Currently the closest I can get is a green line about 1-2 pixels wide at the very top of the monitor. I mapped the pins based on my best analysis of the Demo Board.
Here's how I have it wired on the PPDB.
- P16 --> V
- P17 --> H
- P18 --> B1
- P19 --> B0
- P20 --> G1
- P21 --> G0
- P22 --> R1
- P23 --> R0
I've tried replacing the Prop Dip with a new one in the event I have damaged I/O pins but still get the same thing with a new chip.
Any guidance would be greatly appreciated.
Paul

Comments
''*************************************** ''* Microphone-to-VGA v1.0 * ''* Author: Chip Gracey * ''* Copyright (c) 2006 Parallax, Inc. * ''* See end of file for terms of use. * ''*************************************** ' This program uses the Propeller Demo Board, Rev C ' ' The microphone is digitized and the samples are displayed on a VGA monitor, just like ' an oscilloscope with triggering. ' ' This program is sloppy and not ready for prime time. I just wanted to share it now. CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 tiles = vga#xtiles * vga#ytiles tiles32 = tiles * 32 OBJ vga : "vga_512x384_bitmap" VAR long sync, pixels[tiles32] word colors[tiles], ypos[512] PUB start | i 'start vga vga.start(16, @colors, @pixels, @sync) 'init colors to cyan on black repeat i from 0 to tiles - 1 colors[i] := $3C00 'fill top line so that it gets erased by COG longfill(@pixels, $FFFFFFFF, vga#xtiles) 'implant pointers and launch assembly program into COG asm_pixels := @pixels asm_ypos := @ypos cognew(@asm_entry, 0) CON ' At 80MHz the ADC sample resolutions and rates are as follows: ' ' sample sample ' bits rate ' ---------------- ' 9 156 KHz ' 10 78 KHz ' 11 39 KHz ' 12 19.5 KHz ' 13 9.77 KHz ' 14 4.88 KHz bits = 12 'try different values from table here attenuation = 2 'try 0-4 averaging = 13 '2-power-n samples to compute average with DAT ' ' ' Assembly program ' org asm_entry mov dira,asm_dira 'make pin 8 (ADC) output movs ctra,#8 'POS W/FEEDBACK mode for CTRA movd ctra,#9 movi ctra,#%01001_000 mov frqa,#1 mov xpos,#0 mov asm_cnt,cnt 'prepare for WAITCNT loop add asm_cnt,asm_cycles :loop waitcnt asm_cnt,asm_cycles 'wait for next CNT value (timing is determinant after WAITCNT) mov asm_sample,phsa 'capture PHSA and get difference sub asm_sample,asm_old add asm_old,asm_sample add average,asm_sample 'compute average periodically so that djnz average_cnt,#:avgsame 'we can 0-justify samples mov average_cnt,average_load shr average,#averaging mov asm_justify,average mov average,#0 'reset average for next averaging :avgsame max peak_min,asm_sample 'track min and max peaks for triggering min peak_max,asm_sample djnz peak_cnt,#:pksame mov peak_cnt,peak_load mov x,peak_max 'compute min+12.5% and max-12.5% sub x,peak_min shr x,#3 mov trig_min,peak_min add trig_min,x mov trig_max,peak_max sub trig_max,x mov peak_min,bignum 'reset peak detectors mov peak_max,#0 :pksame cmp mode,#0 wz 'wait for negative trigger threshold if_z cmp asm_sample,trig_min wc if_z_and_c mov mode,#1 if_z jmp #:loop cmp mode,#1 wz 'wait for positive trigger threshold if_z cmp asm_sample,trig_max wc if_z_and_nc mov mode,#2 if_z jmp #:loop sub asm_sample,asm_justify 'justify sample to bitmap center y sar asm_sample,#attenuation 'this # controls attenuation (0=none) add asm_sample,#384 / 2 mins asm_sample,#0 maxs asm_sample,#384 - 1 mov x,xpos 'xor old pixel off shl x,#1 add x,asm_ypos rdword y,x 'get old pixel-y wrword asm_sample,x 'save new pixel-y mov x,xpos call #plot mov x,xpos 'xor new pixel on mov y,asm_sample call #plot add xpos,#1 'increment x position and mask and xpos,#$1FF wz if_z mov mode,#0 'if rollover, reset mode for trigger jmp #:loop 'wait for next sample period ' ' ' Plot ' plot mov asm_mask,#1 'compute pixel mask shl asm_mask,x shl y,#6 'compute pixel address add y,asm_pixels shr x,#5 shl x,#2 add y,x rdlong asm_data,y 'xor pixel xor asm_data,asm_mask wrlong asm_data,y plot_ret ret ' ' ' Data ' asm_cycles long |< bits - 1 'sample time asm_dira long $00000200 'output mask asm_pixels long 0 'pixel base (set at runtime) asm_ypos long 0 'y positions (set at runtime) average_cnt long 1 peak_cnt long 1 peak_load long 512 mode long 0 bignum long $FFFFFFFF average_load long |< averaging asm_justify res 1 trig_min res 1 trig_max res 1 average res 1 asm_cnt res 1 asm_old res 1 asm_sample res 1 asm_mask res 1 asm_data res 1 xpos res 1 x res 1 y res 1 peak_min res 1 peak_max res 1 {{ ┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ TERMS OF USE: MIT License │ ├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation │ │files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, │ │modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software│ │is furnished to do so, subject to the following conditions: │ │ │ │The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.│ │ │ │THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE │ │WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR │ │COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, │ │ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. │ └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ }}''******************************************** ''* VGA 512x384 2-Color Bitmap Driver v1.0 * ''* Author: Chip Gracey * ''* Copyright (c) 2006 Parallax, Inc. * ''* See end of file for terms of use. * ''******************************************** '' '' This object generates a 512x384 pixel bitmap, signaled as 1024x768 VGA. '' Each pixel is one bit, so the entire bitmap requires 512 x 384 / 32 longs, '' or 6,144 longs (24KB). Color words comprised of two byte fields provide '' unique colors for every 32x32 pixel group. These color words require 512/32 '' * 384/32 words, or 192 words. Pixel memory and color memory are arranged '' left-to-right then top-to-bottom. '' '' A sync indicator signals each time the screen is drawn (you may ignore). '' '' You must provide buffers for the colors, pixels, and sync. Once started, '' all interfacing is done via memory. To this object, all buffers are read- '' only, with the exception of the sync indicator which gets written with a '' non-0 value. You may freely write all buffers to affect screen appearance. '' CON ' 512x384 settings - signals as 1024 x 768 @ 67Hz hp = 512 'horizontal pixels vp = 384 'vertical pixels hf = 8 'horizontal front porch pixels hs = 48 'horizontal sync pixels hb = 88 'horizontal back porch pixels vf = 1 'vertical front porch lines vs = 3 'vertical sync lines vb = 28 'vertical back porch lines hn = 1 'horizontal normal sync state (0|1) vn = 1 'vertical normal sync state (0|1) pr = 35 'pixel rate in MHz at 80MHz system clock (5MHz granularity) ' Tiles xtiles = hp / 32 ytiles = vp / 32 ' H/V inactive states hv_inactive = (hn << 1 + vn) * $0101 VAR long cog PUB start(BasePin, ColorPtr, PixelPtr, SyncPtr) : okay | i, j '' Start VGA driver - starts a COG '' returns false if no COG available '' '' BasePin = VGA starting pin (0, 8, 16, 24, etc.) '' '' ColorPtr = Pointer to 192 words which define the "0" and "1" colors for '' each 32x32 pixel group. The lower byte of each word contains '' the "0" bit RGB data while the upper byte of each word contains '' the "1" bit RGB data for the associated group. The RGB '' data in each byte is arranged as %RRGGBB00 (4 levels each). '' '' color word example: %%0020_3300 = "0" = gold, "1" = blue '' '' PixelPtr = Pointer to 6,144 longs containing pixels that make up the 512 x '' 384 pixel bitmap. Longs' LSBs appear left on the screen, while '' MSBs appear right. The longs are arranged in sequence from left- '' to-right, then top-to-bottom. '' '' SyncPtr = Pointer to long which gets written with non-0 upon each screen '' refresh. May be used to time writes/scrolls, so that chopiness '' can be avoided. You must clear it each time if you want to see '' it re-trigger. 'if driver is already running, stop it stop 'implant pin settings and pointers, then launch COG reg_vcfg := $200000FF + (BasePin & %111000) << 6 i := $FF << (BasePin & %011000) j := BasePin & %100000 == 0 reg_dira := i & j reg_dirb := i & !j longmove(@color_base, @ColorPtr, 2) if (cog := cognew(@init, SyncPtr) + 1) return true PUB stop | i '' Stop VGA driver - frees a COG if cog cogstop(cog~ - 1) DAT '*********************************************** '* Assembly language VGA 2-color bitmap driver * '*********************************************** org 'set origin to $000 for start of program ' Initialization code - init I/O init mov dira,reg_dira 'set pin directions mov dirb,reg_dirb movi ctra,#%00001_101 'enable PLL in ctra (VCO runs at 4x) movi frqa,#(pr / 5) << 3 'set pixel rate mov vcfg,reg_vcfg 'set video configuration ' Main loop, display field and do invisible sync lines field mov color_ptr,color_base 'reset color pointer mov pixel_ptr,pixel_base 'reset pixel pointer mov y,#ytiles 'set y tiles :ytile mov yl,#32 'set y lines per tile :yline mov yx,#2 'set y expansion :yexpand mov x,#xtiles 'set x tiles mov vscl,vscl_pixel 'set pixel vscl :xtile rdword color,color_ptr 'get color word and color,colormask 'clear h/v bits or color,hv 'set h/v inactive states rdlong pixel,pixel_ptr 'get pixel long waitvid color,pixel 'pass colors and pixels to video add color_ptr,#2 'point to next color word add pixel_ptr,#4 'point to next pixel long djnz x,#:xtile 'another x tile? sub color_ptr,#xtiles * 2 'repoint to first colors in same line sub pixel_ptr,#xtiles * 4 'repoint to first pixels in same line mov x,#1 'do horizontal sync call #hsync djnz yx,#:yexpand 'y expand? add pixel_ptr,#xtiles * 4 'point to first pixels in next line djnz yl,#:yline 'another y line in same tile? add color_ptr,#xtiles * 2 'point to first colors in next tile djnz y,#:ytile 'another y tile? wrlong colormask,par 'visible done, write non-0 to sync mov x,#vf 'do vertical front porch lines call #blank mov x,#vs 'do vertical sync lines call #vsync mov x,#vb 'do vertical back porch lines call #vsync jmp #field 'field done, loop ' Subroutine - do blank lines vsync xor hvsync,#$101 'flip vertical sync bits blank mov vscl,hvis 'do blank pixels waitvid hvsync,#0 hsync mov vscl,#hf 'do horizontal front porch pixels waitvid hvsync,#0 mov vscl,#hs 'do horizontal sync pixels waitvid hvsync,#1 mov vscl,#hb 'do horizontal back porch pixels waitvid hvsync,#0 djnz x,#blank 'another line? hsync_ret blank_ret vsync_ret ret ' Data reg_dira long 0 'set at runtime reg_dirb long 0 'set at runtime reg_vcfg long 0 'set at runtime color_base long 0 'set at runtime (2 contiguous longs) pixel_base long 0 'set at runtime vscl_pixel long 1 << 12 + 32 '1 pixel per clock and 32 pixels per set colormask long $FCFC 'mask to isolate R,G,B bits from H,V hvis long hp 'visible pixels per scan line hv long hv_inactive '-H,-V states hvsync long hv_inactive ^ $200 '+/-H,-V states ' Uninitialized data color_ptr res 1 pixel_ptr res 1 color res 1 pixel res 1 x res 1 y res 1 yl res 1 yx res 1 {{ ┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ TERMS OF USE: MIT License │ ├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation │ │files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, │ │modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software│ │is furnished to do so, subject to the following conditions: │ │ │ │The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.│ │ │ │THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE │ │WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR │ │COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, │ │ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. │ └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ }}I don't do VGA, but I think You want to look for a PinGroup and not just one pin...:nerd:
The microphone to VGA code is just drawing a line representing the waveform coming in on the mic, and with no mic, it just draws a line across the top of the screen.
Roy is on top of it tonight. :thumb:
@tailspin - the pins listed above are correct for code written for the demo board with base_pin starting at pin 16.
Thanks!