Code Monkey home page Code Monkey logo

vgarender's Introduction

VGA signal generation with PIC24FJ256GA705

This project is dedicated to use the PIC24FJ256GA705 microcontroller for the generation of a VGA video signal.

Structure

The repository is structured as follows:

  • src: Contains all the source code for the microcontroller.
  • nbproject: Contains all the MPLABX project. That includes all the Makefiles and IDE configuration as well as all the environmental variables definition.
  • PCB_Design/VGA_adapter: Contains the schematics and PCB design for the VGA Adaptor to be plug in the PIC24F Curiosity Board.
  • dithering: Contains the python scripts that have been used for this project to generate and adapt images to be used in the microcontroller.

Releases

VGA Render Project v0.2

Installing and compilation

This project has been created using MPLABX X IDE from Microchip. To compile the project and flash it into the PIC24F Curiosity Board, download nbproject and src into the same folder. Then MPLAB X IDE will detect this as a MPLAB project and set it as an active project. From there, there is two configurations available:

  • PIC24FJ256GA705_SIM: This is the configuration for the simulation of the project. It has the same setting as the configuration for the target. Use this to simulate the project in your computer without the actual hardware.
  • PIC24FJ256GA705_TARGET: This is the configuration for the target. It has been set to work with the PIC24F Curiosity Board, that is, for the use of PKOB Starter Kit Debugger. You can use another flasher or debugger to work with. This is the one that I have used.

Specifications

The system aims to generate a VGA video signal but the microcontroller used can only be set to run at 16 MIPS (32 MHz). With that limitation on mind, the system has the following specifications:

  • 150 x 96 pixel resolution
  • 3-bit RGB palette
  • Only ~8% of CPU time available, as the rest of the time is used to generate the signal.
  • Certain level of asynchronism, as the lowest frequency VGA signal is spected to have 25.175 MHz as pixel frecuency. However, this can be compensated if the TV Monitor used is modern.

In spite all these limitations, an implementation of Conway's Game of Life has been achieved. The project has the user.c and user.h files to be used by the user to define the function that he wants. Currently it implements the game Conway's Game of Life as a demonstration. However this can be changed at discretion.

Auxiliary tools

The project includes a python script with functions that can be used to generate a header file for the definition pixel C array. In order to use them the following dependencies needs to be installed:

  • Python3
  • PIL

Help can be found invoking the following command:

> python3 img_dith.py -h
usage: img_dith.py [-h] [-o O] [-width WIDTH] [-height HEIGHT] [-bits BITS]
                   [-header HEADER]
                   input

Process dithering to picture

positional arguments:
  input           input picture

optional arguments:
  -h, --help      show this help message and exit
  -o O            output picture
  -width WIDTH    width of the pic
  -height HEIGHT  heigth of the pic
  -bits BITS      bit depth of the pic
  -header HEADER  output header

Take into account that the script as is will process the image using the Flos-Steinberg dithering algorithm. In order to disable the dithering, modify the following line in img_dith.py:

# Process the image. Resize, Floyd–Steinberg dithering or Posterize
img = Image.open(in_img)
img = resize_wo_deform(img,(w,h))
#img = posterize(img, bit_depth) <-- Uncomment this line
img = fs_dithering(img,bit_depth) #<-- Comment this line

PCB VGA Adaptor

The project requires to manufacture an VGA adaptor for the PIC24F Curiosity Board. The signals are mapped as following:

uC Pin VGA Signal DB15 Pin
RA0 RED 1
RA1 GREEN 2
RA2 BLUE 3
RB7 H_SYNC 13
RB9 V_SYNC 14

For the proposed design go to the PCG_Design folder. This PCB can be plug into the PIC24F Curiosity board.

vgarender's People

Contributors

dinamicoplus avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.