1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Hi there I need a bit of help to write a C program!

Discussion in 'C' started by Bolshoy, Mar 23, 2006.

  1. Bolshoy

    Bolshoy New Member

    Joined:
    Mar 22, 2006
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi there,
    Given below is the program given to transfer a bit from one 68000 to another 68000 in C.

    Code:
    // PIT registers 
    char *PACRPTR 	= 0x80000D;
    char *PADDRPTR 	= 0x800005;
    char *PBCRPTR 	= 0x80000F;
    char *PBDDRPTR 	= 0x800007;
    char *PBDRPTR 	= 0x800013;
    char *PADRPTR	= 0x800011;
    char *PCDDRPTR 	= 0x800009;
    char *PCDRPTR	= 0x800019;
    
    #define PACR (*PACRPTR)
    #define PADDR (*PADDRPTR)
    #define PADR (*PADRPTR)
    #define PBDDR (*PBDDRPTR)
    #define PBDR (*PBDRPTR)
    #define PBCR (*PBCRPTR)
    #define PCDDR (*PCDDRPTR)
    #define PCDR (*PCDRPTR)
    
    unsigned long int header, char temp_head[]={0x01, 0x02, 0x03, 0x04}; 
    main()
    {
    	
    	char data_rcvd, char ack, char temp, int n=1;
    	
    	// configure the PIT to work with the Buffered IO Board.
    	PACR = 0x80;
    	PADDR = 0x0;
    	PBCR = 0x80;
    	PCDDR = 0x0f;
    	PBDDR = 0xff;
    	
    	while(1)
    	{
    		temp = PCDR;    //For PC4  
    		PCDR = PCDR&0x10;
    		ack = 0x00;     //To reset ack to lo
    		
    		while(n<4)
    		{
    			while(PCDR==0x00) 
    			{
    				PCDR = PCDR&0x10; //To keep ack at low if no strobe is received
    			}
    			
    			// Read in the data from Port A
    			data_rcvd = PADR;
    			PBDR = PADR;
    			
    			PCDR = PCDR|0x01;// To make ack hi
    			
    			header = PBDR;
    			temp_head[n] = header;
    			header = header<<8;
    			
    			
    			while(PCDR==0x11) //To check if strobe is hi or not
    			{
    				PCDR = PCDR&0x01;  //To keep ack at Hi if no strobe is received
    			}
    			n++;
    		}			   
    	}	
    }			
    
    I need to modify the above code to share a calculation between two 68000 processors. And I need to write a probe function which will assert when calculation starts and negate when it ends. Can somebody please help me. Thanks.
     
    Last edited by a moderator: Mar 23, 2006

Share This Page