Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Hi there I need a bit of help to write a C program! (http://www.go4expert.com/forums/hi-i-bit-help-write-c-program-t657/)

Bolshoy 23Mar2006 05:34

Hi there I need a bit of help to write a C program!
 
Hi there,
Given below is the program given to transfer a bit from one 68000 to another 68000 in C.

Code: C

// 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.


All times are GMT +5.5. The time now is 10:55.