I am trying to set up a PIC micro to output a solid color to a VGA monitor. I've got the RGB signals hooked to PORTA:0-3 and the HSYNC to PORTB:7 and the VSYNC to PORTB:6
All I get on the screen in blackness. Any help is appreciated.
This is the diagram I tried to base my timing on:
http://www.vga-avr.narod.ru/vga_timing/vga_timing.gif
Here is my code (Running at 40Mhz):
All I get on the screen in blackness. Any help is appreciated.
This is the diagram I tried to base my timing on:
http://www.vga-avr.narod.ru/vga_timing/vga_timing.gif
Here is my code (Running at 40Mhz):
Code:
#include "p18f4685.h"
#include "delays.h"
int i;
#pragma code TheCode=0x2000
void VSync()
{
Delay1KTCYx(3);
Delay100TCYx(5);
PORTBbits.RB6 = 0;
Delay100TCYx(6);
PORTBbits.RB6 = 1;
Delay10KTCYx(1);
Delay100TCYx(2);
}
void main()
{
ADCON1bits.PCFG3 = 1;
ADCON1bits.PCFG2 = 1;
ADCON1bits.PCFG1 = 1;
ADCON1bits.PCFG0 = 1;
TRISA = 0x00;
TRISB = 0x00;
PORTA = 0x00;
PORTB = 0x00;
PORTA = 0xFF;
PORTB = 0xFF;
while(1)
{
VSync();
for(i = 0; i < 480; i++)
{
Delay100TCYx(2);
Delay10TCYx(4);
Nop();
Nop();
_asm
call HSync, 0
_endasm
}
}
_asm
HSync:
nop
nop
nop
nop
nop
nop
nop
nop
nop
bcf PORTB, 7, ACCESS
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
bsf PORTB, 7, ACCESS
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
return 0
_endasm
}
Last edited: