PC to FPGA Data transfer

Discussion in 'Programmer's Corner' started by ignite, Feb 6, 2008.

  1. ignite

    Thread Starter Member

    Jan 31, 2008

    I have written some code to send 48 binary data bits to a FPGA. This data then must be encoded using AMI line encoding but im having trouble running the C++ program. Its a win32 console application. It has been written using microsoft visual studio pro 2005. Please take a look at my code and and suggestions would be greatly appreciated since im new to C++ programming.

    #include <cstdio>
    #include <cstdlib>
    #include <iostream>

    using namespace std;

    #include "Serial.h"

    int main( void )
    char word[48];
    longint bin;

    bin = strtol(word, NULL,2);

    Serial myport;
    cout( "Beginning serial communications with FPGA.\n\n" );


    cout( "Begining data Exchange.\n" );
    myport.ExchangeData( bin );

    cout( "Beginning Write.\n" );
    myport.WriteData( bin );

    cout( "\nPress return to Finish...\n" );

    return 0;