Circuit Negma

C++, C, VB.NET, PCB, Electronics, Circuit Design

Archive for March, 2009

TCPIP Project Configurations :: Microchip Stack V4.55

Posted by Circuit Negma on March 30, 2009


Created By: Hussein Nosair

TCPIP-Demo3-20-2009-9.32.15 AM by you.

TCPIP-Demo3-20-2009-9.32.28 AM by you.

TCPIP-Demo3-20-2009-9.32.22 AM by you.

TCPIP-Demo3-20-2009-9.33.05 AM by you.

TCPIP-Demo3-20-2009-9.33.17 AM by you.

TCPIP-Demo3-20-2009-9.33.29 AM by you.

TCPIP-Demo3-20-2009-9.33.33 AM by you.

TCPIP-Demo3-20-2009-9.33.35 AM by you.

TCPIP-Demo3-20-2009-9.33.37 AM by you.

TCPIP-Demo3-20-2009-9.33.42 AM by you.

TCPIP-Demo3-20-2009-9.33.45 AM by you.

TCPIP-Demo3-20-2009-9.33.48 AM by you.

TCPIP-Demo3-20-2009-9.33.53 AM by you.

TCPIP-Demo3-20-2009-9.33.57 AM by you.

NOTE:: For the Above picture, set count 1 to 0. you do not need the default TCP Socket configuration since you already did that for the Generic TCP Client and Server.

TCPIP-Demo3-20-2009-9.34.01 AM by you.

TCPIP-Demo3-20-2009-9.34.03 AM by you.

TCPIP-Demo3-20-2009-9.34.13 AM by you.

NOTE:: For My project, I do not need the UDP. unfortunately, the wizard would not let you dump UDP. thus Set Maximum UDP Socket to 1 and in the code we will eliminated it.

TCPIP-Demo3-20-2009-9.34.18 AM by you.

Posted in Electronics, Microchip PIC | Leave a Comment »

Global Variables :: Revisited

Posted by Circuit Negma on March 30, 2009


Created By: Hussein Nosair

Click on the image to download the Global Variables Project.

Also, refer to the following post {Extract Files from Pictures} on how to extract the zip file from the image.

global-variables by you.

Main.c File

   1: /*********************************************************************
   2:  *
   3:  *                  Main Program
   4:  *
   5:  *********************************************************************
   6:  * FileName:        main.c
   7:  * Dependencies:    None
   8:  * Processor:       Intel
   9:  * Compiler:        Mingw
  10:  * Project:         Global Variables
  11:  * Software:        Dev-C++ 4.9.9.2
  12:  *
  13:  *
  14:  * Created By:      Hussein Nosair
  15:  * Date:            03/30/2009
  16:  * 
  17:  *********************************************************************
  18:  * File Description:
  19:  *                     This project will demoenstrate the use of global
  20:                         variables and definitions
  21:  * Change History:
  22:  *  Rev   Date         Description
  23:  *  1.0   03/30/09     Project Created
  24:  ********************************************************************/
  25:  
  26: #include <stdio.h>
  27: #include <stdlib.h>
  28:  
  29: /****** NOTE ::
  30:         Must include the Global variabls header file in the main program
  31: *******/
  32: #include "GlobalVariables.h"     // Include defined variables and functions
  33:  
  34:  
  35: /************** Local Global Functions Definitions *************************
  36: * The following is a local global functions to the main program. This means
  37: * that any part of the code in main.c can call those 2 functions. However, this
  38: * would not work with you if you try to call those 2 functions from GlobalVariables.c
  39: * file or else where.
  40: ****************************************************************************/
  41: void func3(void);               // Define Local function
  42: void func4(void);               // Define Local function
  43:  
  44:  
  45: int main(int argc, char *argv[])
  46: {
  47:     printf("i = %d \n", i);     // Print out initial value of i
  48:     printf("n = %d \n", n);     // Print out initial value of n
  49:  
  50:     i = 8;                      // Set a new value for i
  51:     printf("i = %d \n", i);     // Print out the new value of i
  52:  
  53:     n = 4;                      // Set a new value for n
  54:     printf("n = %d \n", n);     // Print out the new value of n
  55:  
  56:     func1();                    // Call global function = function 1 
  57:     func2();                    // Call global function = function 2
  58:  
  59:     for(i=0; i<6; i++)          // Print out global Array
  60:         printf("%d", Array[i]);
  61:  
  62:     // Print out blank lines
  63:     printf("\n");
  64:     printf("\n");
  65:  
  66:     func3();                   // Call local function = function 3
  67:  
  68:     // Print out blank lines
  69:     printf("\n");
  70:     printf("\n");
  71:  
  72:     func4();                   // Call local function = function 4
  73:  
  74:   system("PAUSE");    
  75:   return 0;
  76: }
  77:  
  78: /****************** Local Global Functions Initialization *****************
  79: * The following is initialization of the local global functions in main.c
  80: * file. Please, note that you can not initialize the local global functions
  81: * somewhere eles other than main.c file.
  82: ***************************************************************************/
  83: // Definition of local global function 3
  84: void func3(void)
  85: {
  86:      printf("This is ... Function 3 \n");
  87:      printf("Please, Enter a new value for variable i = ");
  88:      scanf("%d", &i);
  89:      printf("The new value for variable i = %d \n", i);
  90: }
  91:  
  92: // Definition of local global function 4
  93: void func4(void)
  94: {
  95:      printf("This is ... Function 4 \n");
  96:      for(i=0; i<6; i++)
  97:      {
  98:           printf("Please, Enter a new value for variable Array[%d] = ", i);
  99:           scanf("%d", &Array[i]);
 100:      }
 101:  
 102:     // Print out blank lines
 103:     printf("\n");
 104:     printf("\n");
 105:  
 106:      for(i=0; i<6; i++)
 107:         printf("a new value for variable Array[%d] = %d \n", i, Array[i]);
 108: }

 

Global Variables.h File

   1: /*********************************************************************
   2:  *
   3:  *                  Global Variables Definitions
   4:  *
   5:  *********************************************************************
   6:  * FileName:        GlobalVariables.h
   7:  * Dependencies:    None
   8:  * Processor:       Intel
   9:  * Compiler:        Mingw
  10:  * Project:         Global Variables
  11:  *
  12:  * Created By:      Hussein Nosair
  13:  * Date:            03/30/2009
  14:  * 
  15:  *********************************************************************
  16:  * File Description:
  17:  *                     This project will demoenstrate the use of global
  18:                         variables and definitions
  19:  * Change History:
  20:  *  Rev   Date         Description
  21:  *  1.0   03/30/09     Project Created
  22:  ********************************************************************/
  23:  
  24: #ifndef __GLOBAL_VARIABLES_H_
  25: #define __GLOBAL_VARIABLES_H_
  26:  
  27:  
  28: #ifndef NULL
  29: #define NULL    0
  30: #endif
  31:  
  32:  
  33: typedef unsigned char        BYTE;                // 8-bit unsigned
  34: typedef unsigned short int    WORD;                // 16-bit unsigned
  35:  
  36:  
  37:  
  38: /************** Global Global Variables Definitions *************************
  39: * The following is a global global variables to the Project. This means
  40: * that any part/any file within the project can call these variables.
  41: ****************************************************************************/
  42: extern int i;
  43: extern int n;
  44: extern BYTE Array[];
  45:  
  46:  
  47:  
  48: /************** Global Global Functions Definitions *************************
  49: * The following is a global global functions to the Project. This means
  50: * that any part/any file within the project can call those 2 functions.
  51: ****************************************************************************/
  52: extern void func1();
  53: extern int func2();
  54:  
  55:  
  56: #endif

 

Global Variables.c File

   1: /*********************************************************************
   2:  *
   3:  *                  Global Variables Declaration
   4:  *
   5:  *********************************************************************
   6:  * FileName:        GlobalVariables.c
   7:  * Dependencies:    None
   8:  * Processor:       Intel
   9:  * Compiler:        Mingw
  10:  * Project:         Global Variables
  11:  *
  12:  * Created By:      Hussein Nosair
  13:  * Date:            03/30/2009
  14:  * 
  15:  *********************************************************************
  16:  * File Description:
  17:  *                     This project will demoenstrate the use of global
  18:                         variables and definitions
  19:  * Change History:
  20:  *  Rev   Date         Description
  21:  *  1.0   03/30/09     Project Created
  22:  ********************************************************************/
  23:  
  24:  
  25:  
  26: /************* Functions and Variables Definition Library *************
  27: * This Section of the code associate GlobalVariables.c File with the 
  28: * header file GlobalVariables.h {library}. If you do not include the 
  29: * appropriate header/library file, then either you need to define the 
  30: * functions and variables here in this file or the compiler will complain
  31: * about the functions and variables.
  32: ***********************************************************************/
  33: #include "GlobalVariables.h"
  34:  
  35:  
  36:  
  37:  
  38: /************** Initializing Variables *************************/
  39: int i = 0;                       // Define i and initialize
  40: int n = 0;                       // Define n and initialize
  41: BYTE Array[6] = {1,2,3,4,5,6};   // Define Array and initialize
  42:  
  43:  
  44:  
  45:  
  46: /****************** Global Global Functions Initialization *****************
  47: * The following is initialization of the global global functions in Project
  48: * Please, note that you can not initialize the global global functions
  49: * somewhere eles other than GlobalVariables.h and GlobalVariables.c,; However
  50: * it is recommended that you initialize the functions within the GlobalVariables.c
  51: * file to maintain tidiness and proper documentaion 
  52: ***************************************************************************/
  53: // Initialize func1
  54: void func1(void)
  55: {
  56:     printf("This is ... function 1 \n");
  57: }
  58:  
  59: // Initialize func2
  60: int func2(void)
  61: {
  62:     printf("This is ... function 2 \n");
  63:     return 0;
  64: }

Posted in C Programming | Leave a Comment »

Extract Files embedded in Pictures

Posted by Circuit Negma on March 23, 2009


Create By: Hussein Nosair

1. Go to the following website < WinRAR > to download winrar.

extract-3-23-2009-8.40.47 AM by you.

2. Click on Download Now

extract-3-23-2009-8.41.21 AM by you.

3. Click Save File to save WinRAR to you local hard drive

extract-3-23-2009-8.41.52 AM by you.

4. Install WinRAR by double clicking on the saved file from the previous step and follow the instructions on screen.

5. Browse/locate The image in question

extract-3-23-2009-8.42.54 AM by you.

6. Click on the image to go to the original image file.

7. Right click on the image and Save it to  your local hard drive

extract-3-23-2009-8.43.18 AM by you.

8. Launch WinRAR

9. Click FILE > OPEN ACRCHIVE

extract-3-23-2009-8.45.54 AM by you.

10. Locate the Saved image from the previous steps.

11. By Default the software is set to show only archived files such as zip files and rar files. To be able to see the image file, you need to change the settings from Files of type drop list

12. Click on the Image file and then click OPEN

13. Winrar should open the file without any troubles or complains about the file.

14. Click on the folder and drag it out side of the  WinRAR software to your desktop to extract the folder to your desktop.

15. Double click on the extracted folder on your desktop to open the folder and navigate through the folder to see the files.

Posted in Uncategorized | 2 Comments »