YOU CAN CODE!

 

With The Case Of UCanCode.net  Release The Power OF  Visual C++ !   Home Products | Purchase Support | Downloads  
View in English
View in Japanese
View in
참고
View in Français
View in Italiano
View in 中文(繁體)
Download Evaluation
Pricing & Purchase?
E-XD++Visual C++/ MFC Products
Overview
Features Tour 
Electronic Form Solution
Visualization & HMI Solution
Power system HMI Solution
CAD Drawing and Printing Solution

Bar code labeling Solution
Workflow Solution

Coal industry HMI Solution
Instrumentation Gauge Solution

Report Printing Solution
Graphical modeling Solution
GIS mapping solution

Visio graphics solution
Industrial control SCADA &HMI Solution
BPM business process Solution

Industrial monitoring Solution
Flowchart and diagramming Solution
Organization Diagram Solution

Graphic editor Source Code
UML drawing editor Source Code
Map Diagramming Solution

Architectural Graphic Drawing Solution
Request Evaluation
Purchase
VX++ Cross-Platform C/C++
Overview
Download
Purchase
ActiveX COM Products
Overview
Download
Purchase
Technical Support
  General Q & A
Discussion Board
Contact Us

Links

Get Ready to Unleash the Power of UCanCode .NET

VC++ Logical Circuit Simulator Source Code.

1

This is a simple sample to simulate basic logical circuits with VC++ Source Code (I hope I can develop this for FLIP-FLOPs too). There are all the  main gates in this program.

The list of Gates is :

  1. NOT

  2. AND

  3. OR

  4. NAND

  5. NOR

  6. XOR

  7. XNOR

  8. Simple left to right pip.

  9. Simple Up to down and down to up pip.

  10. Two way pip.

  11. After drawing your gates on the board, right click on the board for TRACE menu. Select trace to see final result . You can change your trace mode from left top dialog in two modes : 1 - Fast mode. 2 - Step By Step .

    Note : You can deleted any drawn gates by selecting delete tool from the left-side toolbox. And you can minimize/restore toolbox by clicking the pointer button on top left and button left side of toolbox.

    2

    // This is a function that select correc cursor for mouse pointer .
    BOOL CLCView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) 
    {
      m_pViewWnd=pWnd;
      
      switch (m_dToolBox.CursorValue){
      case AND:  
        lhCursor=AfxGetApp()->LoadCursor(IDC_AND);
        SetCursor(lhCursor);
        ShowFlag=TRUE;
        break;
    
      case NAND:
        lhCursor=AfxGetApp()->LoadCursor(IDC_NAND);
        SetCursor(lhCursor);
        ...........  
    } 
    
    // This a function to draw selected gates on board 
    // (after you click this gate on board)
    void CLCView::ShowBitmap(int x,int y,int kind)
    {
      CDocument* pDoc = GetDocument();
      CClientDC dc(this);
      CBitmap bitmap;
      CDC dcMemory;
      BITMAP bm;
      
      switch (kind) {
      case AND  : 
        bitmap.LoadMappedBitmap(IDB_AND,0);
        break;
    
      case NAND : 
        bitmap.LoadMappedBitmap(IDB_NAND,0);
    
    // Call main calculator function
    void CLCView::OnCalc() 
    {
      m_dToolBox.UpdateData(TRUE);
      
      if (m_dToolBox.m_rOption==0)
        FastTrace=TRUE;    
      else
        FastTrace=FALSE;    
    
      m_dToolBox.UpdateData(FALSE);
      
      Calc();
    }
    
    // This function is like a snapper grid
    boolean CLCView::Snaper(int x, int y,int kind)
    {
      x=(x/32)*32;
      y=(y/32)*32;
      
      if(ShowFlag==TRUE)
      {
        ShowBitmap(x,y,m_dToolBox.CursorValue);
        ScreenMap(x,y,m_dToolBox.CursorValue);
      }
      else
      if (kind==_DEL)
      {
        ShowBitmap(x,y,m_dToolBox.CursorValue);
      .....
      .....
      }
    ...
    }
    
    
    // This function save your drawes gates for calculate
    boolean CLCView::ScreenMap(int x, int y,int kind)
    {
      int xMem,yMem;
      
      xMem=x/32;
      yMem=y/32;
    
      switch (kind) {
      case AND  : 
        screen[xMem][yMem].Gate=AND;
        screen[xMem][yMem].SGate="AND";
        screen[xMem][yMem].Group=1;
        screen[xMem][yMem].lunched=1;
        break;
    
      case NAND : 
        screen[xMem][yMem].Gate=NAND
    ...
    ...
    // and this is calculatore of program
    void CLCView::Calc()
    {
    for (int i=0;i<32;i++)
      for (int j=0;j<24;j++)
        if (screen[i][j].lunched==1)
        {
          UpdateData(FALSE);
          switch (screen[i][j].Gate)
          {
          case AND :
            {
            switch (screen[i-1][j].Gate) 
            {
            case DLR :
              screen[i][j].inValue1=screen[i-1][j].outValue1;
    ...........
    .............
    ..............
    }
    
    

Contact UCanCode Software

To buy the source code or learn more about with:

 

VC++ Logical Circuit Source Codes

Ask any questions by MSN: ucancode@hotmail.com Yahoo: ucan_code@yahoo.com


 

Copyright ?1998-2023 UCanCode.Net Software , all rights reserved.
Other product and company names herein may be the trademarks of their respective owners.

Please direct your questions or comments to webmaster@ucancode.net