i thought id make myself some king of glitch generator i could use for VJing. so i started today and spent the day trying to get an image (any image). luckily i have a cheap VGA to composite converter, which is really forgiving with the timings, so even with my naive approach i was able to get something. the problem is there is tons of jitter.
i compared this output to signals generated with my computer on my scope. and the timings are not that much off, apart from the jitter. does anyone have any idea how i could get rid of it?
or what would be the correct approach to get this done...
i compared this output to signals generated with my computer on my scope. and the timings are not that much off, apart from the jitter. does anyone have any idea how i could get rid of it?
or what would be the correct approach to get this done...
Code:
#define RED 0
#define GREEN 1
#define BLUE 2
#define HSYNC 3
#define VSYNC 4
IntervalTimer line;
int lineCount=0; //making this volatile causes a periodic glitch
void setup() {
// put your setup code here, to run once:
pinMode(RED,OUTPUT);
pinMode(GREEN,OUTPUT);
pinMode(BLUE,OUTPUT);
pinMode(HSYNC,OUTPUT);
pinMode(VSYNC,OUTPUT);
line.begin(vgaLine,26.4f);
//line.beginCycles(vgaLine,1267); //i made this function public in my investigations...
}
void loop() {
}
void vgaLine()
{
int kaka;
boolean vBlank;
if(lineCount<29)vBlank=true;
else vBlank=false;
lineCount++;
kaka=0;
while(kaka<130)
{
kaka++;
if(!vBlank)digitalWriteFast(RED,HIGH);
if(!vBlank)digitalWriteFast(RED,LOW);
}
while(kaka<160)kaka++;
if(lineCount>=628)lineCount=0;
digitalWriteFast(HSYNC,HIGH);
// kaka=0;
if(lineCount>1&&lineCount<6)
{
digitalWriteFast(VSYNC,HIGH);
}
else
digitalWriteFast(VSYNC,LOW);
kaka=0;
while(kaka<69)kaka++;
digitalWriteFast(HSYNC,LOW);
kaka=0;
//while(kaka<20)kaka++;//38
}