Language: C

Untitled C (2-May @ 14:26)

Syntax Highlighted Code

  1. lalala

Plain Code

lalala

Untitled C (23-Apr @ 12:40)

Syntax Highlighted Code

  1. Ïþ0HÔËŒ‡é’l

Plain Code

Ïþ0HÔËŒ‡é’l

Untitled C (12-Mar @ 13:26)

Syntax Highlighted Code

  1. —ݐϓx”•ª•z

Plain Code

—ݐϓx”•ª•z

Untitled C (20-Jan @ 21:58)

Syntax Highlighted Code

  1. |  à  D  ¨     p  Ô  8  œ     d  È  ,    ô  X  ¼     „  è  L  °    x  Ü  @  ¤    

Plain Code

|  à  D  ¨    p  Ô  8  œ     d  È  ,    ô  X  ¼     „  è  L  °    x  Ü  @  ¤     

Untitled C (6-Dec @ 14:06)

Syntax Highlighted Code

  1. ë¯Â¿£ì1Ɉ þÁuù1Àºï¾­Î ÐÁÊŠ Š<ˆˆ< þÁuèé\‰ãÃ\X=AAAAuCX=BBBBu;Z‰Ñ‰æ‰ß)Ïó¤‰Þ‰Ñ‰ß)Ï1À1Û1ÒþÀŠŠ44ˆò0öŠŠ0ÚˆGIuÞ1Û‰ØþÀÍ€èÿÿÿAAAA

Plain Code

ë¯Â¿£ì1ɈþÁuù1Àºï¾­ÎÐÁÊŠŠ<ˆˆ<þÁuèé\‰ãÃ\X=AAAAuCX=BBBBu;Z‰Ñ‰æ‰ß)Ïó¤‰Þ‰Ñ‰ß)Ï1À1Û1ÒþÀŠŠ4ˆ4ˆò0öŠŠ0ÚˆGIuÞ1Û‰ØþÀÍ€èÿÿÿAAAA

Untitled C (6-Dec @ 08:54)

Syntax Highlighted Code

  1. 235 4   175 194 191 163 129  236   0   1   0   0   49  201 136 12
  2. 12  254 193 117 249 49  192  186   239 190 173 222 2   4   12  0
  3. 208 193 202 8   138 28  12   138   60  4   136 28  4   136 60  12
  4. 254 193 117 232 233 92  0    0     0   137 227 129 195 4   0   0
  5. [5 more lines...]

Plain Code

235 4   175 194 191 163 129  236   0   1   0   0   49  201 136 12
12  254 193 117 249 49  192  186   239 190 173 222 2   4   12  0
208 193 202 8   138 28  12   138   60  4   136 28  4   136 60  12
254 193 117 232 233 92  0    0     0   137 227 129 195 4   0   0
0   92  88  61  65  65  65   65    117 67  88  61  66  66  66  66
117 59  90  137 209 137 230  137   223 41  207 243 164 137 222 137
209 137 223 41  207 49  192  49    219 49  210 254 192 2   28  6
138 20  6   138 52  30  136  52    6   136 20  30  0   242 48  246
138 28  22  138 23  48  218  136   23  71  73  117 222 49  219 137
216 254 192 205 128 144 144  232   157 255 255 255 65  65  65  65

Untitled C (30-Nov @ 23:09)

Syntax Highlighted Code

  1. Î 7                          ÿ ÿ    Cç Ž¯*N¯*        E¯*e¯* Ö      µ             ÎÐÒÂUM+!   µWÖ      È¯*a¯*f¯*o¯*y¯*†¯*¯*–¯*Ÿ¯*¥¯*«¯*±¯*·¯*½¯*ï*ɯ*ϯ*Õ¯*ܯ*ã¯*ê¯*ñ¯*ø¯*ÿ¯*¯*
  2. ¯*¯*¯*"¯*)¯*0¯*7¯*>¯*S:\QUOTEE~1\QSERVER\PASS.DB                                                    Name Password Lastlogin Lastcomputer Realname Attrib Security misc1 misc2 misc3 misc4 misc5 misc6 misc7 misc8 misc9 misc10 misc11 misc12 misc13 misc14 misc15 misc16 misc17 misc18 misc19 misc20 misc21 misc22 misc23 misc24 misc25                
  3.                   ascii                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ÿ½„’õL¿ÒÇ’¥k
  4. [295 more lines...]

Plain Code

Untitled C (20-Aug @ 02:33)

Syntax Highlighted Code

  1. #include<stdio.h>
  2. #include<conio.h>
  3. void main()
  4. {
  5. [3 more lines...]

Plain Code

#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
printf("mayur");
getch();
}

Untitled C (29-Mar @ 00:36)

Syntax Highlighted Code

  1. int main()
  2. {
  3.  
  4. {

Plain Code

int main()
{

{

Untitled C (24-Mar @ 19:51)

Syntax Highlighted Code

  1. int main ()
  2. {
  3. printf "bb"
  4. }

Plain Code

int main ()
{
printf "bb"
}

Untitled C (22-Feb @ 22:15)

Syntax Highlighted Code

  1. #include <stdio.h>
  2. #include <stdlib.h>

Plain Code

#include <stdio.h>
#include <stdlib.h>

Untitled C (1-Feb @ 13:54)

Syntax Highlighted Code

  1. void main (void)
  2. {
  3. printf ("WTF is this?\n");
  4. }

Plain Code

void main (void)
{
printf ("WTF is this?\n");
}

Untitled C (15-Jan @ 00:01)

Syntax Highlighted Code

  1. printf( "Totor is here!\n" );

Plain Code

printf( "Totor is here!\n" );

Untitled C (31-Oct @ 17:52)

Syntax Highlighted Code

  1. struct record
  2. {
  3. char name[20];
  4. int score;
  5. [128 more lines...]

Plain Code

struct record
{
char name[20];
int score;
};

struct link 
{
void *recordptr;
struct link *next;
};

int compare_score(const void *, const void *);


int main(void)
{
int i; //temp index
struct link *head=NULL; //anchor list link always holds first link of list
struct link *newnode=NULL; //generic list link, used in link manipulataions
struct link *tempnode=NULL; // "
struct link *qsortarrayptr[10]; //array of pointers to links which will be sorted by qsort()
//build some data inline--just for testing
struct record x[] =
{
{"Bill",10},
{"John",20},
{"Nancy",30},
{"Sam",40},
{"Gus",50},
{"Becky",60},
{"Willy",45},
{"Kate",35},
{"Carolyn",25},
{"Robert",55}
};
//!!diagnostic--confirm test data is where/what we want
printf("\ndisplaying original array");
for(i=0;i<10;i++) printf("\nrecord x[%d]= %s, %d",i,x[i].name,x[i].score);
//(1) create the very first link of the list
head=(struct link *)malloc(sizeof(struct link)); //(1a)
head->recordptr=&x[0]; //(1b)
head->next=NULL; //(1c)

//(2) build the rest of the list by inserting newnodes at the head
for(i=1;i<10;i++)
{
newnode=(struct link *)malloc(sizeof(struct link)); //(2a)
newnode->recordptr=&x[i]; //(2b)
newnode->next=(struct link *)head; //(2c)
head=newnode; //(2d)
}
//!!diagnostic--display data now in the linked list
printf("\ndisplaying data in the linked list");
tempnode=head;
for(i=0;i<10;i++)
{
printf("\n %s, %d",
((struct record *)(tempnode->recordptr))->name,
((struct record *)(tempnode->recordptr))->score);
tempnode=tempnode->next;
}
//(3)copy the link pointers to the sorting array for sorting there
qsortarrayptr[0]=head; //(3a)
for(i=1;i<10;i++)
{
qsortarrayptr[i]= qsortarrayptr[i-1]->next; //(3b1-10)
}
//!!diagnostic--confirm things are where they're supposed to be
printf("\n displaying data accessed from qsortarrayptr before qsort()");
for(i=0;i<10;i++)
{
printf("\n %s, %d",
((struct record *)(qsortarrayptr[i]->recordptr))->name,
((struct record *)(qsortarrayptr[i]->recordptr))->score);
}
printf("\n now on to the qsort");
//(4) perform the sort on the list of pointers to links
qsort(qsortarrayptr, 10, sizeof(qsortarrayptr[0]), compare_score); //(4)
//!!diagnostic--inspect the list after the qsort()-is it sorted?
printf("\n displaying data accessed from qsortarrayptr after qsort()");
for(i=0;i<10;i++)
{
printf("\n %s, %d",
((struct record *)(qsortarrayptr[i]->recordptr))->name,
((struct record *)(qsortarrayptr[i]->recordptr))->score);
}
return 0;
}
///////////////////////////////////////////////////////////////////////////////////////////////////
//(5) define a ‘compare()’ function to be passed as an argument to the 'qsort()' function in stdlib
int compare_score(const void *p1, const void *p2)
//This presentation shows the steps for accessing the 'score' value for the p1, p2 arguments passed
// by qsort() to compare_score() in two ways--step-by-step, to reveal details of the access path,
// and one-step, to obscure those details.
{
int v1,v2;
#ifdef STEP_BY_STEP
//match p1 and p2 with values v1 and v2, step-by-step
//
//intermediate variables required for step-by-step approach
struct link **lpp1; //lpp1 is a pointer to a pointer to a link structure (must be compatible with p1)
struct link **lpp2; //lpp2 " p2
struct link *lp1; //lp1 is an ordinary pointer to a link, like 'head','newnode',and 'qsortarray[i]'
struct link *lp2; //lp2 "
struct record *rp1; //rp1 is a pointer to a 'record' structure
struct record *rp2; //rp2 "
//
//four stages of casting, copying, and following pointers
//
//get a pointer of the right type to point to qsortarray[i] which in turn is pointing to some links
lpp1=(struct link **)p1; //(5a)
lpp2=(struct link **)p2;
//
//now get a pointer which points directly to those links
lp1=*lpp1; //(5b)
lp2=*lpp2;
//
//now use the link pointer to get the record pointer
rp1=lp1->recordptr; //(5c)
rp2=lp2->recordptr;
//
//finally, use the record pointer to get the score
v1= rp1->score; //(5d)
v2= rp2->score;
#endif //step-by-step approach
#ifndef STEP_BY_STEP
//match values v1 and v2 with pointers p1 and p1 in a single step, with some loss of comprehendability
v1=((struct record *) ((*(struct link **)p1)->recordptr))->score; //(5') see (5a)-(5d) above for step-by-step
v2=((struct record *) ((*(struct link **)p2)->recordptr))->score; //"
#endif //one-step approach
return (v1-v2);
}

Untitled C (31-Oct @ 17:50)

Syntax Highlighted Code

  1. //linkedlist3.c - Implements a singly linked list, then sorts it with qsort() as an example of
  2. // passing functions as arguments.
  3. //This version of a singly list list follows Craig William's example (loosely) but "unpackages"
  4. // things for tutorial purposes
  5. [136 more lines...]

Plain Code

//linkedlist3.c - Implements a singly linked list, then sorts it with qsort() as an example of
// passing functions as arguments.
//This version of a singly list list follows Craig William's example (loosely) but "unpackages"
// things for tutorial purposes
#include <stdio.h>
#include <stdlib.h>
#define STEP_BY_STEP //used in function compare_score() for tutorial purposes.
//Data record template
//'record's contain a string and a number
struct record
{
char name[20];
int score;
};
//List link template
//links contain a pointer to data and a pointer to next link
struct link //was called 'number' in Craig’s original
{
void *recordptr;
struct link *next;
};
//prototype compare function for qsort()
int compare_score(const void *, const void *);
//main() -- just a bunch of executable code (you should package things as functions)
int main(void)
{
int i; //temp index
struct link *head=NULL; //anchor list link always holds first link of list
struct link *newnode=NULL; //generic list link, used in link manipulataions
struct link *tempnode=NULL; // "
struct link *qsortarrayptr[10]; //array of pointers to links which will be sorted by qsort()
//build some data inline--just for testing
struct record x[] =
{
{"Bill",10},
{"John",20},
{"Nancy",30},
{"Sam",40},
{"Gus",50},
{"Becky",60},
{"Willy",45},
{"Kate",35},
{"Carolyn",25},
{"Robert",55}
};
//!!diagnostic--confirm test data is where/what we want
printf("\ndisplaying original array");
for(i=0;i<10;i++) printf("\nrecord x[%d]= %s, %d",i,x[i].name,x[i].score);
//(1) create the very first link of the list
head=(struct link *)malloc(sizeof(struct link)); //(1a)
head->recordptr=&x[0]; //(1b)
head->next=NULL; //(1c)
//(2) build the rest of the list by inserting newnodes at the head
for(i=1;i<10;i++)
{
newnode=(struct link *)malloc(sizeof(struct link)); //(2a)
newnode->recordptr=&x[i]; //(2b)
newnode->next=(struct link *)head; //(2c)
head=newnode; //(2d)
}
//!!diagnostic--display data now in the linked list
printf("\ndisplaying data in the linked list");
tempnode=head;
for(i=0;i<10;i++)
{
printf("\n %s, %d",
((struct record *)(tempnode->recordptr))->name,
((struct record *)(tempnode->recordptr))->score);
tempnode=tempnode->next;
}
//(3)copy the link pointers to the sorting array for sorting there
qsortarrayptr[0]=head; //(3a)
for(i=1;i<10;i++)
{
qsortarrayptr[i]= qsortarrayptr[i-1]->next; //(3b1-10)
}
//!!diagnostic--confirm things are where they're supposed to be
printf("\n displaying data accessed from qsortarrayptr before qsort()");
for(i=0;i<10;i++)
{
printf("\n %s, %d",
((struct record *)(qsortarrayptr[i]->recordptr))->name,
((struct record *)(qsortarrayptr[i]->recordptr))->score);
}
printf("\n now on to the qsort");
//(4) perform the sort on the list of pointers to links
qsort(qsortarrayptr, 10, sizeof(qsortarrayptr[0]), compare_score); //(4)
//!!diagnostic--inspect the list after the qsort()-is it sorted?
printf("\n displaying data accessed from qsortarrayptr after qsort()");
for(i=0;i<10;i++)
{
printf("\n %s, %d",
((struct record *)(qsortarrayptr[i]->recordptr))->name,
((struct record *)(qsortarrayptr[i]->recordptr))->score);
}
return 0;
}
///////////////////////////////////////////////////////////////////////////////////////////////////
//(5) define a ‘compare()’ function to be passed as an argument to the 'qsort()' function in stdlib
int compare_score(const void *p1, const void *p2)
//This presentation shows the steps for accessing the 'score' value for the p1, p2 arguments passed
// by qsort() to compare_score() in two ways--step-by-step, to reveal details of the access path,
// and one-step, to obscure those details.
{
int v1,v2;
#ifdef STEP_BY_STEP
//match p1 and p2 with values v1 and v2, step-by-step
//
//intermediate variables required for step-by-step approach
struct link **lpp1; //lpp1 is a pointer to a pointer to a link structure (must be compatible with p1)
struct link **lpp2; //lpp2 " p2
struct link *lp1; //lp1 is an ordinary pointer to a link, like 'head','newnode',and 'qsortarray[i]'
struct link *lp2; //lp2 "
struct record *rp1; //rp1 is a pointer to a 'record' structure
struct record *rp2; //rp2 "
//
//four stages of casting, copying, and following pointers
//
//get a pointer of the right type to point to qsortarray[i] which in turn is pointing to some links
lpp1=(struct link **)p1; //(5a)
lpp2=(struct link **)p2;
//
//now get a pointer which points directly to those links
lp1=*lpp1; //(5b)
lp2=*lpp2;
//
//now use the link pointer to get the record pointer
rp1=lp1->recordptr; //(5c)
rp2=lp2->recordptr;
//
//finally, use the record pointer to get the score
v1= rp1->score; //(5d)
v2= rp2->score;
#endif //step-by-step approach
#ifndef STEP_BY_STEP
//match values v1 and v2 with pointers p1 and p1 in a single step, with some loss of comprehendability
v1=((struct record *) ((*(struct link **)p1)->recordptr))->score; //(5') see (5a)-(5d) above for step-by-step
v2=((struct record *) ((*(struct link **)p2)->recordptr))->score; //"
#endif //one-step approach
return (v1-v2);
}

Untitled C (30-Oct @ 14:29)

Syntax Highlighted Code

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. [52 more lines...]

Plain Code

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

//Normally the following structs would be in a separate .h file, im just putting it here for convenience

typedef struct LinkedListNode
{
    double showTime;
    char showName[50];
    char showDay[10];
    struct LinkedListNode* next;
}LinkedListNode;

typedef struct
{
    int listLength;
    LinkedListNode* head;
}LinkedList;

//The following is a function to create a list

LinkedList* createList()
{
    LinkedList* startList;
    startList = (LinkedList*)malloc(sizeof(LinkedList));
    startList->head = NULL;
    startList->listLength = 0;
    return startList;
}

//The following is a function to insert nodes
void insertNode(LinkedList* list)
{
    LinkedListNode* newNode
    newNode = (LinkedListNode*)malloc(sizeof(LinkedListNode));

    strcpy(newNode->showName, "Cheese"); /*This is just for testing purposes, in the actual program it will take in a function parameter */
    newNode->showTime = 2.3 //As is this
    printf("%lf %s",newNode->showTime, newNode->showName); //Used for testing purposes

    newNode->next = startList->head;

}

// Omitting freeLinkedList/Traverse etc functions

int main()
{
    LinkedList* myList;
    myList = createList();
    insertFirst(myList);
    return 0;
}    


Untitled C (22-Oct @ 14:15)

Syntax Highlighted Code

  1. void main() {}

Plain Code

void main() {}

Untitled C (19-Oct @ 00:34)

Syntax Highlighted Code

  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. void printAverageAmount(double money[], int n) {
  5. [24 more lines...]

Plain Code

#include <stdio.h>
#include <math.h>

void printAverageAmount(double money[], int n) {
    double total = 0.0;
    int i;
    for(i = 0; i<n; i++) {
        total+=(money[i]*100);
    }
    //printf("Total %g\n", total);
    double avg = total/n;
    avg+=0.000001;
    //printf("avg %d\n", avg);
    int cents = floor(fmod(avg,100.0));
    int dollars = floor(avg/100.0);
    printf("Everyone gets %d dollar(s) and %d cent(s).\n", dollars, cents);
}
/*
int main() {
    double a[5] = {100.00, 250.00, 320.00, 120.00, 1500.00};
    double b[3] = {8.00, 1.5, 1.5};
    double c[3] = {0.9999999, 0.9999999, 0.9999999};
    
    printAverageAmount(a, 5);
    printAverageAmount(b, 3);
    printAverageAmount(c, 3);
    return 0;
}
*/

Untitled C (18-Apr @ 20:18)

Syntax Highlighted Code

  1. tgtgtg

Plain Code

tgtgtg

Untitled C (29-Mar @ 18:55)

Syntax Highlighted Code

  1. #include <stdio.h>
  2.  
  3. main()
  4. {
  5. [4 more lines...]

Plain Code

#include <stdio.h>

main()
{
  for(;;)
      { 
          printf ("Hello World!\n");
      }
}

Untitled C (28-Mar @ 14:25)

Syntax Highlighted Code

  1. oid DumpASCII( void )
  2. {
  3.   char ascii[256];
  4.   int i;
  5. [7 more lines...]

Plain Code

oid DumpASCII( void )
{
  char ascii[256];
  int i;
 
  for ( i = 0 ; i < 256 ; ++i )
    ascii[i] = (char) i;   /* Fill the ascii array */
 
  DumpArea((BYTE *)ascii,256);

  return;
} /* End of DumpASCII() */

Untitled C (26-Mar @ 15:50)

Syntax Highlighted Code

  1. int f

Plain Code

int f

Untitled C (26-Feb @ 23:05)

Syntax Highlighted Code

  1. #include <windows.h>
  2. #include <stdio.h>
  3. #include <iostream>
  4. #include <time.h>
  5. [82 more lines...]

Plain Code

#include <windows.h>
#include <stdio.h>
#include <iostream>
#include <time.h>

CRITICAL_SECTION mutex;
const int ThreadNum=4;
const int num_steps=500000000;
double gsum = 0.0;






void ThreadProc(void *arg)
{
    double step,x,lsum=0.0;
    int i;
    
    step=1.0/(double)num_steps;
    
    for (i=*(int*)arg+1;i<num_steps;i+=ThreadNum)
    {
        x=(i-0.5)*step;
        lsum+=4.0/(1.0+x*x);
    }

    
    EnterCriticalSection(&mutex);
        gsum+=lsum;
    
    LeaveCriticalSection(&mutex);


}


int main()
{
    time_t st,st1;
    int  i;
    double pi;
    double tim;
    
    HANDLE hThread[ThreadNum];
    DWORD dwThreadID[ThreadNum];
    
    time(&st);
    InitializeCriticalSection(&mutex);
    
    for (i=0;i<ThreadNum;i++){
    
        hThread[i]=CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)ThreadProc,&i,0,&dwThreadID[i]);
    }
    WaitForMultipleObjects(ThreadNum,hThread,true,INFINITE);
    
    pi=gsum*1.0/(double)num_steps;
    time(&st1);
    tim=difftime(st1,st);
    std::cout.precision(20);
    std::cout << pi <<" in time "<<tim<<" seconds "<<std::endl ;
    for(int j=0; j<ThreadNum; j++)
    {
        CloseHandle(hThread[j]);
    }
    DeleteCriticalSection(&mutex);
}


















Untitled C (12-Jan @ 04:44)

Syntax Highlighted Code

  1. #include <stdio.h>
  2.  
  3. int fib(int n)
  4. {
  5. [23 more lines...]

Plain Code

#include <stdio.h>

int fib(int n)
{
    int a, b, t;
    int i;
    
    a = 0;
    b = 1;
    
    if(n == 0 || n == 1) 
        return n;
    else
        for(i = 1; i < n; i++) {
            t = a;
            a = a + b;
            b = t;
        }
        
    return a;
}


int main(int argc, char *argv[])
{
    printf("%d \n", fib(10));

}

Untitled C (15-Oct @ 04:37)

Syntax Highlighted Code

  1. int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
  2. int c;
  3. int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
  4. int c;
  5. [49 more lines...]

Plain Code

int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;int c;
int c;

iKwmJALqSZGDNWO (11-Oct @ 16:09)

Syntax Highlighted Code

  1. awegaw1.txt;2;5

Plain Code

awegaw1.txt;2;5

Untitled C (29-Jul @ 15:38)

Syntax Highlighted Code

  1. void store_test_fault_info(void)
  2. {
  3. #ifdef TEST_INFO_SIZE
  4. if(g_total_test_info!=NULL)
  5. [6 more lines...]

Plain Code

void store_test_fault_info(void) 
{
#ifdef TEST_INFO_SIZE
if(g_total_test_info!=NULL)
   {
   if((strlen(test_fault_info) + strlen(g_total_test_info)) <TEST_INFO_SIZE)
      strcat(g_total_test_info,test_fault_info) ;
   }
#endif
}

Untitled C (28-May @ 17:20)

Syntax Highlighted Code

  1. /*
  2.  
  3.                 CONNECTION DIAGRAM
  4.  
  5. [547 more lines...]

Plain Code

/*

                CONNECTION DIAGRAM

                      ------
                PB0 -|1   40|- PA0    
                PB1 -|2   39|- PA1    
                PB2 -|3   28|- PA2    
                PB3 -|4   37|- PA3    
                PB4 -|5   36|- PA4    
                PB5 -|6   35|- PA5    
                PB6 -|7   34|- PA6
                PB7 -|8   33|- PA7
                RESET -|9   32|- AREF
                VCC -|10  31|- GND
                GND -|11  30|- AVCC
              XTAL2 -|12  29|- PC7    UCNT1
              XTAL1 -|13  28|- PC6    UCNT2
                PD0 -|14  27|- PC5    UCNT3
    USARTTX        PD1 -|15  26|- PC4    LVL1
      APOLLOEN    PD2 -|16  25|- PC3    LVL2
    MDIR        PD3 -|17  24|- PC2    LVL3
    MSEL0        PD4 -|18  23|- PC1    LVL4
    MSEL1        PD5 -|19  22|- PC0
    PWMOUT        PD6 -|20  21|- PD7    HERMESEN
                      ------

*/


#include <avr/io.h>
#include <util/delay.h>
#include <stdio.h>
#include <inttypes.h>

#define BAUD 9600
#define MYUBRR F_CPU/16/BAUD-1

#define RAMPTIME        3000    // PWM ramping time (ms)
#define RAMPINTERVAL    300        // PWM ramping interval (ms)

#define LVL4            PC1    // Nivåbryter nivå 4
#define LVL3            PC2    // Nivåbryter nivå 3
#define LVL2            PC3    // Nivåbryter nivå 2
#define LVL1            PC4    // Nivåbryter nivå 1
#define UCNT3            PC5    // Enhetsteller nivå 3
#define UCNT2            PC6    // Enhetsteller nivå 2
#define UCNT1            PC7    // Enhetsteller nivå 1
#define SENSINPUTPIN    PINC // Porten sensorene er koblet til
#define SENSDDR            DDRC // Dataretningsregister for sensorer 

#define TEMP0    1            // Temperaturkanal 1
#define TEMP1    2            // Temperaturkanal 2
#define TEMP2    3            // Temperaturkanal 3
#define TEMP3    4            // Temperaturkanal 4

#define DOOR1    PA5            // Dørbryter 1
#define DOOR2    PA6            // Dørbryter 2
#define DOOR3    PA7            // Dørbryter 3
#define DOORPIN    PINA        // Porten dørbryterne er koblet til

#define HERMESEN    PD7        // Hermes enable
#define APOLLOEN    PD2        // Apollo enable
#define UCPORT        PORTD     // Porten enable-utgangene er på

#define MDIR        PD3        // Motor direction
#define MSEL0        PD4        // Motor selection bit0
#define MSEL1        PD5        // Motor selection bit1
#define PWMOUT        PD6        // Motor PWM channel
#define MOTORPORT    PORTD     // Porten motordriveren er koblet til
#define MOTORDDR    DDRD    // Dataretningsregister for motorport
#define HOME        4

#define HIS        PA0            // Aktiveringsbryter for bordet
#define HISPIN    PINA         // Porten aktiveringsbryteren står på

#define EMPTY 0

#define FORWARD 1
#define REVERSE 0
#define UP         1
#define DOWN    0

#define BOUNCELIMIT    30        // Avprelleingsteller grenseverdi

int sensecnt = 0;            // Avprellingsteller
int holdflag=0;                // Hold-flagg for avprelling

int lvlcnt1 = 1;            // Enhetsteller for nivå 1
int lvlcnt2 = 1;            // Enhetsteller for nivå 2
int lvlcnt3 = 1;            // Enhetsteller for nivå 3

int curtemp0 = 1023;        // Temperaturvariabel for nivå 1
int curtemp1 = 1023;        // Temperaturvariabel for nivå 2
int curtemp2 = 1023;        // Temperaturvariabel for nivå 3
int curtemp3 = 1023;        // Temperaturvariabel for nivå 4

int picklvl = EMPTY;
int motor = 1;
int motordir = FORWARD;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/*
    Les inn verdi fra ADC-omforming
    @param int chan - Hvilken ADC-kanal det skal leses fra.
*/
int readADC (int chan){
    int i;
    int ADC_temp;
    int ADCx = 0;
        
    ADMUX  = chan; // Velg kanal

    ADMUX |= (1 << REFS0);                 // Sett referanse til AVCC med ekstern kodensator på AREF
    ADMUX &= ~(1<<REFS1);
    ADCSRA |= (1<<ADPS2)|(1<<ADPS0);     // Sett /16 presacling
    ADCSRA |= (1<<ADEN);                 // Aktiver ADCen

    for(i=0;i<8;i++) {                     // Kjør 8 omforminger av signalet, og bruk gjennomsnittet
        ADCSRA |= (1<<ADSC);             // Kjør en enkel omforming
        while(!(ADCSRA & 0x10));         // Vent til omformingen er ferdig. (ADIF-flagget settes)
        ADC_temp = ADCL;                 // Les nedre del av SAR-registeret
        ADC_temp += (ADCH<<8);             // Legg til øvre del av SAR-registert. (Dette må skiftes 8 plasser)
        ADCx += ADC_temp;                // Akkumuler verdien
    }
    ADCx = (ADCx>>3);                    // Del på 8 (Finn gjennomsnittsverdien)

    ADCSRA &= ~(1<<ADEN);                 // Deaktiver ADCen
    return ADCx;                        // Returner ADC-verdien

}

/*
    USART Initialiseringsrutine
    @param unsigned int baud - Overføringshastigheten
*/
void USARTInit( unsigned int baud ){
    
    UBRR0H = (unsigned char) (baud>>8);            // Sett overføringshastigheten
    UBRR0L = (unsigned char) baud;
    
    UCSR0B = (1<< TXEN0);                        // Aktiver USART-sendemodul
    UCSR0C = (1<<USBS0)|(1<<UCSZ01)|(1<<UCSZ00);// Sett rammeformat til: 1 start-, 8 data- og 2 stoppbit

}
/*
    USART Sending av ett tegn
    @param unsigned char data - Tegnet som skal sendes
*/
void USARTTransmitByte( unsigned char data ){
    
    while (!(UCSR0A & (1<<UDRE0)));    // Vent til USART-modulen er klar for sending
    UDR0 = data;                     // Start overføringen
}

/*
    USART Sending av tekststreng
    @param const char *str - Peker til hvilken streng som skal sendes
*/
void USARTTransmit(const char *str){
    while(*str) {
        USARTTransmitByte((unsigned char)(*str));
        str++;
    }
    USARTTransmitByte(0x04); // Send stopp-byte (EOT)
}

/*
    USART Initialiseringsrutine    
*/
void PWMInit(void){
    // Setter COM0A1 = 1, COM0A0 = 0 i TCCR0A => Clear OC0A on Compare Match, SET OC0A at BOTTOM (Non-Inverting mode)
    // Setter WGM01 = 1, WGM00 = 1 i TCCR0A, og WGM02 = 0 i TCCR0B => Fast-PWM mode        
    TCCR2A |= (0<<COM2B1) | (0<<COM2B0)| (1<<WGM21) | (1<<WGM20);
    TCCR2B &= ~(1<<WGM22);
    TCCR2B |= (1<<CS20); // Ingen skalering av PWM-frekvensen

    // Sett dataretning på de benyttede pinnene til ut.
    MOTORDDR |= (1<<PWMOUT) | (1<<MSEL1) | (1<<MSEL0) | (1<<MDIR);

}

/*
    Acpreller en puls fra en sensor/bryter
    @param unsigned int sens - Referanse til hvilken sensor som skal avprelles
    @param volatile uint8_t *port - Referanse til hvilken port sensoren er koblet på
*/
int debounce_pulse(unsigned int sens, volatile uint8_t *port){
int returnvar = 0;

    while(*port & (1<<sens)){
        sensecnt++;

        if(sensecnt >= BOUNCELIMIT){
            returnvar = 1;
        }
    }

    sensecnt=0;
    
    return returnvar;    
}

/*
    Avpreller en sensor/bryter som holdes inne
    @param unsigned int sens - Referanse til hvilken sensor som skal avprelles
    @param volatile uint8_t *port - Referanse til hvilken port sensoren er koblet på
*/
int debounce_hold(unsigned int sens, volatile uint8_t *pin) {
int returnvar = 0;

    if(holdflag){
        if(!(*pin & (1<<sens))){
            holdflag=0;
        }
    } else {
        if(*pin & (1<<sens)){
            _delay_us(500);
            if(*pin & (1<<sens)){
                returnvar = 1;
                holdflag=1;
            }
        }
    }

    return returnvar;
}

/*
    Lagrer temperaturer i "nåværende temperatur"-variabler
*/
void readtemps(){
    curtemp0 = readADC(TEMP0);
    curtemp1 = readADC(TEMP1);
    curtemp2 = readADC(TEMP3);
    curtemp3 = readADC(TEMP3);
}


/*
    Finner kaldeste nivå
    @returns int - Returnerer en referanse til det kaldeste nivået
*/
int getcoldestlevel(){
    int min = 1023;
    int coldest = 1;
    
    if(curtemp1 < min && lvlcnt1 > 0){
        coldest = 1;
        min = curtemp1;
    }


    if(curtemp2 < min && lvlcnt2 > 0){
        coldest = 2;
        min = curtemp2;
    }

    if(curtemp3 < min && lvlcnt3 > 0){
        coldest = 3;
        min = curtemp3;
    }

    return coldest;
}



/*
    Initialisering av dataretningsregisteret for sensorene    
*/
void SensorInit(){
    SENSDDR = 0x01; // Sett alle pinner på port C til innganger.
}

/*
    Sender systemstatus til Hermes via USART
*/
void SerialSendStatus(){

    char usarttext[40];
    int n;

    readtemps();            
    n=sprintf(usarttext,"T1%dT2%dT3%dC1%dC2%dC3%d", curtemp1, curtemp2, curtemp3, lvlcnt1, lvlcnt2, lvlcnt3);                        
    USARTTransmit(usarttext);
    
}

/*
    Initialisering av motor
    @param unsigned int motor - Hvilken motor som skal kjøres
    @param unsigned in direction - Hvilken retning motoren skal rotere i
*/
void motor_init(unsigned int motor, unsigned int direction){
    // Velg motor
    if(motor == 0){
        MOTORPORT &= ~(1<<MSEL0);    // 0
        MOTORPORT &= ~(1<<MSEL1);    // 0
    } else if (motor == 1){
        MOTORPORT |= (1<<MSEL0);    // 1
        MOTORPORT &= ~(1<<MSEL1);    // 0
    } else if (motor == 2){
        MOTORPORT &= ~(1<<MSEL0);    // 0
        MOTORPORT |= (1<<MSEL1);    // 1
    } else if (motor == 3){
        MOTORPORT |= (1<<MSEL0);    // 1
        MOTORPORT |= (1<<MSEL1);    // 1
    }

    if(direction){                // Sett retningen motoren skal kjøre
        MOTORPORT |= (1<<MDIR);
    } else {
        MOTORPORT &= ~(1<<MDIR);
    }    

}

/*
    Setter hastigheten (pådraget) til motorene
    @param unsigned int speed - Hastigheten i prosent av fullt pådrag
*/
void motor_setspeed(unsigned int speed){
    OCR2B = (255*speed)/100;
}

/*
    Start motoren
*/
void motor_start(){
    TCCR2A |= (1<<COM2B1);

}

/*
    Stopp motoren
*/
void motor_stop(){
    TCCR2A &= ~(1<<COM2B1);

}

/*
    Øker pådraget til motorene gradvis (såkalt ramping)
*/
void motor_rampup(){
    //int i = 1;
    for(int i = 1;i<=100;i++){
        _delay_ms(10);
        motor_setspeed((255*i)/100); // Kalkuler pådragsverdi fra prosentverdi.
    }
}

/*
    Reduserer pådraget til motorene gradvis (såkalt ramping)
*/
void motor_rampdown(){
    for(int i = 100;i>=1;i--){
        _delay_ms(10);
        motor_setspeed((255*i)/100); // Kalkuler pådragsverdi fra prosentverdi.
    }
}

/*
    Kjør heisen til ønsket nivå
    @param unsigned int level - Hvilket nivå heisen skal kjøre til
*/
void elevator_goto(unsigned int level){
    unsigned int dir;

    if(level < HOME){
        dir = DOWN;
    } else {
        dir = UP;
    }

    motor_init(level, dir);
    motor_setspeed(60);
    motor_start();
    
    while(1){
        if(level == 1){
            if(debounce_hold(LVL1, &SENSINPUTPIN)){
                break;    
            }
        } else if (level == 2){
            if(debounce_hold(LVL2, &SENSINPUTPIN)){
                break;    
            }
        } else if (level == 3){
            if(debounce_hold(LVL3, &SENSINPUTPIN)){
                break;    
            }
        } else if (level == HOME){
            if(debounce_hold(LVL3, &SENSINPUTPIN)){
                break;
            }
        }
    }
            
    motor_stop();
}

/*
    Roter et gitt nivå
    @param unsigned int level - Hvilket nivå som skal roteres
    @param unsigned int direction - Hvilken retnings skal nivået roteres i
    @param unsigned int duration - Hvor lenge skal nivået rotere. (0 for uendelig).
*/
void rotatelevel(unsigned int level, unsigned int direction, unsigned int duration){
    // Initialiser motoren med riktige verdier
    motor_init(level, direction);

    motor_setspeed(0); // Start motoren med 0 i pådrag
    motor_start();


    // Gradvis økning av pådrag (ramping) i 100*10ms = 1 sekund
    motor_rampup();

    // Motoren kjører nå på fullt pådrag

    if(duration > 0){
        _delay_ms(duration);

        // Gradvis redusering av pådrag i 1 sekund
        motor_rampdown();

        motor_setspeed(0);
        motor_stop();
    }

}

/*
    Starter dispenseringen av en enhet
    @param unsigned int level - Hvilket nivå det skal hentes en enhet fra
*/
void dispenseunit(unsigned int level){

    elevator_goto(level);

    UCPORT |= (1<<APOLLOEN); // Aktiver Apollo (Lyseffekter)
    
    rotatelevel(level, FORWARD, 5000);
    
    elevator_goto(HOME);

    UCPORT &= ~(1<<APOLLOEN); // Deaktiver Apollo (Lyseffekter)
}

/*
    Starter påfyllingsmodus for et gitt nivå
    @param unsigned int level - Hvilket nivå skal gå i påfyllingsmodus
    @param unsigned int sens - Hvilken sensor/bryter som skal avbryte påfyllingen
    @param volatile uint8_t *port - Hvilken port sensoren/bryteren er koblet til
*/
void startrefillmode(unsigned int level, unsigned int sens, volatile uint8_t *port){
    rotatelevel(level, FORWARD, 0);    // Roter nivået kontinuerlig
    int count = 0;

    while(debounce_hold(sens, port)){
        // Øk antallet enheter i hvertnivå når en enhet blir satt inn
        if(level == 1){
            if(debounce_pulse(UCNT1, &SENSINPUTPIN)){
                lvlcnt1++;
                count = 1;
            }
        } else if(level == 2){
            if(debounce_pulse(UCNT2, &SENSINPUTPIN)){
                lvlcnt2++;
                count = 1;
            }
        } else if(level == 3){
            if(debounce_pulse(UCNT3, &SENSINPUTPIN)){
                lvlcnt3++;
                count = 1;
            }
        }
        
        // Dersom en enhetsteller har økt, gi beskjed til Hermes.
        if(count){
            SerialSendStatus();
            count = 0;
        }    

    }

    // Stopp rotasjonen av platået når døren lukkes

    motor_rampdown();
    motor_setspeed(0);
    motor_stop();

}

/*
    Håndtering av sensorer
*/
void handle_sensors(){

    if(debounce_hold(DOOR1, &DOORPIN)){ // Dersom dør 1 er åpnet...
        startrefillmode(1, DOOR1, &DOORPIN);             // ... start påfyllingsmodus i nivå 1
    }

    if(debounce_hold(DOOR2, &DOORPIN)){ // Dersom dør 1 er åpnet...
        startrefillmode(2, DOOR2, &DOORPIN);             // ... start påfyllingsmodus i nivå 1
    }

    if(debounce_hold(DOOR3, &DOORPIN)){ // Dersom dør 1 er åpnet...
        startrefillmode(3, DOOR3, &DOORPIN);             // ... start påfyllingsmodus i nivå 1
    }

    if(debounce_pulse(HIS, &HISPIN)){     // Dersom sensoren i bordplaten aktiveres...
        dispenseunit(getcoldestlevel());     // ... start dispenseringen av en enhet
    }


}

/*
    Hovedprogram
*/
int main(void){    
    
    USARTInit(MYUBRR);     // Initialiser USART
    PWMInit();             // Initialiser PWM
    SensorInit();        // Initialiser sensorport
    
    DDRA = 0x00;         // Alle pinner i port A settes til innganger.
    //ADCInit() ; // Init ADC

    //DDRD = 0xFF;     // Port D datadir: All out.


    UCPORT |= (1<<HERMESEN); // Enable Hermes

    int i=0;    

    for(;;){
        if(i++ >= 2000){ // Send status til Hermes ved jevne mellomrom.
            SerialSendStatus();
            i=0;
        }

        handle_sensors(); // Håndter sensoraktivering/brytertrykk

    }

}

Untitled C (8-May @ 15:40)

Syntax Highlighted Code

  1. int i,tab[10]={1,1,1,1,1,1,1,1,1,1}
  2.     ,tab2[10]={1,1,1,1,1,1,1,1,1,1};
  3. int shmid;
  4. pid_t pid;
  5. [3 more lines...]

Plain Code

int i,tab[10]={1,1,1,1,1,1,1,1,1,1}
    ,tab2[10]={1,1,1,1,1,1,1,1,1,1};
int shmid;
pid_t pid;
int *ptr;

shmid=shmget(IPC_PRIVATE,25*sizeof(int),O_CREAT|0600);
ptr=(int *)shmat(shmid,NULL,0);

Untitled C (8-May @ 15:38)

Syntax Highlighted Code

  1. int i,tab[10]={1,1,1,1,1,1,1,1,1,1}
  2.     ,tab2[10]={1,1,1,1,1,1,1,1,1,1};
  3. int shmid;
  4. pid_t pid;
  5. [3 more lines...]

Plain Code

int i,tab[10]={1,1,1,1,1,1,1,1,1,1}
    ,tab2[10]={1,1,1,1,1,1,1,1,1,1};
int shmid;
pid_t pid;
int *ptr;

shmid=shmget(IPC_PRIVATE,25*sizeof(int),O_CREAT|0600);
ptr=(int *)shmat(shmid,NULL,0);

Untitled C (8-May @ 15:38)

Syntax Highlighted Code

  1. int i,tab[10]={1,1,1,1,1,1,1,1,1,1}
  2.     ,tab2[10]={1,1,1,1,1,1,1,1,1,1};
  3. int shmid;
  4. pid_t pid;
  5. [3 more lines...]

Plain Code

int i,tab[10]={1,1,1,1,1,1,1,1,1,1}
    ,tab2[10]={1,1,1,1,1,1,1,1,1,1};
int shmid;
pid_t pid;
int *ptr;

shmid=shmget(IPC_PRIVATE,25*sizeof(int),O_CREAT|0600);
ptr=(int *)shmat(shmid,NULL,0);

Untitled C (1-Apr @ 16:41)

Syntax Highlighted Code

  1. #include <stdio.h>
  2.  
  3.  
  4. int main()
  5. [5 more lines...]

Plain Code

#include <stdio.h>


int main()
{
   int i;
   for(i = 0; i < 100; i++)
      printf("teste %d\n", i); 

}

Untitled C (19-Feb @ 09:20)

Syntax Highlighted Code

  1. #define controlbus    PORTC
  2. #define controlddr    DDRC
  3. #define databus        PORTB
  4. #define dataddr        DDRB
  5. [17 more lines...]

Plain Code

#define controlbus    PORTC
#define controlddr    DDRC
#define databus        PORTB
#define dataddr        DDRB


#include <avr/io.h>
#include <util/delay.h>

void lcdInit( void );
void LCD_text(char *text);
void LCD_command(unsigned int command);
void LCD_writecycle(unsigned int controlbusvalue);
void LCD_clear( void );

void lcdInit( void )
{

    _delay_ms(50);             // Wait 15ms or more after V_DD reaches 4.5V
    dataddr = 0xFF;                            // This will be the data to LCD, output
    controlddr = (1<<E)|(1<<RS)|(1<<RW);    // Set the control lines for LCD as output

Untitled C (17-Feb @ 07:20)

Syntax Highlighted Code

  1. #define FOSC 1843200 // Clock Speed
  2. #define BAUD 9600
  3. #define MYUBRR FOSC/16/BAUD-1

Plain Code

#define FOSC 1843200 // Clock Speed
#define BAUD 9600
#define MYUBRR FOSC/16/BAUD-1

Untitled C (17-Feb @ 07:20)

Syntax Highlighted Code

  1. void USART0_Init( unsigned int baudrate )
  2. {
  3.     /* Set the baud rate */
  4.     UBRR0H = (unsigned char) (baudrate>>8);                  
  5. [8 more lines...]

Plain Code

void USART0_Init( unsigned int baudrate )
{
    /* Set the baud rate */
    UBRR0H = (unsigned char) (baudrate>>8);                  
    UBRR0L = (unsigned char) baudrate;
    
    /* Enable UART receiver and transmitter */
    UCSR0B = ( ( 1 << RXEN0 ) | ( 1 << TXEN0 ) ); 
    
    /* Set frame format: 8 data 2stop */
    UCSR0C = (1<<USBS0)|(1<<UCSZ01)|(1<<UCSZ00);              //For devices with Extended IO
    //UCSR0C = (1<<URSEL)|(1<<USBS0)|(1<<UCSZ01)|(1<<UCSZ00);   //For devices without Extended IO
}

Untitled C (31-Dec @ 16:58)

Syntax Highlighted Code

  1. a

Plain Code

a

Untitled C (26-Oct @ 21:51)

Syntax Highlighted Code

  1. #include "naomi.h"
  2. #include "sprajt1.h"
  3. #include "sprajt2.h"
  4. #include "paleta.h"

Plain Code

#include "naomi.h"
#include "sprajt1.h"
#include "sprajt2.h"
#include "paleta.h"

Untitled C (21-Sep @ 22:19)

Syntax Highlighted Code

  1. #include <stdio.h>
  2. #include <conio.h>
  3.  
  4. main() {
  5. [4 more lines...]

Plain Code

#include <stdio.h>
#include <conio.h>

main() {

  printf("Hello world!");
  getch();

}

Untitled C (17-Sep @ 15:46)

Syntax Highlighted Code

  1. printf('', '');

Plain Code

printf('', '');

Untitled C (16-Sep @ 15:58)

Syntax Highlighted Code

  1. main()
  2. printf("hello");

Plain Code

main()
printf("hello");

Untitled C (10-Sep @ 02:57)

Syntax Highlighted Code

  1. void a()
  2. {
  3.  
  4. }
  5. [5 more lines...]

Plain Code

void a()
{

}


int main()
{
a();
}

Untitled C (10-Sep @ 02:56)

Syntax Highlighted Code

  1. if(a = 1)
  2. a = 2;
  3.  

Plain Code

if(a = 1)
a = 2;

Untitled C (4-Sep @ 08:51)

Syntax Highlighted Code

  1. int main(int argc, char **argv) { return 0; }

Plain Code

int main(int argc, char **argv) { return 0; }

Untitled C (3-Sep @ 15:47)

Syntax Highlighted Code

  1. [21:49] <Harm> ikke niet snappe
  2. [21:49] <Harm> (18:45:51) (Sandertjuhh-F00d) Harm kun jij nou nooit normaal doen?
  3. [21:49] <Harm> oow
  4. [21:49] <Harm> (18:49:48) (his_royal_evilness) lol ,wat heeft Harm gedaan dan Sandertjuhh? :/
  5. [147 more lines...]

Plain Code

[21:49] <Harm> ikke niet snappe
[21:49] <Harm> (18:45:51) (Sandertjuhh-F00d) Harm kun jij nou nooit normaal doen?
[21:49] <Harm> oow
[21:49] <Harm> (18:49:48) (his_royal_evilness) lol ,wat heeft Harm gedaan dan Sandertjuhh? :/
[21:49] <Harm> :D
[21:50] <Harm> wiebe
[21:50] <Harm> is weg
[21:50] <Harm> Sandertjuhh
[21:50] <Harm> !!!
[21:50] <Sandertjuhh> rot op
[21:51] <Harm> wat nou :\
03[21:51] * GJ (media@IrcWorld-27647.versatel.nl) has joined #wmcity
[21:51] <GJ> Halllo
[21:51] <Harm> wat heb ik nu weer fout gedaan
[21:51] <Sandertjuhh> ja dat weet je godverdomme wel eikel...
01[21:52] <Lampjuh> Gaan we ruzie maken? xD
01[21:52] <Lampjuh> ,stats Lampjuh
04[21:52] <+Wabot> [4 Lampjuh heeft4 17,003x 4(5.9%) iets gezegd. ]
04[21:52] <+Wabot> [4 Lampjuh is4 179x (4 2.2 %) dit kanaal binnengekomen, en sprak per join gemiddeld4 95 regels ]
04[21:52] <+Wabot> [4 Lampjuh heeft4 70,218 (5.2%) woorden gezegd (gemiddeld4 4.13 woorden per regel) ]
04[21:52] <+Wabot> [4 Lampjuh heeft4 329,182 letters gezegt (Gemiddeld4 19.36 letters per regel) ]
04[21:52] <+Wabot> [4 Lampjuh heeft een karma van4 0 ]
04[21:52] <+Wabot> [4 Lampjuh staat op nummer4 #5 bij het meest aantal regels. ]
04[21:52] <Harm> Lampjuh
04[21:52] <Sandertjuhh> Lampjuh: houd jij je er gewoon ff buiten wil je...
01[21:52] <Lampjuh> De 1700 ben ik gepasseerd :-)
[21:52] <Harm> die g ast doet ineens raar
[21:52] <Harm> :\
[21:52] <Sandertjuhh> ach wat lul jij nou Harm
01[21:52] -> -Harm- what's wrong :\
[21:52] <Sandertjuhh> je weet donders goed wat ik bedoel
[21:52] <Mark> what happenend
[21:52] <Sandertjuhh> ,top
[21:52] <+Wabot> [ Top4 5 meeste praters ][ Zie ook:4 http://wabot.owns.nl/ ]
[21:52] <+Wabot> [4 #1 ][ met een aantal van:4 30,138 regels,4 Wiebe ]
[21:52] <+Wabot> [4 #2 ][ met een aantal van:4 24,020 regels,4 Sandertjuhh ]
[21:52] <+Wabot> [4 #3 ][ met een aantal van:4 23,367 regels,4 Harm ]
[21:52] <+Wabot> [4 #4 ][ met een aantal van:4 18,717 regels,4 Lucas ]
04[21:52] <+Wabot> [4 #5 ][ met een aantal van:4 17,004 regels,4 Lampjuh ]
[21:53] <Harm> nee man ?? leg dat es uit
01[21:53] <Lampjuh> ow, daarom? :')
05[21:53] -Harm- geen idee
[21:53] <Sandertjuhh> houd je van de domme Harm
01[21:53] <Lampjuh> Sandertjuhh, het zal wel iets stoms zijn :P anders ga je wel in query?
01[21:53] <Lampjuh> Ja, maar ook van jou :P
[21:53] <Mark> :P
01[21:53] <Lampjuh> <333
[21:53] <Harm> Mm.. is het omdat ik je een beetje dood heb gespamt ? Sandertjuhh
[21:53] <Sandertjuhh> waarom zou ik in query gaan met Harm?
[21:54] <Sandertjuhh> kan mij dat hele spammen nou verrekken
01[21:54] <Lampjuh> Om te ruzieen :P
01[21:54] <Lampjuh> Welk spammen nu weer?
01[21:54] <Lampjuh> Wat is het probleem nu dan xD?
[21:54] <Sandertjuhh> voor mij part spam je de koningin dood kan mij 't wat rotten
01[21:54] <Lampjuh> ik snap er niets van
[21:54] <Harm> ik dan wel ?
01[21:54] <Lampjuh> Waarschijnlijk ook niet :')
[21:55] <Sandertjuhh> Harm weet dondersgoed waar ik 't over heb
[21:56] <Harm> Jup is het omdat ik met je zusje in bed heb gelegen ?
[21:56] <Sandertjuhh> hij moet gewoon niet zo fucking de schijn voor houden
01[21:56] <Lampjuh> Jonge jonge jonge :P Is het iets met het aantal posts?
[21:56] <Harm> ze was wel lekker Sandertjuhh
[21:56] <Sandertjuhh> weet ik
01[21:56] -> -Harm,- ik snap er niets van.. jij ook niet zeker xD
05[21:57] -Harm- nop hij zegt ook niks op msn
03[21:57] * Danny (danny@IrcWorld-3496.internl.net) has joined #wmcity
03[21:57] * ChanServ sets mode: +o Danny
01[21:57] -> -Harm- tegen mij ook niet :\
[21:57] <Sandertjuhh> maar daar gaat 't hier niet over Harm
[21:57] <Harm> waarom dan wel
[21:57] <Harm> ?
[21:57] <Sandertjuhh> dat weet je godverdomme wel
[21:57] <Mark> vertel het dan
[21:57] <Mark> gewoon
01[21:57] <Lampjuh> Sandertjuhh verveelt zich?
[21:57] <Mark> :)
[21:58] <MartijnD> ik = slapen
[21:58] <MartijnD> of in elk geval tv kijken beneden
04[21:58] <Sandertjuhh> Lampjuh: ik verveel me neit hoor
[21:58] <Harm> Sandertjuhh je kan de schijt krijgen GVD als je niet zegt waarom het gaat weet ik het ook niet, dus ......
[21:58] <Harm> Danny zeg wat tegen Sandertjuhh hij doet dom
[21:58] <Sandertjuhh> ach flikker toch gouw op smerige stront mongool
01[21:59] <Lampjuh> Omg, dit slaat echt nergens over
[21:59] <Sandertjuhh> no offense tegen mongolen overigens.... dus voel je maar niet aangesproken his_royal_evilness
[21:59] <Mark> :P
01[21:59] <Lampjuh> roffelll
[21:59] <Harm> his_royal_evilness
[21:59] <Harm> :')
[21:59] <Harm> pwned
[21:59] <Harm> his_royal_evilness pik je dat
[22:00] <Sandertjuhh> dies er denk ik toch niet:p
[22:00] <Sandertjuhh> maar wat boeit 't jou Harm
[22:00] <Sandertjuhh> als ik jou was zou ik me druk maken om andere dingen...
[22:00] <Harm> Ik vind dit wel slecht hoor man jij als irc op hoort mensen te helpen
[22:00] <Harm> niet uit te schelden
[22:00] <Harm> om 1 of andere reden
[22:00] <Sandertjuhh> mensen helpen doe ik wel in #help
[22:01] <Sandertjuhh> hier ben ik een gewone chatter
[22:01] <Sandertjuhh> klaar
[22:01] <Harm> ja daarom kick je soms ook mensen
[22:01] <Harm> :\
[22:01] <Sandertjuhh> dat doet operserv...
[22:01] <Sandertjuhh> niet ik
[22:01] <Sandertjuhh> maar Harm
[22:01] <Harm> wat ?
[22:02] <Sandertjuhh> laat ik 't zo zeggen... als die euro die jij me nog schudlig bent... niet voor overmorgen op mijn rekening staat.... zal 't er voor jou anders uit gaan zien
[22:02] <Mark> lol
[22:02] <Mark> :P
[22:02] <Harm> omg...
[22:02] <Harm> gaat het om die euro
[22:02] <Harm> man
[22:02] <Sandertjuhh> ik moet ook m'n mac voedsel betalen ja
[22:02] <Harm> jezus ik heb een keer 1,30 van hem geleend
[22:02] <Mark> jee man
[22:03] <Mark> moet je die euro van mij hebben
[22:03] <Mark> :P
02[22:03] * MartijnD (ikben@IrcWorld-23889.wanadoo.nl) Quit (Ping timeout: 180 seconds)
[22:03] <Sandertjuhh> ja toevallig wel....
[22:03] <Sandertjuhh> ik heb nog 2 euro
[22:03] <Sandertjuhh> dus kan nog 2 keer eten bij de mac
[22:03] <Sandertjuhh> dus die euro graag met spoed overmaken...
04[22:03] <Mark> Lampjuh: 
[22:03] <Mark> het is nu net spannend
[22:03] <Mark> xD
[22:04] <Harm> nou Sandertjuhh overmaking is goedgekeurd
[22:04] <Harm> morgen staat hij op je rekening
[22:04] <Sandertjuhh> dank je
[22:04] <Harm> pff kon je dat niet eerder zegge
01[22:04] <Lampjuh> Maar maar maar
01[22:04] <Lampjuh> waar gaat het toch over
01[22:04] <Lampjuh> over EEN euro xD!
[22:04] <Harm> om een euro
[22:04] <Harm> idd
01[22:05] <Lampjuh> echt te gek voor woorden
[22:05] <Harm> 2.20 gulden
[22:05] <Harm> ,convert euro gulden 1
[22:05] <+Wabot> [4 Convert 4][ Verkeerde input ofzo..! ]
[22:05] <Harm> pff
[22:05] <Sandertjuhh> 2.20371 om precies te zijn
[22:05] <Harm> :@
04[22:05] <.FlorisD> Lampjuh, tijd om er een webcam bij te pakken om gebarentaal te gaan gebruiken? :P
[22:05] <.FlorisD> als het te gek voor woorden is
01[22:05] <Lampjuh> Jahaha :P
[22:05] <Mark> dit is echt dom
[22:05] <Harm> ok Sandertjuhh
[22:05] <Harm> schat
[22:05] <Mark> :P
[22:05] <Harm> :K
01[22:05] <Lampjuh> FlorisD, mn pa heeft mn webcam gejat :P
[22:05] <Harm> nu doen we normaal

Untitled C (2-Sep @ 18:33)

Syntax Highlighted Code

  1. tythg

Plain Code

tythg

asdf (1-Aug @ 08:30)

Syntax Highlighted Code

  1. asdfasdfa

Plain Code

asdfasdfa

Untitled C (30-Jul @ 17:10)

Syntax Highlighted Code

  1. int main(int argc, char *argv[])
  2. {
  3.     printf("say my name bitch!\n");
  4.     return 0;
  5. }

Plain Code

int main(int argc, char *argv[])
{
    printf("say my name bitch!\n");
    return 0;
}

Untitled C (21-Jul @ 14:40)

Syntax Highlighted Code

  1. int main() {
  2.  
  3. }

Plain Code

int main() {

}

Untitled C (19-Jul @ 08:37)

Syntax Highlighted Code

  1. fgjhfgjhfgjhfgjhfjh
  2. gkgjkgjk
  3.  

Plain Code

fgjhfgjhfgjhfgjhfjh
gkgjkgjk

Untitled C (15-Jul @ 00:02)

Syntax Highlighted Code

  1. void main(){
  2.  
  3. printf("hi , there");
  4. }

Plain Code

void main(){

printf("hi , there");
}

Untitled C (12-Jul @ 05:05)

Syntax Highlighted Code

  1. ass

Plain Code

ass

Untitled C (10-Jul @ 18:09)

Syntax Highlighted Code

  1. ghjg

Plain Code

ghjg

Test (26-Jun @ 11:24)

Syntax Highlighted Code

  1. Hi,
  2. Hello
  3. how are you?????

Plain Code

Hi,
Hello 
how are you?????

Binary Search (10-Jun @ 11:20)

Syntax Highlighted Code

  1. #include <stdio.h>
  2. int binarysearch(int A[], int value, int low, int high);
  3.  
  4. int binarysearch(int A[], int value, int low, int high) {
  5. [16 more lines...]

Plain Code

#include <stdio.h>
int binarysearch(int A[], int value, int low, int high);

int binarysearch(int A[], int value, int low, int high) {
        if (high < low)
                return -1; // not found

        int mid = (low + high) / 2;

        if (A[mid] > value)
                return binarysearch(A, value, low, mid-1);
        else if (A[mid] < value)
                return binarysearch(A, value, mid+1, high);
    else
                return mid; // found
 }

int main(){
        int A[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
        printf("Found 7? %d", binarysearch(A,7,0,21));
}

Untitled C (2-Jun @ 17:09)

Syntax Highlighted Code

  1. int hello;
  2.  

Plain Code

int hello;

Untitled C (29-May @ 11:14)

Syntax Highlighted Code

  1. dsadasdasdsadsadasdsasadasdsadsad

Plain Code

dsadasdasdsadsadasdsasadasdsadsad

Untitled C (27-May @ 12:42)

Syntax Highlighted Code

  1. Hello

Plain Code

Hello

Untitled C (26-May @ 22:25)

Syntax Highlighted Code

  1. #include <stdio.h>
  2.  
  3. int main() {
  4.  
  5. [3 more lines...]

Plain Code

#include <stdio.h>

int main() {

    printf("Hello World");
    return 1;

}

Untitled C (23-May @ 21:48)

Syntax Highlighted Code

  1. $row['NM_ATLIT']

Plain Code

$row['NM_ATLIT']

Untitled C (15-May @ 19:10)

Syntax Highlighted Code

  1. print 'test';

Plain Code

print 'test';

Untitled C (12-May @ 14:40)

Syntax Highlighted Code

  1. int main() {
  2.     printf("hello world") ;
  3. }

Plain Code

int main() {
    printf("hello world") ;
}

Untitled C (10-May @ 00:20)

Syntax Highlighted Code

  1. asdfasdfasdfasdfasdf

Plain Code

asdfasdfasdfasdfasdf

Untitled C (2-Apr @ 14:48)

Syntax Highlighted Code

  1. k

Plain Code

k